[antlr-interest] charScanner panic.
Bharath Sundararaman
Bharath.Sundararaman at starthis.com
Fri Apr 29 10:31:14 PDT 2005
Hi all,
I have an application that passes code to my ANTLR compiler. Recently,
when the code is passed, the CharScanner's panic() method is called
which causes a system exit. I over-rode the panic() method and prevented
the system from exiting which led to "can't find AST node type:
packageName.ASTName" exception.
public void setASTNodeClass(String t) {
theASTNodeType = t;
try {
theASTNodeTypeClass = Class.forName(t); // get class def
}
catch (Exception e) {
// either class not found,
// class is interface/abstract, or
// class or initializer is not accessible.
error("Can't find/access AST Node type" + t);
}
}
This method indicates to me that it's a class loader issue related to
Eclipse IDE and the way it deals with plugins. Has anybody faced this
problem before while using antlr.jar with their Eclipse plug-in? I know
one solution is to add antlr.jar to your system class path so that
parent CL will find it before the Eclipse CL does but I don't want to
follow that approach, even if it will work.
Any ideas?
________________________________
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Ed Delaney
Sent: Friday, April 29, 2005 8:51 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] PLSQLGrammar.g - antlr
Hey Michiel,
Are you still working on your PL/Sql project?
I finally got the PL/Sql grammar to generate and compile. I've created a
simple main to test it, but I'm not sure what is happening. Have you
made any more progress?
Remember, my experience with Java is pretty basic, though I know a
zillion other languages.
All I want to do is feed it some Plsql and see if it parses or if it
detects an error:
import java.io.DataInputStream;
class main {
public static void main(String[] args) {
try {
PLSqlLexer lexer = new PLSqlLexer(new
DataInputStream(System.in));
PLSqlParser parser = new PLSqlParser(lexer);
parser.start_rule();
} catch(Exception e) {
System.err.println("exception: "+e);
}
}
}
later on I want to generate an AST that I can start working with. But
as it stands, shouldn't this work as a syntax checker?
My test input is:
BEGIN
null;
END;
And when it runs I get
java main < t.sql
line 1:1: expecting EOF, found 'BEGIN'
Thanks,
Ed
---------------------------------------------------
Ed Delaney
SunGard SCT
Advisory Software Engineer
Phone Number (Office): 765-939-0533
Time Zone: US Indiana
edelaney at sungardsct.com
www.sungardsct.com
Leadership - Choices - Excellence
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20050429/a460e212/attachment-0001.html
More information about the antlr-interest
mailing list