Summary Files Commits Branches @commit @diff @stats
path: root / src / StringConsumer / HigherOrderConsumers / ExpressionConsumer.cl
blob: 592611edeb04c8ecad20d4795617f240e8dabc60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class ExpressionConsumer inherits IHigherOrderConsumer {
	integerc: IStringConsumer <- (new IntegerConsumer).init();
	binaryopc: IStringConsumer <- (new BinaryOperatorConsumer).init();

	consume(s: String) : Int {{
		consumed_length <- 0;
		if did(integerc.consume(s))
		then
			token <- integerc.token()
		else if did(binaryopc.consume(s))
		then
			token <- binaryopc.token()
		else
			void
		fi
		fi;
		consumed_length;
	}};
};