[antlr-interest] Help with a production rule

Chuck Siska chuck.siska at nb.conexant.com
Sat Feb 9 08:17:26 PST 2002


alex --

without massive lookahead (and its attendant slowdown) you'll
want to register the starting symbol tuples in a symbol table
and then give an error when you can finally determine that the 
corresponding ending tuple is missing (e.g., at the end of 
input/file, after 500 lines, at the end of some key outer
symbol tuple).

-- chuck

alexworden wrote:
> 
> Hi,
> 
> Can anyone help me. I'm trying to write an ANTLR rule that will match
> something like
> 
> <x1:y2> blah blah blah </x2:y2>
> 
> where x1==x2 and y1==y2 but I have not prior knowledge what these
> tokens might be. e.g.
> 
> <foo:bar>
>  some other stuff
> </foo:bar>
> 
> I've tried something like:
> 
>   : "<" x:WORD ":" y:WORD ">" MATCH_ALL "<" x.getText() ":" y.getText
> () ">"
> 
> but ANTLR doesn't like it. Does anyone know how to do this please?
> 
> Thanks,
> 
> Alex

-- 
                                           |\_/\_.-'""``:-._       
What is life without looking for           . . `; -._      )-;-,_`)
the next cute little bug to play with?     v_,-    _  ),(,.\  ``-' 
                                          _.- _.,-_/ /  ((.'       
-- chuck.siska at conexant.com  `<}:..     ((,.-'   ((,/

 

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



More information about the antlr-interest mailing list