[antlr-interest] charScanner panic.

Scott Stanchfield scott at javadude.com
Fri Apr 29 19:02:34 PDT 2005


When using antlr (or another 3rd party jar) in an eclipse plugin, you meed
to make sure that the jar is included in the runtime definition of the
plugin.xml. All you need to do is

1.	

	Add the jar in a dir in your plugin
2.	

	Edit your plugin.xml
3.	

	On the runtime tab pick "new" for a lib, and choose the jar you want
to add.

Alternatively, you could add a dependency on the org.antlr plugin that is
distributed with the antlr-eclipse plugin.
 
Later,
-- Scott
 


  _____  

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Bharath Sundararaman
Sent: Friday, April 29, 2005 1:31 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] charScanner panic.



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/7429c80b/attachment.html


More information about the antlr-interest mailing list