[il-antlr-interest: 28430] [antlr-interest] Empty complement set?

2010-03-31 Thread Anton Bychkov
Hi.

The following grammar does not generate target code.
It says error(139): skipper.g: set complement is empty.

grammar skipper;

options
{
language = C;
}

skipper 
@init {
int braceCount = 1;
}
: (
'('
{
braceCount ++;
}
| ')'
{
braceCount --;
if(braceCount == 0)
{
LTOKEN = EOF_TOKEN;
}
}
| ~('('|')')
) *
;

What's wrong with it?

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28433] Re: [antlr-interest] Empty complement set?

2010-03-31 Thread Bart Kiers
On Wed, Mar 31, 2010 at 11:47 AM, Anton Bychkov bychkov.an...@gmail.comwrote:

 ...
 There is also a strange thing in rule view, it looks like antlr does
 not see LParen and RParen in twiddle operator.
 I attached screenshot with it.


Ah, I see. There are no other tokens than '(' and ')' defined, so
~(LParen|RParen) is wrong. Try adding a fall through DOT in your lexer
grammar:

skipper
   @init {
   int braceCount = 1;
   }
   : (
   LParen
   {
   braceCount ++;
   }
   | RParen
   {
   braceCount --;
   if(braceCount == 0)
   {
   LTOKEN = EOF_TOKEN;
   }
   }
   | Other
   ) *
   ;

LParen : '(' ;
RParen : ')' ;
Other  :  .  ;

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28434] [antlr-interest] Fwd: Empty complement set?

2010-03-31 Thread Bart Kiers
-- Forwarded message --
From: Bart Kiers bki...@gmail.com
Date: Wed, Mar 31, 2010 at 12:01 PM
Subject: Re: [antlr-interest] Empty complement set?
To: antlr-interest@antlr.org




On Wed, Mar 31, 2010 at 11:47 AM, Anton Bychkov bychkov.an...@gmail.comwrote:

 ...

 There is also a strange thing in rule view, it looks like antlr does
 not see LParen and RParen in twiddle operator.
 I attached screenshot with it.


Ah, I see. There are no other tokens than '(' and ')' defined, so
~(LParen|RParen) is wrong. Try adding a fall through DOT in your lexer
grammar:

skipper
   @init {
   int braceCount = 1;
   }
   : (
   LParen
   {
   braceCount ++;
   }
   | RParen
   {
   braceCount --;
   if(braceCount == 0)
   {
   LTOKEN = EOF_TOKEN;
   }
   }
   | Other
   ) *
   ;

LParen : '(' ;
RParen : ')' ;
Other  :  .  ;

Or like this:

LParen : '(';
RParen : ')';
Other  : ~(LParen | RParen);

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28435] Re: [antlr-interest] Fwd: Empty complement set?

2010-03-31 Thread Anton Bychkov
 Or like this:

 LParen : '(';
 RParen : ')';
 Other  : ~(LParen | RParen);


Thank you, that worked.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28436] [antlr-interest] ANTLR crash with C# target and rewrite rules

2010-03-31 Thread Chrobot, Stefan
Hello!

 

I'm using the C# target of ANTLR and have some problems with it.

I'm rewriting the input to the output, but on my way I need to collect
some information about the input (to create StringTemplates on the fly).
I want the $id.text to return the rewritten text of the rule. And I
suppose this should happen, but the runtime crashes instead.

 

What am I doing wrong?

 

 

The grammar:

 

grammar Test;

 

options {

language = CSharp2;

output = template;

rewrite = true;

}

 

start_rule

:   id+  {
System.Console.WriteLine($id.text); } // I need to access the text here

;

 

id:   ID- { new
StringTemplate(id) }

;

 

ID  :('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*

;

 

WS  :   ( ' ' | '\t' | '\r' | '\n' ) {$channel=HIDDEN;}

;

 

The driver:

 

using System;

using Antlr.Runtime;

 

namespace RewriteTest

{

public class Program

{

public static void Main(string[] args)

{

string input = ab cd ef gh;



var stream = new ANTLRStringStream(input);

var lexer = new TestLexer(stream);

 

var tokenStream = new TokenRewriteStream(lexer);

var parser = new TestParser(tokenStream);

 

parser.start_rule();

 

 
Console.WriteLine(--);

 

Console.WriteLine(tokenStream.ToOriginalString());

Console.WriteLine(tokenStream.ToString());

}

}

}

 

The result:

 

Unhandled Exception: System.InvalidCastException: Unable to cast object
of type 'ReplaceOp' to type 'InsertBeforeOp'.

   at Antlr.Runtime.TokenRewriteStream.ToString(String programName,
Int32 start,  Int32 end)

   at Antlr.Runtime.TokenRewriteStream.ToString(Int32 start, Int32 end)

   at Antlr.Runtime.CommonTokenStream.ToString(IToken start, IToken
stop)

   at TestParser.start_rule() in C:\Tests\RewriteTest\TestParser.cs:line
147

   at RewriteTest.Program.Main(String[] args) in
C:\Tests\RewriteTest\Program.cs:line 18


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28438] Re: [antlr-interest] Empty complement set?

2010-03-31 Thread Jim Idle
You cannot use set complements in parser rules. That is for lexer rules only. 
In the next release, ANTLR will tell you about this. But don't use 'literals' 
while you are learning as it is too easy to get confused as to what they mean 
in terms of lexer vs parser.

Jim

 -Original Message-
 From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
 boun...@antlr.org] On Behalf Of Anton Bychkov
 Sent: Wednesday, March 31, 2010 2:21 AM
 To: antlr-interest@antlr.org
 Subject: [antlr-interest] Empty complement set?
 
 Hi.
 
 The following grammar does not generate target code.
 It says error(139): skipper.g: set complement is empty.
 
 grammar skipper;
 
 options
 {
   language = C;
 }
 
 skipper
   @init {
   int braceCount = 1;
   }
   : (
   '('
   {
   braceCount ++;
   }
   | ')'
   {
   braceCount --;
   if(braceCount == 0)
   {
   LTOKEN = EOF_TOKEN;
   }
   }
   | ~('('|')')
   ) *
   ;
 
 What's wrong with it?
 
 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
 email-address




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



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

2010-03-31 Thread Jim Idle
No it isn't in case you want to encapsulate it elsewhere. However for context 
level elements you want to use the mechanism I established and not hijack super 
really (though super is meant for your own stuff).

So:


@parser::context
{
// A pointer to the blah that we blargle into a gargle
//
pBLAH   papi;
}

@parser::apifuncs
{
ctx-pBLAH = NULL;
}

@parser::includes
{
// Include the BLAH interface specifications, so we know how to call
// an implementation to have it do work for us.
//
#include blah.h

// Create a macro to make references to the BLAH pointer easier
//
#define BLAH CTX-pBLAH
}


Now in your actions you can use:

{
   BLAH-number = 666;
   BLAH-myCall(BLAH, 666);
 
   // And so on...

}


You use the context pointers because 'global' data is exactly what you don't 
want as you instantly destroy the free threading, which is built into the code 
generation and the runtime. Here you get one pBLAH per thread:

psr = MyParserNew(tstream);

if (psr == NULL) ...

// Install a BLAH interface
//
psr-blah   = getBlah();
if  (psr-blah == NULL) ...

if  ((retCode = psr-blah-blahInitialize(psr-blah)) != 0)...


Jim


 -Original Message-
 From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
 boun...@antlr.org] On Behalf Of Christopher L Conway
 Sent: Wednesday, March 31, 2010 7:36 AM
 To: antlr-interest@antlr.org
 Subject: Re: [antlr-interest] Adding custom functions to the parser in
 a C target
 
 Andi,
 
 I think you'll find the void* field super in ANTLR3_PARSER_struct,
 accessible in the grammar via PARSER-super, is a good place to stick
 implementation data. AFAICT, it is never set by the generated code.
 
 -Chris
 
 On Wed, Mar 31, 2010 at 1:51 AM, Andi Clemens andi.clem...@gmx.net
 wrote:
  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 parser?
  I need to give the parser a pointer to the whitelist in memory and
 some other
  variables for detecting valid / invalid table names.
 
  Defining variables in @members doesn't help, I am not able to access
 this from
  outside of the parser code.
  In Java it seems to be much easier, since you have a class where you
 can add
  public members, but in C I have no clue how to do it (yes, I need to
 use C,
  and I never programmed in that language, only in C++ and Python so
 far).
 
  I want to do something like this.
  In the parser rule table_spec, I want to check the table name:
  {
     char result[256];
     strcat(result, s.tree ? s.tree-getText(s.tree)-chars : );
     strcat(result, s.tree ? . : );
     strcat(result, t.tree ? t.tree-getText(t.tree)-chars : );
     isValid = checkForValidTable(result);
  }
 
  isValid and checkForValidTable are defined in @members, but the
 check
  function needs some statement handlers and other stuff coming from
 the
  outside. In the end, I wanted to have something like this in my
 main.cpp:
 
  [...]
  parser-setStmtHandle(some pointer);
  parser-setWhiteListHandle(some pointer);
  parser-sql_statement(parser); // this is the main function I would
 use from
  the PL/SQL grammar file
  bool isValid = parser-isValid();
  [...]
 
 
  Is it possible to do something like that? If not, how can I fix this
 problem?
  I need to get those handles inside of the parser somehow?
  Any ideas?
 
  Andi
 
  List: http://www.antlr.org/mailman/listinfo/antlr-interest
  Unsubscribe: http://www.antlr.org/mailman/options/antlr-
 interest/your-email-address
 
 
 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
 email-address




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28441] Re: [antlr-interest] How to get GUI like tree structure

2010-03-31 Thread Jim Idle
I think you are looking for the wrong thing. You are unlikely to need the parse 
tree in order to operate upon the input. You are almost certainly in need of an 
AST that you build yourself using the ANTLR tree building constructs.

 

Did you search the WIKI:

 

http://www.antlr.org/wiki/pages/viewpage.action?pageId=1760

 

Jim

 

 

From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com] 
Sent: Wednesday, March 31, 2010 7:47 AM
To: Jim Idle
Cc: antlr-interest@antlr.org
Subject: Re: [antlr-interest] How to get GUI like tree structure

 

Hi Jim, Hi All

 

I searched but still am struggling to really get the parsertree object for my 
grammar. 

 

My goal is to get the parser tree object just as being shown in the GUI and put 
its elements in another object that I need to construct based upon the tree.

 

But after a lot of search I still have no clue how do I get the ParserTree 
object with a *hierarchy of rules* and leaf nodes as the actual *tokens* of my 
program!

 

Many thanks for any help with this.

 

Regards

Ketan

 

On Mon, Mar 29, 2010 at 6:30 PM, Jim Idle j...@temporal-wave.com wrote:

Ah. You are asking for the parser tree, not a representation of the AST? Search 
the mailing list for this. Such a tree is not generally useful for doing things 
with (so if you are looking for this information because you want to use it to 
generate code or something, then you are probably looking at your problem 
incorrectly), but it is very useful for debugging the tree.



http://antlr.markmail.org/search/?q=parse+tree





If all you want is information in the nodes, then get the payload of the leaf 
node (usually CommonToken) and ask for it, but that’s what the code you looked 
at is doing.



Jim





From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com]
Sent: Monday, March 29, 2010 9:18 AM
To: Jim Idle
Cc: antlr-interest@antlr.org
Subject: Re: [antlr-interest] How to get GUI like tree structure




Jim



Thanks again for your answer.



1. I checked the DOTTreeGenerator.java code but I do not seem to know how it 
finds all the info about a tree. Also I am confused with its use of both the 
stringtemplates and trees (are'nt they mutually exclusive?).



2. Yes, the toStringTree() method prints the tree but it only gives the leaf 
nodes, that is the program itself. I have no info about which rule a given 
token belongs to.



To be more clear, see the attached snapshot. My question is how can I capture 
this parse tree in a some kind of java data structure and walk through it.



Many Thanks again for all your help.

Ketan



On Mon, Mar 29, 2010 at 5:41 PM, Jim Idle j...@temporal-wave.com wrote:

Look at the code for DOTTreeGenerator.java or use toStringTree() if that gives 
you a good enough representation.

Jim


 -Original Message-
 From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
 boun...@antlr.org] On Behalf Of Ketan Maheshwari
 Sent: Monday, March 29, 2010 7:36 AM
 To: antlr-interest@antlr.org
 Subject: [antlr-interest] How to get GUI like tree structure

 Hello Friends

 I am trying to use the CommonTree generated by the parser of my grammar
 against a test code.

 Using the getChild(index).toString method, I get the tokens well.

 However, I do not know how can I also get a hierarchy of the rule to
 which
 they belong to. Similar to what we get in the ANTLRworks GUI.

 Any clue how can I get a tree such that it shows complete hierarchy of
 the
 grammar and the tokens as leaf nodes only.

 Am I using the correct Data Structure (CommonTree) ?

 Thanks for any clues.

 Regards
 Ketan


 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
 email-address




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address






List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

 




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28442] Re: [antlr-interest] How to get GUI like tree structure

2010-03-31 Thread Ketan Maheshwari
Jim

Thanks for your quick answer. The code shown uses the -debug option to
generate parser and lexer classes, but I have problems with the debug option
that when I use it the parser just hangs and does not go ahead.

Any solution as to generate a ParseTree without using the debug option.

Ketan

On Wed, Mar 31, 2010 at 4:58 PM, Jim Idle j...@temporal-wave.com wrote:

 I think you are looking for the wrong thing. You are unlikely to need the
 parse tree in order to operate upon the input. You are almost certainly in
 need of an AST that you build yourself using the ANTLR tree building
 constructs.



 Did you search the WIKI:



 http://www.antlr.org/wiki/pages/viewpage.action?pageId=1760



 Jim





 From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com]
 Sent: Wednesday, March 31, 2010 7:47 AM
 To: Jim Idle
 Cc: antlr-interest@antlr.org
 Subject: Re: [antlr-interest] How to get GUI like tree structure



 Hi Jim, Hi All



 I searched but still am struggling to really get the parsertree object for
 my grammar.



 My goal is to get the parser tree object just as being shown in the GUI and
 put its elements in another object that I need to construct based upon the
 tree.



 But after a lot of search I still have no clue how do I get the ParserTree
 object with a *hierarchy of rules* and leaf nodes as the actual *tokens* of
 my program!



 Many thanks for any help with this.



 Regards

 Ketan



 On Mon, Mar 29, 2010 at 6:30 PM, Jim Idle j...@temporal-wave.com wrote:

 Ah. You are asking for the parser tree, not a representation of the AST?
 Search the mailing list for this. Such a tree is not generally useful for
 doing things with (so if you are looking for this information because you
 want to use it to generate code or something, then you are probably looking
 at your problem incorrectly), but it is very useful for debugging the tree.



 http://antlr.markmail.org/search/?q=parse+tree





 If all you want is information in the nodes, then get the payload of the
 leaf node (usually CommonToken) and ask for it, but that’s what the code you
 looked at is doing.



 Jim





 From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com]
 Sent: Monday, March 29, 2010 9:18 AM
 To: Jim Idle
 Cc: antlr-interest@antlr.org
 Subject: Re: [antlr-interest] How to get GUI like tree structure




 Jim



 Thanks again for your answer.



 1. I checked the DOTTreeGenerator.java code but I do not seem to know how
 it finds all the info about a tree. Also I am confused with its use of both
 the stringtemplates and trees (are'nt they mutually exclusive?).



 2. Yes, the toStringTree() method prints the tree but it only gives the
 leaf nodes, that is the program itself. I have no info about which rule a
 given token belongs to.



 To be more clear, see the attached snapshot. My question is how can I
 capture this parse tree in a some kind of java data structure and walk
 through it.



 Many Thanks again for all your help.

 Ketan



 On Mon, Mar 29, 2010 at 5:41 PM, Jim Idle j...@temporal-wave.com wrote:

 Look at the code for DOTTreeGenerator.java or use toStringTree() if that
 gives you a good enough representation.

 Jim


  -Original Message-
  From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
  boun...@antlr.org] On Behalf Of Ketan Maheshwari
  Sent: Monday, March 29, 2010 7:36 AM
  To: antlr-interest@antlr.org
  Subject: [antlr-interest] How to get GUI like tree structure
 
  Hello Friends
 
  I am trying to use the CommonTree generated by the parser of my grammar
  against a test code.
 
  Using the getChild(index).toString method, I get the tokens well.
 
  However, I do not know how can I also get a hierarchy of the rule to
  which
  they belong to. Similar to what we get in the ANTLRworks GUI.
 
  Any clue how can I get a tree such that it shows complete hierarchy of
  the
  grammar and the tokens as leaf nodes only.
 
  Am I using the correct Data Structure (CommonTree) ?
 
  Thanks for any clues.
 
  Regards
  Ketan
 

  List: http://www.antlr.org/mailman/listinfo/antlr-interest
  Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
  email-address




 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe:
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address






 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe:
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address






 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe:
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 

[il-antlr-interest: 28443] Re: [antlr-interest] How to get GUI like tree structure

2010-03-31 Thread Ketan Maheshwari
Jim

About the purpose of having ParseTree : I need to know what tokens are
children of a given rule in my input so that I can separate tokens based on
the rules and put them into places in a customized object which in turn is
required to generate  output in xml format!

So, essentially I am building a translator from my DSL to its xml
representation for which an xml writer exists. I just need to give it
correct java object!

I think a ParseTree only can do this since ASTs does not have rule names
they just have the tokens arranged in a tree.

Regards
Ketan


On Wed, Mar 31, 2010 at 5:11 PM, Ketan Maheshwari 
ketancmaheshw...@gmail.com wrote:

 Jim

 Thanks for your quick answer. The code shown uses the -debug option to
 generate parser and lexer classes, but I have problems with the debug option
 that when I use it the parser just hangs and does not go ahead.

 Any solution as to generate a ParseTree without using the debug option.

 Ketan

 On Wed, Mar 31, 2010 at 4:58 PM, Jim Idle j...@temporal-wave.com wrote:

 I think you are looking for the wrong thing. You are unlikely to need the
 parse tree in order to operate upon the input. You are almost certainly in
 need of an AST that you build yourself using the ANTLR tree building
 constructs.



 Did you search the WIKI:



 http://www.antlr.org/wiki/pages/viewpage.action?pageId=1760



 Jim





 From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com]
 Sent: Wednesday, March 31, 2010 7:47 AM
 To: Jim Idle
 Cc: antlr-interest@antlr.org
 Subject: Re: [antlr-interest] How to get GUI like tree structure



 Hi Jim, Hi All



 I searched but still am struggling to really get the parsertree object for
 my grammar.



 My goal is to get the parser tree object just as being shown in the GUI
 and put its elements in another object that I need to construct based upon
 the tree.



 But after a lot of search I still have no clue how do I get the ParserTree
 object with a *hierarchy of rules* and leaf nodes as the actual *tokens* of
 my program!



 Many thanks for any help with this.



 Regards

 Ketan



 On Mon, Mar 29, 2010 at 6:30 PM, Jim Idle j...@temporal-wave.com wrote:

 Ah. You are asking for the parser tree, not a representation of the AST?
 Search the mailing list for this. Such a tree is not generally useful for
 doing things with (so if you are looking for this information because you
 want to use it to generate code or something, then you are probably looking
 at your problem incorrectly), but it is very useful for debugging the tree.



 http://antlr.markmail.org/search/?q=parse+tree





 If all you want is information in the nodes, then get the payload of the
 leaf node (usually CommonToken) and ask for it, but that’s what the code you
 looked at is doing.



 Jim





 From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com]
 Sent: Monday, March 29, 2010 9:18 AM
 To: Jim Idle
 Cc: antlr-interest@antlr.org
 Subject: Re: [antlr-interest] How to get GUI like tree structure




 Jim



 Thanks again for your answer.



 1. I checked the DOTTreeGenerator.java code but I do not seem to know how
 it finds all the info about a tree. Also I am confused with its use of both
 the stringtemplates and trees (are'nt they mutually exclusive?).



 2. Yes, the toStringTree() method prints the tree but it only gives the
 leaf nodes, that is the program itself. I have no info about which rule a
 given token belongs to.



 To be more clear, see the attached snapshot. My question is how can I
 capture this parse tree in a some kind of java data structure and walk
 through it.



 Many Thanks again for all your help.

 Ketan



 On Mon, Mar 29, 2010 at 5:41 PM, Jim Idle j...@temporal-wave.com wrote:

 Look at the code for DOTTreeGenerator.java or use toStringTree() if that
 gives you a good enough representation.

 Jim


  -Original Message-
  From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
  boun...@antlr.org] On Behalf Of Ketan Maheshwari
  Sent: Monday, March 29, 2010 7:36 AM
  To: antlr-interest@antlr.org
  Subject: [antlr-interest] How to get GUI like tree structure
 
  Hello Friends
 
  I am trying to use the CommonTree generated by the parser of my grammar
  against a test code.
 
  Using the getChild(index).toString method, I get the tokens well.
 
  However, I do not know how can I also get a hierarchy of the rule to
  which
  they belong to. Similar to what we get in the ANTLRworks GUI.
 
  Any clue how can I get a tree such that it shows complete hierarchy of
  the
  grammar and the tokens as leaf nodes only.
 
  Am I using the correct Data Structure (CommonTree) ?
 
  Thanks for any clues.
 
  Regards
  Ketan
 

  List: http://www.antlr.org/mailman/listinfo/antlr-interest
  Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
  email-address




 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe:
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address






 List: 

[il-antlr-interest: 28444] Re: [antlr-interest] How to get GUI like tree structure

2010-03-31 Thread Jim Idle
If you sue the code shown, it won’t hang. But, I assure you that you almost 
certainly do not want the parse tree. Read up on ASTs.

 

Jim

 

From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com] 
Sent: Wednesday, March 31, 2010 8:12 AM
To: Jim Idle
Cc: antlr-interest@antlr.org
Subject: Re: [antlr-interest] How to get GUI like tree structure

 

Jim

 

Thanks for your quick answer. The code shown uses the -debug option to generate 
parser and lexer classes, but I have problems with the debug option that when I 
use it the parser just hangs and does not go ahead.


Any solution as to generate a ParseTree without using the debug option.

 

Ketan

 

On Wed, Mar 31, 2010 at 4:58 PM, Jim Idle j...@temporal-wave.com wrote:

I think you are looking for the wrong thing. You are unlikely to need the parse 
tree in order to operate upon the input. You are almost certainly in need of an 
AST that you build yourself using the ANTLR tree building constructs.



Did you search the WIKI:



http://www.antlr.org/wiki/pages/viewpage.action?pageId=1760




Jim





From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com]

Sent: Wednesday, March 31, 2010 7:47 AM

To: Jim Idle
Cc: antlr-interest@antlr.org
Subject: Re: [antlr-interest] How to get GUI like tree structure



Hi Jim, Hi All



I searched but still am struggling to really get the parsertree object for my 
grammar.



My goal is to get the parser tree object just as being shown in the GUI and put 
its elements in another object that I need to construct based upon the tree.



But after a lot of search I still have no clue how do I get the ParserTree 
object with a *hierarchy of rules* and leaf nodes as the actual *tokens* of my 
program!



Many thanks for any help with this.



Regards

Ketan



On Mon, Mar 29, 2010 at 6:30 PM, Jim Idle j...@temporal-wave.com wrote:

Ah. You are asking for the parser tree, not a representation of the AST? Search 
the mailing list for this. Such a tree is not generally useful for doing things 
with (so if you are looking for this information because you want to use it to 
generate code or something, then you are probably looking at your problem 
incorrectly), but it is very useful for debugging the tree.



http://antlr.markmail.org/search/?q=parse+tree





If all you want is information in the nodes, then get the payload of the leaf 
node (usually CommonToken) and ask for it, but that’s what the code you looked 
at is doing.



Jim





From: Ketan Maheshwari [mailto:ketancmaheshw...@gmail.com]
Sent: Monday, March 29, 2010 9:18 AM
To: Jim Idle
Cc: antlr-interest@antlr.org
Subject: Re: [antlr-interest] How to get GUI like tree structure




Jim



Thanks again for your answer.



1. I checked the DOTTreeGenerator.java code but I do not seem to know how it 
finds all the info about a tree. Also I am confused with its use of both the 
stringtemplates and trees (are'nt they mutually exclusive?).



2. Yes, the toStringTree() method prints the tree but it only gives the leaf 
nodes, that is the program itself. I have no info about which rule a given 
token belongs to.



To be more clear, see the attached snapshot. My question is how can I capture 
this parse tree in a some kind of java data structure and walk through it.



Many Thanks again for all your help.

Ketan



On Mon, Mar 29, 2010 at 5:41 PM, Jim Idle j...@temporal-wave.com wrote:

Look at the code for DOTTreeGenerator.java or use toStringTree() if that gives 
you a good enough representation.

Jim


 -Original Message-
 From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
 boun...@antlr.org] On Behalf Of Ketan Maheshwari
 Sent: Monday, March 29, 2010 7:36 AM
 To: antlr-interest@antlr.org
 Subject: [antlr-interest] How to get GUI like tree structure

 Hello Friends

 I am trying to use the CommonTree generated by the parser of my grammar
 against a test code.

 Using the getChild(index).toString method, I get the tokens well.

 However, I do not know how can I also get a hierarchy of the rule to
 which
 they belong to. Similar to what we get in the ANTLRworks GUI.

 Any clue how can I get a tree such that it shows complete hierarchy of
 the
 grammar and the tokens as leaf nodes only.

 Am I using the correct Data Structure (CommonTree) ?

 Thanks for any clues.

 Regards
 Ketan


 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
 email-address




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address






List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address






List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

 




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 

[il-antlr-interest: 28447] [antlr-interest] Reusing an existing Parse Tree rather than reconstructing one

2010-03-31 Thread Kunal Sawlani
Hi,
I have a parse tree which gets constructed as the user types in his input.
This seems to be working fine, but the problem is it reconstructs the tree
every time the user types in something, which is undesirable.
Is there a way to modify the existing parse tree, for better efficiency
purposes. And also, I want to maintain information in the tree whether a
node is stale, i.e, changed, from before when the user finishes typing his
input.
I was looking into the TreeWizard, but could not quite come up with a
solution.

Any ideas for this, or a work around for achieving the same would be really
appreciated.

Thanks
-- 
Kunal Sawlani

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



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

2010-03-31 Thread Ron Burk
 My question is then what is
 the appropriate way to construct the lexer such that it will recover
 gracefully from that invalid input and NOT go into the infinite loop state
 caused by the thrown exception?

Personally, I try to keep modes in the lexer and
out of the parser. I probably would have had the
lexer looking past any initial '' to distinguish the
various types of things it presages (especially
since the XML spec seems to make that relatively
easy). So, for example, this:

 Program/Program

would have returned a token stream like:

TK_START_TAG
TK_IDENT
TK_GT
TK_ILLEGAL
TK_END_TAG
TK_IDENT
TK_GT

I would keep modes like CDATA in the lexer.
YMMV, many ways to skin a cat, etc.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



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

2010-03-31 Thread Scott Stanchfield
When I wrote ANTXR (my XML parser derivative of ANTLR 2.x) I had it
use SAX or XMLPull as the scanner rather than using an ANTLR scanner.
Much simpler for dealing with things like CDATA...
-- Scott


Scott Stanchfield
http://javadude.com



On Wed, Mar 31, 2010 at 2:27 PM, Ron Burk ronb...@gmail.com wrote:
 My question is then what is
 the appropriate way to construct the lexer such that it will recover
 gracefully from that invalid input and NOT go into the infinite loop state
 caused by the thrown exception?

 Personally, I try to keep modes in the lexer and
 out of the parser. I probably would have had the
 lexer looking past any initial '' to distinguish the
 various types of things it presages (especially
 since the XML spec seems to make that relatively
 easy). So, for example, this:

 Program/Program

 would have returned a token stream like:

 TK_START_TAG
 TK_IDENT
 TK_GT
 TK_ILLEGAL
 TK_END_TAG
 TK_IDENT
 TK_GT

 I would keep modes like CDATA in the lexer.
 YMMV, many ways to skin a cat, etc.

 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: 
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



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

2010-03-31 Thread Cliff Hudson
So I ended up doing something I think a little similar to this, except that
I get START_TAG followed by UNEXPECTED rather than the other way around - I
could probably fix this by having an action which tosses the appropriate
token or something.  I have managed to keep all modes strictly in the lexer
though, and it is now tolerant of every syntax error I've thrown at it.

Thanks for the assistance.

On Wed, Mar 31, 2010 at 11:27 AM, Ron Burk ronb...@gmail.com wrote:

  My question is then what is
  the appropriate way to construct the lexer such that it will recover
  gracefully from that invalid input and NOT go into the infinite loop
 state
  caused by the thrown exception?

 Personally, I try to keep modes in the lexer and
 out of the parser. I probably would have had the
 lexer looking past any initial '' to distinguish the
 various types of things it presages (especially
 since the XML spec seems to make that relatively
 easy). So, for example, this:

  Program/Program

 would have returned a token stream like:

 TK_START_TAG
 TK_IDENT
 TK_GT
 TK_ILLEGAL
 TK_END_TAG
 TK_IDENT
 TK_GT

 I would keep modes like CDATA in the lexer.
 YMMV, many ways to skin a cat, etc.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



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

2010-03-31 Thread Andi Clemens
Hi,

thank you... I will take a look at your example, maybe I can use this.

Andi

On Wednesday 31 March 2010 16:56:05 Jim Idle wrote:
 No it isn't in case you want to encapsulate it elsewhere. However for
 context level elements you want to use the mechanism I established and not
 hijack super really (though super is meant for your own stuff).
 
 So:
 
 
 @parser::context
 {
 // A pointer to the blah that we blargle into a gargle
 //
 pBLAH   papi;
 }
 
 @parser::apifuncs
 {
   ctx-pBLAH = NULL;
 }
 
 @parser::includes
 {
 // Include the BLAH interface specifications, so we know how to call
 // an implementation to have it do work for us.
 //
 #include blah.h
 
 // Create a macro to make references to the BLAH pointer easier
 //
 #define BLAH CTX-pBLAH
 }
 
 
 Now in your actions you can use:
 
 {
BLAH-number = 666;
BLAH-myCall(BLAH, 666);
 
// And so on...
 
 }
 
 
 You use the context pointers because 'global' data is exactly what you
 don't want as you instantly destroy the free threading, which is built
 into the code generation and the runtime. Here you get one pBLAH per
 thread:
 
 psr   = MyParserNew(tstream);
 
 if (psr == NULL) ...
 
 // Install a BLAH interface
 //
 psr-blah   = getBlah();
 if  (psr-blah == NULL) ...
 
 if  ((retCode = psr-blah-blahInitialize(psr-blah)) != 0)...
 
 
 Jim
 
  -Original Message-
  From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
  boun...@antlr.org] On Behalf Of Christopher L Conway
  Sent: Wednesday, March 31, 2010 7:36 AM
  To: antlr-interest@antlr.org
  Subject: Re: [antlr-interest] Adding custom functions to the parser in
  a C target
  
  Andi,
  
  I think you'll find the void* field super in ANTLR3_PARSER_struct,
  accessible in the grammar via PARSER-super, is a good place to stick
  implementation data. AFAICT, it is never set by the generated code.
  
  -Chris
  
  On Wed, Mar 31, 2010 at 1:51 AM, Andi Clemens andi.clem...@gmx.net
  
  wrote:
   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 parser?
   I need to give the parser a pointer to the whitelist in memory and
  
  some other
  
   variables for detecting valid / invalid table names.
   
   Defining variables in @members doesn't help, I am not able to access
  
  this from
  
   outside of the parser code.
   In Java it seems to be much easier, since you have a class where you
  
  can add
  
   public members, but in C I have no clue how to do it (yes, I need to
  
  use C,
  
   and I never programmed in that language, only in C++ and Python so
  
  far).
  
   I want to do something like this.
   In the parser rule table_spec, I want to check the table name:
   {
  char result[256];
  strcat(result, s.tree ? s.tree-getText(s.tree)-chars : );
  strcat(result, s.tree ? . : );
  strcat(result, t.tree ? t.tree-getText(t.tree)-chars : );
  isValid = checkForValidTable(result);
   }
   
   isValid and checkForValidTable are defined in @members, but the
  
  check
  
   function needs some statement handlers and other stuff coming from
  
  the
  
   outside. In the end, I wanted to have something like this in my
  
  main.cpp:
   [...]
   parser-setStmtHandle(some pointer);
   parser-setWhiteListHandle(some pointer);
   parser-sql_statement(parser); // this is the main function I would
  
  use from
  
   the PL/SQL grammar file
   bool isValid = parser-isValid();
   [...]
   
   
   Is it possible to do something like that? If not, how can I fix this
  
  problem?
  
   I need to get those handles inside of the parser somehow?
   Any ideas?
   
   Andi
   
   List: http://www.antlr.org/mailman/listinfo/antlr-interest
   Unsubscribe: http://www.antlr.org/mailman/options/antlr-
  
  interest/your-email-address
  
  
  List: http://www.antlr.org/mailman/listinfo/antlr-interest
  Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
  email-address
 
 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe:
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28453] [antlr-interest] Importing problems

2010-03-31 Thread Luigi Iannone
Hi

I have built a lexer grammar, and a combined one which should import it.
The problem is that as soon as I try to import using the following code in my 
combined grammar

grammar ManchesterOWLSyntax;
import  ManchesterOWLSyntaxLexer ;

  
main:
 IDENTIFIER  
;

I get the following error

ANTLR Parser Generator 3.2 Sep 23, 2009 12:02:23.
Using project classpath: Yes.
Grammar: /Users/luigi/Documents/workspace/Parsers/src/ManchesterOWLSyntax.g
error(163): /Parsers/src/ManchesterOWLSyntax.g:2:9: combined grammar 
ManchesterOWLSyntax and imported lexer grammar ManchesterOWLSyntaxLexer both 
generate ManchesterOWLSyntax_ManchesterOWLSyntaxLexer; import ignored
 |--- import  ManchesterOWLSyntaxLexer ;


I wonder what am I doing wrong. Any clue?

Thanks,

Luigi

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28454] Re: [antlr-interest] Importing problems

2010-03-31 Thread Luigi Iannone
Hi,

strangely enough, I changed the name of the lexer to one which is not a 
sub-string of the combined grammar's name and it works fine.

Luigi
On 31 Mar 2010, at 23:29, Luigi Iannone wrote:

 Hi
 
 I have built a lexer grammar, and a combined one which should import it.
 The problem is that as soon as I try to import using the following code in my 
 combined grammar
 
 grammar ManchesterOWLSyntax;
 import  ManchesterOWLSyntaxLexer ;
 
 
 main:
IDENTIFIER  
   ;
 
 I get the following error
 
 ANTLR Parser Generator 3.2 Sep 23, 2009 12:02:23.
 Using project classpath: Yes.
 Grammar: /Users/luigi/Documents/workspace/Parsers/src/ManchesterOWLSyntax.g
 error(163): /Parsers/src/ManchesterOWLSyntax.g:2:9: combined grammar 
 ManchesterOWLSyntax and imported lexer grammar ManchesterOWLSyntaxLexer both 
 generate ManchesterOWLSyntax_ManchesterOWLSyntaxLexer; import ignored
 |--- import  ManchesterOWLSyntaxLexer ;
 
 
 I wonder what am I doing wrong. Any clue?
 
 Thanks,
 
 Luigi
 
 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: 
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28455] Re: [antlr-interest] Importing problems

2010-03-31 Thread Ron Hunter-Duvar
Luigi,

Are you trying to import your lexer grammar into your parser grammar? If 
so, I don't think that is correct. What you should do to have your 
parser grammar use the tokens defined by your lexer is to use the 
tokenVocab option, something like this:

grammar ManchesterOWLSyntax;
options {
  tokenVocab=ManchesterOWLSyntaxLexer;
}


Ron


Luigi Iannone wrote:
 Hi

 I have built a lexer grammar, and a combined one which should import it.
 The problem is that as soon as I try to import using the following code in my 
 combined grammar

 grammar ManchesterOWLSyntax;
 import  ManchesterOWLSyntaxLexer ;

   
 main:
IDENTIFIER  
   ;

 I get the following error

 ANTLR Parser Generator 3.2 Sep 23, 2009 12:02:23.
 Using project classpath: Yes.
 Grammar: /Users/luigi/Documents/workspace/Parsers/src/ManchesterOWLSyntax.g
 error(163): /Parsers/src/ManchesterOWLSyntax.g:2:9: combined grammar 
 ManchesterOWLSyntax and imported lexer grammar ManchesterOWLSyntaxLexer both 
 generate ManchesterOWLSyntax_ManchesterOWLSyntaxLexer; import ignored
  |--- import  ManchesterOWLSyntaxLexer ;


 I wonder what am I doing wrong. Any clue?

 Thanks,

 Luigi

 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: 
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address

   

-- 
Ron Hunter-Duvar | Software Developer V | 403-272-6580
Oracle Service Engineering
Gulf Canada Square 401 - 9th Avenue S.W., Calgary, AB, Canada T2P 3C5

All opinions expressed here are mine, and do not necessarily represent
those of my employer.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



[il-antlr-interest: 28456] [antlr-interest] crash with tree filter

2010-03-31 Thread James Briant
error(10):  internal error:
com/binaryfinery/comb/javaparser/generated/JavaDef.g :
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 50
java.util.Vector.set(Vector.java:712)
org.antlr.analysis.DFA.createMinMaxTables(DFA.java:531)
org.antlr.analysis.DFA.createStateTables(DFA.java:435)
org.antlr.codegen.CodeGenerator.genLookaheadDecision(CodeGenerator.java:653)
org.antlr.grammar.v2.CodeGenTreeWalker.block(CodeGenTreeWalker.java:1018)
org.antlr.grammar.v2.CodeGenTreeWalker.rule(CodeGenTreeWalker.java:797)
org.antlr.grammar.v2.CodeGenTreeWalker.rules(CodeGenTreeWalker.java:588)
org.antlr.grammar.v2.CodeGenTreeWalker.grammarSpec(CodeGenTreeWalker.java:530)
org.antlr.grammar.v2.CodeGenTreeWalker.grammar(CodeGenTreeWalker.java:336)
org.antlr.codegen.CodeGenerator.genRecognizer(CodeGenerator.java:432)
org.antlr.Tool.generateRecognizer(Tool.java:641)
org.antlr.Tool.process(Tool.java:454)
org.antlr.mojo.antlr3.Antlr3Mojo.execute(Antlr3Mojo.java:391)
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
org.codehaus.classworlds.Launcher.main(Launcher.java:375)

This is where it tanks:

switchBlockLabels
:   ^(SWITCH_BLOCK_LABEL_LIST switchCaseLabels* )
;

switchCaseLabels
:   ^(CASE expression blockStatement*)
| ^(DEFAULT blockStatement*)
;

Any ideas?

Thanks,

Jamie

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.