Summary Files Commits Branches @commit @diff @stats
path: root / src / StringConsumer / BaseConsumers / IntegerConsumer.cl
diff options
context:
space:
mode:
Commit26fa0559b0689a4647c38a2275c5880148248718 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-11-01 18:13:33 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-11-01 18:13:33 +0200
Filesc6e3ad8bcb2a873607bc9d619f5cee22185f1765 /src/StringConsumer/BaseConsumers/IntegerConsumer.cl
cool-self-hosted-main.tar
cool-self-hosted-main.tar.gz
cool-self-hosted-main.zip
Parentbeccf376ecbcc3819cc0d102b3635b6e5f39fa9e (diff)
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, 21 insertions, 0 deletions
-rw-r--r--src/StringConsumer/BaseConsumers/IntegerConsumer.cl21
diff --git a/src/StringConsumer/BaseConsumers/IntegerConsumer.cl b/src/StringConsumer/BaseConsumers/IntegerConsumer.cl
new file mode 100644
index 0000000..5b4cd82
--- /dev/null
+++ b/src/StringConsumer/BaseConsumers/IntegerConsumer.cl
@@ -0,0 +1,21 @@
+class IntegerConsumer inherits IWordsConsumer {
+ init() : IStringConsumer {{
+ matched_words <- matched_words
+ .push("0")
+ .push("1")
+ .push("2")
+ .push("3")
+ .push("4")
+ .push("5")
+ .push("6")
+ .push("7")
+ .push("8")
+ .push("9")
+ ;
+ self;
+ }};
+
+ token() : IToken {
+ new IntegerToken
+ };
+};