From 26fa0559b0689a4647c38a2275c5880148248718 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 1 Nov 2025 18:13:33 +0200 Subject: feat(src/StringConsumer): Add higher order consumers, integer, binary operation and if keywords consumers 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. --- .../BaseConsumers/BinaryOperatorConsumer.cl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/StringConsumer/BaseConsumers/BinaryOperatorConsumer.cl (limited to 'src/StringConsumer/BaseConsumers/BinaryOperatorConsumer.cl') 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 + }; +}; -- cgit v1.3.1-25-gf783