symbolstartpos.mly 331 Bytes
Newer Older
1
%token A B C
2
3
%start<unit> main
%%
4
5
6
7
8
9
10
11
12
(* Case: token in front. *)
main: A B hop { $symbolstartpos, $symbolstartofs }
(* Case: non-nullable symbol in front. *)
hop: bar A B { $symbolstartpos }
(* Case: nullable symbol in front. *)
bar: foo? B { $symbolstartpos }
foo: C nothing {}
(* Case: epsilon rule. *)
nothing: { $symbolstartpos }