[antlr-interest] Problem using CSharpParser.g

Dmitry Goldenberg dmitry.goldenberg at weblayers.com
Tue Dec 12 16:45:20 PST 2006


Micheal,
I was trying to use CSharpParser.g from csharp_v1 in Antlr 2.7.6.  
 
It has the following line:
importVocab = CSharpLexer;

I believe the exception was raised by this code in ImportVocabTokenManager, instantiated by DefineGrammarSymbols

        if (!grammarFile.exists()) {
            grammarFile = new File(antlrTool.getOutputDirectory(), filename);

            if (!grammarFile.exists()) {
                antlrTool.panic("Cannot find importVocab file '" + filename + "'");
            }
        }

The import vocab token manager is instantiated like this:

            ImportVocabTokenManager tm =
                new ImportVocabTokenManager(grammar,
                                            grammar.importVocab + CodeGenerator.TokenTypesFileSuffix + CodeGenerator.TokenTypesFileExt,
                                            grammar.exportVocab,
                                            tool);

I believe it's that string concatenation that generates "CSharpLexerTokenTypes.txt" and this file is not available.  Any thoughts?

Thanks,

- Dmitry

-----------------------
 
Where did you get the CSharpParser.g grammar file you are using?

If you are talking about CSharpParser.g from our grammar contribution (named
KCSParse or csharp_v1) then, you should know that we provided a
self-contained distribution that builds all the grammars in the right order.
You will need Nant to build. Incidentally, although KCSParse is still
available from the website, it has been superceeded by csharp_v1 (which is
included as a sample with ANTLR 2.7.6 and 2.7.7).

Micheal

-----------------------
The best way to contact me is via the list/forum. My time is very limited. 

-----Original Message-----
From: antlr-interest-bounces at antlr.org <http://www.antlr.org/mailman/listinfo/antlr-interest> 
[mailto:antlr-interest-bounces at antlr.org <http://www.antlr.org/mailman/listinfo/antlr-interest> ] On Behalf Of Dmitry Goldenberg
Sent: 11 December 2006 21:21
To: antlr-interest at antlr.org <http://www.antlr.org/mailman/listinfo/antlr-interest> 
Subject: [antlr-interest] Problem using CSharpParser.g


I'm trying to use Antlr 2.6.7 with the CSharpParser.g grammar.

java antlr.Tool CSharpParser.g yields the following:
ANTLR Parser Generator   Version 2.7.6 (2005-12-22)   1989-2005
panic: Cannot find importVocab file 'CSharpLexerTokenTypes.txt'

Does anyone have any idea how to fix this?
Thanks,
- Dmitry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061212/7594c26b/attachment-0001.html 


More information about the antlr-interest mailing list