[antlr-interest] CommonTreeNodeStream.size() get "streams are ofunknown size" exception

Shaoting Cai caishaoting at gmail.com
Mon Mar 23 16:17:18 PDT 2009


It works.  great!
Thanks a lot, Sam :D

Shaoting


On Mon, Mar 23, 2009 at 4:06 PM, Sam Harwell
<sharwell at pixelminegames.com> wrote:
> You need to switch to use the new BufferedTreeNodeStream class instead.
> The new CommonTreeNodeStream is unbuffered, so it can't know the size.
>
> Sam
>
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Shaoting Cai
> Sent: Monday, March 23, 2009 5:52 PM
> To: ANTLR Interest
> Subject: [antlr-interest] CommonTreeNodeStream.size() get "streams are
> ofunknown size" exception
>
> Hi,
>
> I was using CommonTreeNodeStream.size() and it worked in antlr-3.1.1.
> After I switch to 3.1.3, I get "streams are of unknown size" runtime
> exception.
> Is there any changes in the CommonTreeNodeStream class?
>
> here's how I create the CommonTreeNodeStream:
>
>        ....
>        this.ast = (CommonTree) r.getTree();
>        System.out.println(ast.toStringTree());  // <-- i can see the
> tree string
>        CommonTreeNodeStream nodes = new CommonTreeNodeStream(ast);
>        System.out.println(nodes.size());  // <-- get exception here
>        ....
>
> Thanks in advance for any clue :)
>
> Shaoting
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list