Package org.antlr.tool
Class GrammarSpelunker
java.lang.Object
org.antlr.tool.GrammarSpelunker
Load a grammar file and scan it just until we learn a few items
of interest. Currently: name, type, imports, tokenVocab, language option.
GrammarScanner (at bottom of this class) converts grammar to stuff like:
grammar Java ; options { backtrack true memoize true }
import JavaDecl JavaAnnotations JavaExpr ;
... : ...
First ':' or '@' indicates we can stop looking for imports/options.
Then we just grab interesting grammar properties.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Strip comments and then return stream of words and tokens {';', ':', '{', '}'} -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
grammarFileName
-
token
-
scanner
-
grammarModifier
-
grammarName
-
tokenVocab
-
language
-
inputDirectory
-
importedGrammars
-
-
Constructor Details
-
GrammarSpelunker
-
-
Method Details
-
consume
- Throws:
IOException
-
match
- Throws:
IOException
-
parse
- Throws:
IOException
-
grammarHeader
- Throws:
IOException
-
options
- Throws:
IOException
-
imports
- Throws:
IOException
-
getGrammarModifier
-
getGrammarName
-
getTokenVocab
-
getLanguage
-
getImportedGrammars
-
main
Tester; Give grammar filename as arg- Throws:
IOException
-