Package org.antlr.tool
Class GrammarSerializerFoo
- java.lang.Object
-
- org.antlr.tool.GrammarSerializerFoo
-
public class GrammarSerializerFoo extends Object
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
Fields Modifier and Type Field Description protected ByteArrayOutputStreamaltBufprotected Stringfilenameprotected Grammargprotected intnumElementsInAltprotected DataOutputStreamout
-
Constructor Summary
Constructors Constructor Description GrammarSerializerFoo(Grammar g)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalt(GrammarAST alt)voidblock(int nalts)voidcharLiteral(GrammarAST t)voidclose()voidendAlt()voidendRule()voidgrammar(int grammarTokenType, String name)voidnot()voidopen(String filename)voidrange()voidrule(String name)voidruleRef(GrammarAST t)voidtoken(GrammarAST t)voidwildcard(GrammarAST t)voidwriteString(DataOutputStream out, String s)
-
-
-
Field Detail
-
out
protected DataOutputStream out
-
filename
protected String filename
-
g
protected Grammar g
-
altBuf
protected ByteArrayOutputStream altBuf
-
numElementsInAlt
protected int numElementsInAlt
-
-
Constructor Detail
-
GrammarSerializerFoo
public GrammarSerializerFoo(Grammar g)
-
-
Method Detail
-
open
public void open(String filename) throws IOException
- Throws:
IOException
-
close
public void close() throws IOException- Throws:
IOException
-
grammar
public void grammar(int grammarTokenType, String name)
-
rule
public void rule(String name)
-
endRule
public void endRule()
-
block
public void block(int nalts)
-
alt
public void alt(GrammarAST alt)
-
endAlt
public void endAlt()
-
ruleRef
public void ruleRef(GrammarAST t)
-
token
public void token(GrammarAST t)
-
charLiteral
public void charLiteral(GrammarAST t)
-
wildcard
public void wildcard(GrammarAST t)
-
range
public void range()
-
not
public void not()
-
writeString
public void writeString(DataOutputStream out, String s) throws IOException
- Throws:
IOException
-
-