[il-antlr-interest: 28429] [antlr-interest] Adding custom functions to the parser in a C target

2010-03-30 Thread Andi Clemens
Hi, I want to use the PLSQL grammar from antlr.org with some modifications to detect table names in statements. I want to check, whenever I hit the "table_spec" rule, if this table name is in a whitelist and perform further actions. I have a problem now: How can I add global variables to the p

[il-antlr-interest: 28428] [antlr-interest] Bug in Python target while using multiple lexers + island grammar

2010-03-30 Thread Bob Adolf
I probably should've posted this a while ago, but I didn't get around to it. There is a bug in the CommonTokenStream.getTokens() function in the Python target version 3.1.2 (it looks like there is a 3.2 version in the bug database, but 3.1.2 is the released python runtime and it shouldn't

[il-antlr-interest: 28427] Re: [antlr-interest] FailedPredicateException leads to infinite loop - bug in the Lexer?

2010-03-30 Thread Cliff Hudson
It's certainly possible that I have a bug in my lexer, since it has been *ages* since I did any language programming. I posted on here a repro scenario based on the sample XML lexer/parser provided on the ANTLR website. The issue is that with that parser, the following input causes an infinite lo

[il-antlr-interest: 28426] Re: [antlr-interest] FailedPredicateException leads to infinite loop - bug in the Lexer?

2010-03-30 Thread Jim Idle
Actually, I did not dispute that the hang was a bug, but stated that it was really somewhat irrelevant because the bug is in your predicate specifications. Lexers should not really be throwing exceptions but should be coded to deal with any input in a controlled manner. Your code was looked at,

[il-antlr-interest: 28425] Re: [antlr-interest] expressing URL in ANTLR grammar

2010-03-30 Thread Ketan Maheshwari
Bart, Thanks for your suggestion. I think its a really involved task to define URL per the specification. For the timebeing I will do with my lightweight spec :) Ron Thanks for the insight. Indeed, it would be interesting to dig into java's URL class spec to get some info on how they manage it. c

[il-antlr-interest: 28424] Re: [antlr-interest] FailedPredicateException leads to infinite loop - bug in the Lexer?

2010-03-30 Thread Ron Hunter-Duvar
The message title was: "Antlr Bug: Failed semantic predicate in lexer triggers endless loop" Basically, the bug is in the nextToken() method in Antlr's Lexer class. If a NoViableAlt exception is thrown, the method calls the recover method, which consumes one character before trying again. Bu

[il-antlr-interest: 28423] Re: [antlr-interest] FailedPredicateException leads to infinite loop - bug in the Lexer?

2010-03-30 Thread Cliff Hudson
I've been all over the archives, but perhaps my search terms were inadequate. I'll look again with that date in mind. Thanks. On Tue, Mar 30, 2010 at 8:11 AM, Ron Hunter-Duvar < ron.hunter-du...@oracle.com> wrote: > Hi Cliff, > > I reported this same problem on February 10 on this list. It's an

[il-antlr-interest: 28422] [antlr-interest] Partial parsing

2010-03-30 Thread Anton Bychkov
Hi. I'm trying to implement partial SQL parsing in my application with the help of ANTLR. It is hard to write proper grammar for some SQL expressions, so I want to leave them as a plain text. Consider the following SQL statement: SELECT name1, func(first expression), (second expression) as 'foo'

[il-antlr-interest: 28421] Re: [antlr-interest] token name from token type

2010-03-30 Thread Ron Hunter-Duvar
I ran into the same problem. I may be wrong, but it seemed like functionality that was intended to be implemented in Antlr but was never finished, at least in the Java run-time. I just hacked together a method that uses introspection to pick out all the token type declarations ("public static f

[il-antlr-interest: 28420] [antlr-interest] token name from token type

2010-03-30 Thread Ketan Maheshwari
Hello (Again) I am playing with the CommonTree object. It has a method called getType() that gives an int for token. How do I get the actual token name from that int? I saw in the archives that this question is asked but could not really find the method String getTokenName(int) as answered in tha

[il-antlr-interest: 28419] Re: [antlr-interest] FailedPredicateException leads to infinite loop - bug in the Lexer?

2010-03-30 Thread Ron Hunter-Duvar
Hi Cliff, I reported this same problem on February 10 on this list. It's an Antlr bug, and my emails on it had the work around (which requires you to implement a custom superclass if you haven't already). If you search the list archives you should be able to find it. Ron Cliff Hudson wrote:

[il-antlr-interest: 28417] Re: [antlr-interest] expressing URL in ANTLR grammar

2010-03-30 Thread Bart Kiers
On Tue, Mar 30, 2010 at 2:18 PM, Ketan Maheshwari < ketancmaheshw...@gmail.com> wrote: > ... > > Actually this is my lame attempt to ask if someone can help me express URL > in ANTLR grammar. :-) > > I'd start by reading the specs of a URL: http://www.w3.org/Addressing/URL/url-spec.txt , and then

[il-antlr-interest: 28416] [antlr-interest] expressing URL in ANTLR grammar

2010-03-30 Thread Ketan Maheshwari
Hello Friends Wondering if there is a repository for expressing standard things like URL to express in antlr grammar. Actually this is my lame attempt to ask if someone can help me express URL in ANTLR grammar. :-) Many Thanks Ketan List: http://www.antlr.org/mailman/listinfo/antlr-interest Uns

[il-antlr-interest: 28415] [antlr-interest] please help me

2010-03-30 Thread Gouasmi Thouraya
Hello Please sir In my project, I have to develop a tool which makes the transformation of a specification in a language Z towards a specification in another language CSP-Z, I already have defined textuellement of the rules for this transformation. I try to find a tool which takes in input gr

[il-antlr-interest: 28414] [antlr-interest] C example error

2010-03-30 Thread Brian Catlin
I tried to build the PolyDiff example from Examples-v3, using ANTLR-3.1-2009-06-28 and libantlr3c-3.2 in Visual Studio 2008. The output from the build: 1>-- Rebuild All started: Project: polydiff, Configuration: Debug Win32 -- 1>Deleting intermediate and output files for project 'poly