[prev in list] [next in list] [prev in thread] [next in thread] 

List:       antlr-dev
Subject:    [antlr-dev] init, scopes, and backtracking
From:       jimi () temporal-wave ! com (Jim Idle)
Date:       2007-07-25 4:42:43
Message-ID: 051466DAA0D608439E196797955018D76F1F () wavemachine ! temporal-wave ! com
[Download RAW message or body]

Yes - I have it like that too, it is just a little more tricky at the
exit rule because I have finally clause, so I must generate:

{
  Pop stack;
  Return;
}

SO, that's all I needed to know really - not so much what it does,
because do that too (again ;-), but just that this is in fact what we
want it do :-)

Jim

> -----Original Message-----
> From: antlr-dev-bounces at antlr.org [mailto:antlr-dev-bounces at antlr.org]
> On Behalf Of Terence Parr
> Sent: Tuesday, July 24, 2007 6:08 PM
> To: ANTLR Dev
> Subject: Re: [antlr-dev] init, scopes, and backtracking
> 
> 
> On Jul 24, 2007, at 5:34 PM, Jim Idle wrote:
> 
> > Well, I was doing the push, but not the pop ;-). Someone reported
> this
> > and I moved the scope push behind the memoizing gate. So, I do do
the
> > push and pop during backtracking, but I guess I was more
specifically
> > talking about memoizing.
> 
> The memoize should only happen when it is backtracking...is that how
> you have it?  I have:
> 
>      public final void a() throws RecognitionException {
>          a_stack.push(new a_scope());
>          int a_StartIndex = input.index(); // added for memo
>           ((a_scope)a_stack.peek()).i = 1;
>          try {
>              if ( backtracking>0 && alreadyParsedRule(input, 1) )
> { return ; } // added for memo
> 	...
> 
> Ter
> 
> _______________________________________________
> antlr-dev mailing list
> antlr-dev at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/antlr-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic