Le 21 avr. 09 à 22:17, Akim Demaille a écrit :
+# Period are genuine letters, they can start identifiers. Dashes
+# and digits can't.
+AT_DATA_GRAMMAR([input.y],
+[[%token .good
+%token -wrong
+%token 1nv4l1d
+%%
+start: .good
+]])
+AT_BISON_CHECK([-o input.c input.y], [1], [],
+[[input.y:10.8: invalid character: `-'
+input.y:11.8: syntax error, unexpected integer, expecting char or
identifier or <tag>
+]])
The asymmetry between dashes and period is not something I am deeply
attached to. POSIX says "Names are of arbitrary length, made up of
letters, periods (.), underscores (_) and non-initial digits." so I'm
fine with just adding `-' to the {letter}. Yet the error messages
should probably be improved. Maybe catching "words" starting with
dashes and digits, and complaining about them, in order to have
invalid identifier: -wrong
invalid identifier: 1nv4l1d
instead of what we currently have.