[antlr-interest] Antlr 2.7.2a2 and NetBeans

Robert Enyedi renyedi at yahoo.com
Fri Mar 15 00:53:03 PST 2002


Hi, Sinan

Do you have a Netbeans module for Antlr 2.7.1 already built?

If so, could you tell me please where I can find it?

Robert

----- Original Message -----
From: "Sinan" <sinan.karasu at boeing.com>
To: <antlr-interest at yahoogroups.com>
Sent: Wednesday, March 13, 2002 7:47 PM
Subject: [antlr-interest] Antlr 2.7.2a2 and NetBeans


>
>
> I am currently trying to revamp the antlr module in netbeans.
>
> What they have done esentially is take antlr.g and modify it to
> suit their prupose. Looking thru it it appears that what is really
> needed is a simple grammar inheritance. So here is a modest proposal
> for a simple way to do that.
>
> The following code snippet ( other than the ignored bodies for
> a couple of methods) shgould be the complete .g file for
> antlreditor.g
>
> /// ---begin------------
> header {
> /*
>  * ............bunch of netbeans comments
>  */
> package org.netbeans.modules.antlr.editor.g;
> }
>
>
> class ANTLREditorParser extends ANTLRParser;
>
>
> {
> SecondaryFileHandler behavior;
>
> public void reportError(String s) {
> behaviour.reportError(s);
> }
>
> public ANTLRParser(
> TokenBuffer tokenBuf,
> SecondaryFileHandler behavior_
> ) {
> super(tokenBuf, 1);
> tokenNames = _tokenNames;
> behavior = behavior_;
> }
>
> public static void dump (PrintStream out, SecondaryFileHandler
> behavior)
> {
> // some code here...
> }
>
> public static void scan (String filename)
> {
> // some more code here.....
> }
>
> public static void main (String[] args)
> {
> // some some more more code here......
> }
> }
>
> // ---end---------
>
> However looking thru antlr.g in 2.7.2a2
>
>
> The following lines cause a little grief ( who wrote this stuff
> anyway?).
>
> Specifically the problems re that the messages should be directed to the
> editor infrastructure in netbeans. I can do that by overriding
> reportError
> method, and I can modify the lines that talks to antlrTool.error(),
> antlrTool.warning(). However. If theselines were changed to call
>
> error() , and warning() , then I can override them without any
> modification
> to the antlr. g...
>
> Ric, Ter, any comments???
>
> Sinan
>
>
> // ----------problematic lines------------
> // reportError("line "+ex.line+": JAVADOC comments may only prefix
> rules and grammars");
> antlrTool.error("JAVADOC comments may only prefix rules and
> grammars", getFilename(), ex.getLine(), ex.getColumn());
> ---------
> antlrTool.error(ex.getMessage(), getFilename(), ex.getLine(),
> ex.getColumn());
> // reportError("rule classDef trapped:\n"+ex.toString());
> antlrTool.error(ex.getMessage(), getFilename(), ex.getLine(),
> ex.getColumn());
> // reportError("rule classDef trapped:\n"+ex.toString());
> ----------
> antlrTool.warning("did you forget to terminate previous rule?",
> getFilename(), label.getLine(), label.getColumn());
>
>
> ----------
> antlrTool.error("Malformed range line ", getFilename(), c1.getLine(),
> c1.getColumn());
>
> ----------
>   antlrTool.warning("use 'class X extends Parser'", getFilename(),
> idTok.getLine(), idTok.getColumn());
> // System.out.println("warning: line " +
> // idTok.getLine() + ": use 'class X extends Parser'");
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list