Skip to content

Commit bb28d8c

Browse files
authored
Update CONTRIBUTING.md
1 parent efa3bec commit bb28d8c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Modifying the FEEL parser is more complex and requires some knowledge about the
124124
* [Blog: Easy Parsing with Parser Combinators](https://www.lihaoyi.com/post/EasyParsingwithParserCombinators.html)
125125
* [Blog: Build your own Programming Language with Scala](https://www.lihaoyi.com/post/BuildyourownProgrammingLanguagewithScala.html)
126126

127-
Example: Add the nullish coalescing operator `??`: `null ?? "default"`
127+
Example: Add the nullish coalescing operator `null ?? "default"`
128128

129129
* Extend the parsing model in [Exp.scala](src/main/scala/org/camunda/feel/syntaxtree/Exp.scala)
130130
* Add a new type `case class NullishCoalescing(value: Exp, alternative: Exp) extends Exp`
@@ -133,11 +133,18 @@ Example: Add the nullish coalescing operator `??`: `null ?? "default"`
133133
* Implement the parser: `P("??" ~ expLvl4)`
134134
* Note: the parser uses levels for a hierarchy to define precedence and avoid left recursion
135135
* Build the parsed expression: `.map { NullishCoalescing(value, _) }`
136-
* Add the new parser to the suitable level
137-
* Add the new operator in [FeelInterpreter.scala](src/main/scala/org/camunda/feel/impl/interpreter/FeelInterpreter.scala)
138-
* ???
139-
* Verify the behavior by writing test cases in ???
140-
136+
* Add the new parser to the suitable level `| nullishCoalesching(value)`
137+
* Handle the new operator in [FeelInterpreter.scala](src/main/scala/org/camunda/feel/impl/interpreter/FeelInterpreter.scala)
138+
* Add a case in `def eval(expression: Exp)` with: `case NullishCoalescing(value, alternative) => ???`
139+
* Implement the behavior and return `eval(value)` or `eval(alternative)`
140+
* Verify the behavior by writing test cases in [InterpreterBooleanExpressionTest.scala](src/test/scala/org/camunda/feel/impl/interpreter/InterpreterBooleanExpressionTest.scala)
141+
* Add a new test case following the pattern: `"A nullish coalescing operator" should "return the value if the given value is not null" in { ??? }`
142+
* Add more test cases for other results, or covering edge cases
143+
* Group all test cases for a method using `it should "return the alternative if the given value is null" in { ??? }`
144+
* Run all tests to verify the behavior
145+
* Run the Maven build to format the code
146+
* Open a pull request and link to the FEEL issue
147+
* Then, add the new operator to the documentation in the [Camunda docs](https://docs.camunda.io/docs/next/components/modeler/feel/language-guide/feel-boolean-expressions/)
141148

142149
## Public API and backward compatibility
143150

0 commit comments

Comments
 (0)