1 2 3 4 5 6 7 8 9 10 11 12 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; }}; };