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 ByteArrayOutputStream
altBuf
protected String
filename
protected Grammar
g
protected int
numElementsInAlt
protected DataOutputStream
out
-
Constructor Summary
Constructors Constructor Description GrammarSerializerFoo(Grammar g)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
alt(GrammarAST alt)
void
block(int nalts)
void
charLiteral(GrammarAST t)
void
close()
void
endAlt()
void
endRule()
void
grammar(int grammarTokenType, String name)
void
not()
void
open(String filename)
void
range()
void
rule(String name)
void
ruleRef(GrammarAST t)
void
token(GrammarAST t)
void
wildcard(GrammarAST t)
void
writeString(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
-
-