On Thu, Feb 10, 2011 at 6:08 PM, Roohul <roohu...@yahoo.com> wrote:

> Hi,
>
> I am working on a grammar which have some variables ending with In or Out
> which is treated as the connector between two components. I do not know how
> to handle this.
>
> For example:
> real abcIn
> real abcOut
>
> these are treated as connectors. while abcI or abcOu will be treated as
> normal variables.
>

You could handle this on a "lexer level" like this:

REAL
  :  'real'
  ;

CONNECTOR
  :  Alpha+ ('In' | 'Out')
  ;

VARIABLE
  :  Alpha+
  ;

fragment
Alpha
  :  'a'..'z'
  |  'A'..'Z'
  ;


(the order of the rules is important here!)

Regards,

Bart.

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to