cs132.vapor.parser
Class VaporParser

java.lang.Object
  extended by cs132.vapor.parser.VaporParser

public class VaporParser
extends Object

The JavaCC-generated parser. Use the static run method.


Field Summary
static int Anything
          RegularExpression Id.
static int BlockComment
          RegularExpression Id.
static int BraceComment
          RegularExpression Id.
static int CodeLabelIdent
          RegularExpression Id.
static int DEFAULT
          Lexical state.
static int Digit
          RegularExpression Id.
static int Digits
          RegularExpression Id.
static int EOF
          End of File.
static int Eol
          RegularExpression Id.
static int EscapeBackslash
          RegularExpression Id.
static int EscapeQuote
          RegularExpression Id.
static int Ident
          RegularExpression Id.
static int IdentHead
          RegularExpression Id.
static int IdentRest
          RegularExpression Id.
 cs132.vapor.parser.Token jj_nt
          Next token.
static int LabelRefIdent
          RegularExpression Id.
static int LineComment
          RegularExpression Id.
static int LitStr
          RegularExpression Id.
static int LitStrStart
          RegularExpression Id.
static int NegDigits
          RegularExpression Id.
static int NormalStringContent
          RegularExpression Id.
static int PlainIdent
          RegularExpression Id.
static int RegIdent
          RegularExpression Id.
 cs132.vapor.parser.Token token
          Current token.
 cs132.vapor.parser.VaporParserTokenManager token_source
          Generated Token Manager.
static String[] tokenImage
          Literal token values.
static int WITHIN_STRING
          Lexical state.
 
Constructor Summary
VaporParser(InputStream stream)
          Constructor with InputStream.
VaporParser(InputStream stream, String encoding)
          Constructor with InputStream and supplied encoding
VaporParser(Reader stream)
          Constructor.
VaporParser(cs132.vapor.parser.VaporParserTokenManager tm)
          Constructor with generated Token Manager.
 
Method Summary
 void disable_tracing()
          Disable tracing.
 void enable_tracing()
          Enable tracing.
 ParseException generateParseException()
          Generate ParseException.
 cs132.vapor.parser.Token getNextToken()
          Get the next Token.
 cs132.vapor.parser.Token getToken(int index)
          Get the specific Token.
 void ReInit(InputStream stream)
          Reinitialise.
 void ReInit(InputStream stream, String encoding)
          Reinitialise.
 void ReInit(Reader stream)
          Reinitialise.
 void ReInit(cs132.vapor.parser.VaporParserTokenManager tm)
          Reinitialise.
static VaporProgram run(Reader input, int line, int col, Iterable<VBuiltIn.Op> ops, boolean allowLocals, String[] registers, boolean allowStack)
          Run the parser on the given input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public cs132.vapor.parser.VaporParserTokenManager token_source
Generated Token Manager.


token

public cs132.vapor.parser.Token token
Current token.


jj_nt

public cs132.vapor.parser.Token jj_nt
Next token.


EOF

public static final int EOF
End of File.

See Also:
Constant Field Values

LineComment

public static final int LineComment
RegularExpression Id.

See Also:
Constant Field Values

BlockComment

public static final int BlockComment
RegularExpression Id.

See Also:
Constant Field Values

BraceComment

public static final int BraceComment
RegularExpression Id.

See Also:
Constant Field Values

Digit

public static final int Digit
RegularExpression Id.

See Also:
Constant Field Values

Digits

public static final int Digits
RegularExpression Id.

See Also:
Constant Field Values

NegDigits

public static final int NegDigits
RegularExpression Id.

See Also:
Constant Field Values

IdentHead

public static final int IdentHead
RegularExpression Id.

See Also:
Constant Field Values

IdentRest

public static final int IdentRest
RegularExpression Id.

See Also:
Constant Field Values

Eol

public static final int Eol
RegularExpression Id.

See Also:
Constant Field Values

LitStrStart

public static final int LitStrStart
RegularExpression Id.

See Also:
Constant Field Values

LitStr

public static final int LitStr
RegularExpression Id.

See Also:
Constant Field Values

EscapeQuote

public static final int EscapeQuote
RegularExpression Id.

See Also:
Constant Field Values

EscapeBackslash

public static final int EscapeBackslash
RegularExpression Id.

See Also:
Constant Field Values

NormalStringContent

public static final int NormalStringContent
RegularExpression Id.

See Also:
Constant Field Values

Ident

public static final int Ident
RegularExpression Id.

See Also:
Constant Field Values

RegIdent

public static final int RegIdent
RegularExpression Id.

See Also:
Constant Field Values

CodeLabelIdent

public static final int CodeLabelIdent
RegularExpression Id.

See Also:
Constant Field Values

LabelRefIdent

public static final int LabelRefIdent
RegularExpression Id.

See Also:
Constant Field Values

PlainIdent

public static final int PlainIdent
RegularExpression Id.

See Also:
Constant Field Values

Anything

public static final int Anything
RegularExpression Id.

See Also:
Constant Field Values

DEFAULT

public static final int DEFAULT
Lexical state.

See Also:
Constant Field Values

WITHIN_STRING

public static final int WITHIN_STRING
Lexical state.

See Also:
Constant Field Values

tokenImage

public static final String[] tokenImage
Literal token values.

Constructor Detail

VaporParser

public VaporParser(InputStream stream)
Constructor with InputStream.


VaporParser

public VaporParser(InputStream stream,
                   String encoding)
Constructor with InputStream and supplied encoding


VaporParser

public VaporParser(Reader stream)
Constructor.


VaporParser

public VaporParser(cs132.vapor.parser.VaporParserTokenManager tm)
Constructor with generated Token Manager.

Method Detail

run

public static VaporProgram run(Reader input,
                               int line,
                               int col,
                               Iterable<VBuiltIn.Op> ops,
                               boolean allowLocals,
                               String[] registers,
                               boolean allowStack)
                        throws IOException,
                               ProblemException
Run the parser on the given input. Returns an AST of the program.

Parameters:
input - The input source.
line - The line number the input starts at (typically 1)
col - The column number the input starts at (typically 1)
ops - The list of built-in operations the program is allowed to use. For example: VBuiltIn.Op.Add.
allowLocals - Whether the program is allowed to use local variables.
registers - The set of global registers the program is allowed to use. Setting this to 'null' means registers are not allowed.
allowStack - Whether the program is allowed to use the stack explicitly.
Throws:
IOException - If there's an I/O error when reading from the input source.
ProblemException - If there's a syntax error in the input.

ReInit

public void ReInit(InputStream stream)
Reinitialise.


ReInit

public void ReInit(InputStream stream,
                   String encoding)
Reinitialise.


ReInit

public void ReInit(Reader stream)
Reinitialise.


ReInit

public void ReInit(cs132.vapor.parser.VaporParserTokenManager tm)
Reinitialise.


getNextToken

public final cs132.vapor.parser.Token getNextToken()
Get the next Token.


getToken

public final cs132.vapor.parser.Token getToken(int index)
Get the specific Token.


generateParseException

public ParseException generateParseException()
Generate ParseException.


enable_tracing

public final void enable_tracing()
Enable tracing.


disable_tracing

public final void disable_tracing()
Disable tracing.