diff options
feat(src/StringConsumer): Add higher order consumers, integer, binary operation and if keywords consumers HEAD main
Higher order consumers are called that way because they use other (base)
consumers in their logic. In a sense, the other consumers are parameters
to the higher order consumers.
1 files changed, 18 insertions, 0 deletions
| -rw-r--r-- | src/StringConsumer/BaseConsumers/BinaryOperatorConsumer.cl | 18 |
diff --git a/src/StringConsumer/BaseConsumers/BinaryOperatorConsumer.cl b/src/StringConsumer/BaseConsumers/BinaryOperatorConsumer.cl new file mode 100644 index 0000000..8e7288c --- /dev/null +++ b/src/StringConsumer/BaseConsumers/BinaryOperatorConsumer.cl @@ -0,0 +1,18 @@ +class BinaryOperatorConsumer inherits IWordsConsumer { + init() : IStringConsumer {{ + matched_words <- matched_words + .push("+") + .push("-") + .push("*") + .push("/") + .push("<") + .push("<=") + .push("=") + ; + self; + }}; + + token() : IToken { + new BinaryOperatorToken + }; +}; |
