[antlr-interest] ANTLR 2 lexer rule confusion

Alex Shneyderman a.shneyderman at gmail.com
Wed Aug 15 05:46:32 PDT 2007


I am a bit slow today but could anyone explain what this rule is matching?

protected
STRING_CTOR_END[boolean tripleQuote]
    :
        (
            options {  greedy = true;  }:
              STRING_CH
            | ESC
            | '\''
            | STRING_NL
            | ('"' (~'"' | '"' ~'"')) => {tripleQuote}? '"'
        )*
        (
              ( { !tripleQuote }? "\""! | {  tripleQuote }? "\"\"\""! )
           |  '$'
        )
    ;

I am struggling to understand this construct:

| ('"' (~'"' | '"' ~'"')) => {tripleQuote}? '"'

Any ideas?


-- 
Thanks,
Alex.


More information about the antlr-interest mailing list