[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
double quotes in regular expressions
I'm new to SableCC, so these are likely to be stupid questions. Sorry.
I'm running 2.16.2 (is that the latest?), and I have the March 1998
thesis as my main documentation.
In the thesis, section 4.3, the BNF for reg_exp shows that 'string'
(without the quotes) can be a regular expression, but 'string'
is not defined anywhere. I assume it means the usual double-quoted
character sequence, as shown in example 4.6, which begins:
do = "DO"
However, when I construct a grammar containing a double-quoted string,
it is rejected with the message:
-- Generating parser for cpp.grammar in C:\mydocs
org.sablecc.sablecc.lexer.LexerException: [40,8] Unknown token: "
If this feature is not working or I have simply misunderstood it,
what is the workaround? Actually, that brings up my second question:
do tokens defined as "skips" automatically terminate other tokens?
If yes, then the sequence '/' '/' as shown in example 4.4
(line_comment) would be matched by the sequence '/' <space> '/'
(assuming spaces are skipped), and that is not generally construed
as a valid line comment, and should be reported as an error. If
double quotes are not valid in token definitions, then how are
consecutive characters without intervening skips to be defined?
Finally, the Web site says the lookahead feature is not working.
Is that going to be fixed soon? The need for a well-behaved lookahead
is what drove me away from JavaCC. If and when lookahead is working,
will it be oblivious to skip characters preceding the "/"?