[antlr-interest] new line character rule

Alexey Demakov demakov at ispras.ru
Wed Nov 24 08:43:12 PST 2004


What exactly fails?

I use the following rule

protected
NL : (   {LA(2) == '\n'}? '\r' '\n'
       | '\r'
       | '\n'
     )
     { newline(); }
   ;

WS : ( options { greedy = true; } :
          ' '
       | '\t'
       | '\f'
       | NL
     )+
   ;

  ----- Original Message ----- 
  From: dsfsdf fdsfdsf 
  To: antlr-interest at yahoogroups.com 
  Sent: Wednesday, November 24, 2004 7:30 PM
  Subject: [antlr-interest] new line character rule


  Hi 
  I have a white space rule
  WS:( ' ' | '\t' | '\r' | '\n' ) ;
  I want to create a seperate rule for the new line character 
  so i wrote 
  NL: ( '\n' | '\r'); and took out the \n and \r from the WS rule
  I than hide these tokens in a filter and parse and do my
  transformations.
  However my genertaion fails.
  Is there another way of writing a new line rule?
  thanks 
  ed.


------------------------------------------------------------------------------
  ALL-NEW Yahoo! Messenger - all new features - even more fun! 

------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/
      
    b.. To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20041124/3a200566/attachment.html


More information about the antlr-interest mailing list