Package org.antlr.tool
Class GrammarSerializerFoo
java.lang.Object
org.antlr.tool.GrammarSerializerFoo
Serialize a grammar into a highly compressed form with
only the info needed to recognize sentences.
FORMAT:
file ::= $ANTLR<version:byte><grammartype:byte><name:string>;<numRules:short><rules>
rule ::= R<rulename:string>;B<nalts:short><alts>.
alt ::= A<elems>;
elem ::= t<tokentype:short> | r<ruleIndex:short> | -<char:uchar><char:uchar> | ~<tokentype> | w
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ByteArrayOutputStreamprotected Stringprotected Grammarprotected intprotected DataOutputStream -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidalt(GrammarAST alt) voidblock(int nalts) voidvoidclose()voidendAlt()voidendRule()voidvoidnot()voidvoidrange()voidvoidvoidtoken(GrammarAST t) voidvoidwriteString(DataOutputStream out, String s)
-
Field Details
-
out
-
filename
-
g
-
altBuf
-
numElementsInAlt
protected int numElementsInAlt
-
-
Constructor Details
-
GrammarSerializerFoo
-
-
Method Details
-
open
- Throws:
IOException
-
close
- Throws:
IOException
-
grammar
-
rule
-
endRule
public void endRule() -
block
public void block(int nalts) -
alt
-
endAlt
public void endAlt() -
ruleRef
-
token
-
charLiteral
-
wildcard
-
range
public void range() -
not
public void not() -
writeString
- Throws:
IOException
-