Le 16 juin 06 à 19:54, Paul Eggert a écrit :
Akim Demaille <[EMAIL PROTECTED]> writes:
The other possibility, the one I prefer, is to make it syntactic but
more restricted: accept a single optional ID in the grammar (then of
course we have no problems with comments).
OK, thanks, your arguments make sense, and you talked me into it.
One detail, though: what kind of identifier? Should we allow '::' for
the sake of C++ namespace usage? I don't much use C++ so I'm not a
good judge here. (It's hard to Google for usages of this form, I'm
afraid.)
I assume we don't want to allow \unnn and \Unnnnnnnn or multibyte
letters and digits (valid in C identifiers), since it'd be hard to
verify which combinations are valid.
Yacc identifiers also allow '.'; should we allow that? Probably not.
(Don't you just love this can of worms? :-)
:)
It's just that I don't think we should worry that much for a careless
user. If she uses '.', or even '*' (sometimes I wish we added *, +, and
? in the char set), then it's up to her. After all, you raised ::
for C++, you could have kept . for other languages.
If we want to set the user really free, then let's extend the grammar
with more than just ID, for instance a STRING, or even BRACED_CODE.
%union {my_weird::\u1234nion} { int val; };