Summary Files Commits Branches @commit @diff @stats
path: root / src / StringConsumer / IWordConsumer.cl
diff options
context:
space:
mode:
1 files changed, 13 insertions, 0 deletions
-rw-r--r--src/StringConsumer/IWordConsumer.cl13
diff --git a/src/StringConsumer/IWordConsumer.cl b/src/StringConsumer/IWordConsumer.cl
new file mode 100644
index 0000000..a809cd2
--- /dev/null
+++ b/src/StringConsumer/IWordConsumer.cl
@@ -0,0 +1,13 @@
+class IWordConsumer inherits IStringConsumer {
+ word: String;
+
+ consume(s: String) : Int {{
+ consumed_length <- 0;
+ if s.substr(0, word.length()) = word
+ then
+ consumed_length <- word.length()
+ else
+ consumed_length
+ fi;
+ }};
+};