Sam, while trying build my pre-processor with a mixed parser/lexer I ran
across what I think might be a bug. I reduced the repro below. I expected
the program below to accept "/**/ " but instead fails because the lexer
prediction enters PP_SKIPPED_CHARACTERS. That rule has a gated semantic
predicate which is always false. I expected a lexer rule with a gated
semantic predicate which is always false to never be matched. If I comment
out the PP_SKIPPED_CHARACTERS rule then it does match "/**/ ". So the
inclusion of that rule is cause the problem. Let me know if you think this
is a bug and if you can repro.

Thanks,
Chris


grammar Bug;

options {
   language=CSharp3;
   output=AST;
}

public start
  : DELIMITED_COMMENT !EOF
  ;

PP_SKIPPED_CHARACTERS
  : { false }? => ~(F_NEW_LINE_CHARACTER | F_PP_POUND_SIGN)
F_INPUT_CHARACTER*
  ;

DELIMITED_COMMENT
  : { true }? => '/*' .* '*/'
  ;

WHITESPACE
  : F_WHITESPACE {skip();}
  ;

fragment F_WHITESPACE
  : (' ' | '\t' | '\v' | '\f')+
  ;

fragment F_NEW_LINE_CHARACTER
  : '\r'
  | '\n'
  ;

fragment F_PP_POUND_SIGN
  : '#'
  ;

fragment F_INPUT_CHARACTER
  : ~F_NEW_LINE_CHARACTER
  ;

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to