[antlr-interest] !, for non contributing elements of the rule's text.

César López Natarén cesar at ciencias.unam.mx
Sun Mar 14 15:35:33 PST 2004


Hello:

I found that the '!' operator helps me for indicating that certain text
matched on a do not have  to be included on the rule's text.

It worked great on the following rule:

'\''! (~('\'' | '\\' | '\u000A' | '\u000D' | '\u2028' | '\u2029'))*'\''!

It does not include the ' on the rule's text, but when I tried to
apllied the same pattern to the double-quote literal:

'"'! (~('"' | '\\' | '\u000A' | '\u000D' | '\u2028' | '\u2029'))* '"'!

Antlr generate the lexer, but when I tried to compile the source code
(*NOTE: I'm using the C# generator), I get this errors:


JScriptLexer.cs(789) error CS0103: The name `_saveIndex' could not be
found in `Microsoft.JScript.JScriptLexer'

I'm not sending the full lexer file, but if it's needed just let know.

The full rule is:

STRING_LITERAL
	: '"'! (~('"' | '\\' | '\u000A' | '\u000D' | '\u2028' | '\u2029'))*
'"'! 
	|
	  '\''! (~('\'' | '\\' | '\u000A' | '\u000D' | '\u2028' | '\u2029'))*
'\''!
    ;


Thanks in advance.

-- 
César


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list