Summary Files Commits Branches @commit @diff @stats
path: root / src / StringConsumer / WhitespaceConsumer.cl
diff options
context:
space:
mode:
Commitb43c94ca62a747f2f9fb222cdf887c041dd544bb (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-11-01 16:28:08 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-11-01 16:28:08 +0200
Files43e0ea846844257cf46055e68cc2661056b05965 /src/StringConsumer/WhitespaceConsumer.cl
cool-self-hosted-b43c94ca62a747f2f9fb222cdf887c041dd544bb.tar
cool-self-hosted-b43c94ca62a747f2f9fb222cdf887c041dd544bb.tar.gz
cool-self-hosted-b43c94ca62a747f2f9fb222cdf887c041dd544bb.zip
Parent0830615386f036acc55a72b2548efb65526c761f (diff)
feat!: Add basic lexer components
1 files changed, 15 insertions, 0 deletions
-rw-r--r--src/StringConsumer/WhitespaceConsumer.cl15
diff --git a/src/StringConsumer/WhitespaceConsumer.cl b/src/StringConsumer/WhitespaceConsumer.cl
new file mode 100644
index 0000000..4c0b8b5
--- /dev/null
+++ b/src/StringConsumer/WhitespaceConsumer.cl
@@ -0,0 +1,15 @@
+class WhitespaceConsumer inherits IStringConsumer {
+ consume(s: String) : Int {{
+ consumed_length <- 0;
+ while or(s.substr(consumed_length, 1) = " ",
+ s.substr(consumed_length, 1) = "\t")
+ loop
+ consumed_length <- consumed_length + 1
+ pool;
+ consumed_length;
+ }};
+
+ token() : IToken {
+ new WhitespaceToken
+ };
+};