anvil.script.parser
Class ParserBase

java.lang.Object
  |
  +--anvil.script.parser.ParserBase
All Implemented Interfaces:
ErrorListener, ParserBaseConstants, ParserInterface
Direct Known Subclasses:
ExpressionParser, ScriptParser, StatementParser

public abstract class ParserBase
extends java.lang.Object
implements ParserInterface, ParserBaseConstants


Nested Class Summary
protected static interface ParserBase.Scanner
           
protected static class ParserBase.SetScanner
           
 
Field Summary
protected  NodeStack _nodes
           
protected  Statement _statement
           
protected  Token _token
           
protected  Tokenizer _tokenizer
           
protected static ParserBase.Scanner ASSIGNMENT_SCANNER
           
protected static ParserBase.Scanner SEMICOLON_SCANNER
           
 
Fields inherited from interface anvil.script.parser.ParserBaseConstants
ARROW, AS, ASSERT, ASSIGN, ASSIGN_ADD, ASSIGN_CONCAT, ASSIGN_DIVIDE, ASSIGN_INIT, ASSIGN_MULTIPLY, ASSIGN_REMAINDER, ASSIGN_SUBST, ASSIGN_SUBSTRACT, AT, BEGIN, BEGIN_LIST, BOOLEAN, BOOLEAN_AND, BOOLEAN_AND2, BOOLEAN_OR, BOOLEAN_OR2, BOOLEAN_XOR, BOOLEAN_XOR2, BREAK, CARET, CASE, CATCH, CLASS, CLASSOF, CLONEOF, CLOSE, CLOSE_BRACKET, COLON, COMMA, COMMENT, COMPARE, CONST, CONTINUE, COPYOF, DEFAULT, DEFINED, DELETE, DO, DOC_COMMENT, DOT, ELSE, EMBED_END, EMBED_START, END, EOF, EQUAL, ET, EXACT_COMPARE, EXACT_EQUAL, EXACT_NOT_EQUAL, EXIT, EXTENDS, FALSE, FINALLY, FLOAT, FLOATING_POINT_LITERAL, FOR, FOREACH, FUNCTION, GREATER, GREATER_OR_EQUAL, HAS, HOOK, HOOKHOOK, IF, IMPLEMENTS, IMPORT, IN, INF, INT, INTEGER_LITERAL, INTERFACE, IS, LESS, LESS_OR_EQUAL, MAP, MATCH, MINUS, MINUSMINUS, MODULE, MY, NAMESPACE, NEGATION, NEW, NO_MATCH, NOT_EQUAL, NULL, OPEN, OPEN_BRACKET, PATTERN, PIPE, PLUS, PLUSPLUS, PRAGMA, PRINT, PRINTBR, PRINTLN, QUOTE, RANGE, REMAINDER, RETURN, SEMICOLON, SIZEOF, SLASH, STAR, STATIC, STRING, STRING_LITERAL, SUPER, SWITCH, SYMBOL, SYNCHRONIZED, THIS, THROW, tokenImage, TRUE, TRY, TYPEOF, UNDEFINED, VAR, WHILE, WHITESPACE, YIELD
 
Constructor Summary
protected ParserBase(Tokenizer tokenizer)
           
 
Method Summary
protected  void AdditiveExpression()
           
protected  void Argument()
           
protected  void ArgumentList()
           
protected  void ArrayArgument()
           
protected  void ArrayConstruct()
           
protected  void AssertStatement()
           
protected  void AssignableExpression()
           
protected  void AssignmentExpression()
           
protected  void BlockStatement(java.lang.String label)
           
protected  void BreakStatement()
           
protected  void Case(SwitchStatement stmt)
           
protected  void CatchStatement(TryStatement trystmt)
           
protected  void Class(Modifiers mods)
           
protected  void ClassDeclarations()
           
protected  void Comprehension(ComprehensionNode compr, Statement root, Statement parent)
           
protected  void ComprehensionForeach(ComprehensionNode compr, Statement root, Statement parent)
           
protected  void ComprehensionIf(ComprehensionNode compr, Statement root, Statement parent)
           
protected  void ConditionalExpression()
           
protected  void Constant(Modifiers mods)
           
protected  void ConstantPart(Modifiers mods)
           
protected  void ContinueStatement()
           
protected  void Declarations(int endMarker)
           
protected  void Default(SwitchStatement stmt)
           
protected  void DoStatement(java.lang.String label)
           
protected  Token eat()
           
protected  Token eat(int kind)
           
protected  boolean eatIf(int kind)
           
 Modifiers eatModifiers(Modifiers allowed)
           
protected  void EmbeddedValueExpression()
           
protected  Name[] EntitiesToImport()
           
protected  LinkNode EntityRef()
           
protected  Name EntityToImport()
           
protected  ParseException eof()
           
protected  void EqualityExpression()
           
abstract  void error(Location location, java.lang.String message)
           
abstract  void error(Location location, java.lang.Throwable throwable)
           
abstract  int errors()
           
protected  void errorYank()
           
protected  void EtSymbol()
           
protected  void ExitStatement()
           
protected  void Expression()
           
protected  void ExpressionStart()
           
protected  void ExpressionStatement()
           
protected  void FinallyStatement(TryStatement trystmt)
           
protected  Statement flowPeek()
           
protected  Statement flowPop()
           
protected  void flowPush(Statement stmt)
           
protected  void flowPushChild(Statement stmt)
           
protected  void ForeachExpression()
           
protected  Expression[] ForeachExpressions()
           
protected  ForeachStatement ForeachHeader(Statement parent, java.lang.String label)
           
protected  void ForeachStatement(java.lang.String label)
           
protected  java.lang.Object[] ForExpressionList()
           
protected  void ForStatement(java.lang.String label)
           
protected  void Function(Modifiers mods)
           
 Statement getCurrentStatement()
           
protected  TryStatement getEnclosingTryBlock()
           
abstract  ModuleEnvelope getEnvelope()
           
abstract  java.util.Iterator getEvents()
           
abstract  SourceFile getSourceFile()
           
protected  void IfStatement()
           
protected  void Import()
           
protected  void InExpression()
           
protected  void InlineFunction()
           
protected  void Interface(Modifiers mods)
           
protected  void InterfaceDeclarations()
           
protected  void InterfaceMethod(Modifiers mods)
           
protected  void InterfaceRef(java.util.List interfaces)
           
protected  InterfaceRef[] Interfaces()
           
protected  void IsExpression()
           
protected  boolean isExpressionStart(Token t)
           
protected  void LazyExpression()
           
protected  void List(boolean forcelist, boolean mutable)
           
protected  void ListConstruct()
           
protected  void ListExpression()
           
protected  void Literal(int kind)
           
protected  void LogicalAndExpression()
           
protected  void LogicalORExpression()
           
protected  void LogicalXORExpression()
           
protected  boolean lookAhead(int kind)
           
protected  boolean lookAhead(int kind1, int kind2)
           
protected  boolean lookAheadOneOf(int kind1, int kind2)
           
protected  boolean lookAheadOneOf(int kind1, int kind2, int kind3)
           
protected  boolean lookAheadOneOf(int kind1, int kind2, int kind3, int kind4)
           
protected  void MappingExpression()
           
protected  void MatchExpression()
           
abstract  void merge(ErrorListener listener)
           
protected  void Module()
           
protected  void MultiplicativeExpression()
           
protected  Name Name(Name name)
           
protected  void Namespace(Modifiers mods)
           
protected  NamespaceStatement NamespacePart(Modifiers mods, DefinitionStatement scope)
           
protected  void NewExpression()
           
protected  void ObjectConstruct(int role)
           
protected  void Parameter(ParameterListDeclaration parameters)
           
protected  void ParameterList(ParameterListDeclaration parameters)
           
protected  void parse()
           
protected  void parseError(ParseException e)
           
protected  Token peek()
           
protected  Token peek(int ahead)
           
protected  int peekKind()
           
protected  int peekKind(int ahead)
           
protected  void PipeExpression()
           
protected  Node pop()
           
protected  void PostfixExpression()
           
protected  void Pragma()
           
protected  void Primary()
           
protected  void PrintStatement()
           
protected  void push(Node node)
           
protected  void QuotedWords()
           
protected  void RangeExpression()
           
protected  void RelationalExpression()
           
protected  void ReturnStatement()
           
protected  boolean scan(ParserBase.Scanner scanner)
           
protected  boolean scan(ParserBase.Scanner scanner, int skipAhead)
           
 int scanForModified()
           
protected  void StandaloneStatements()
           
protected  void Statement()
           
protected  void StatementModifier(Statement stmt)
           
protected  void Statements()
           
protected  void SwitchStatement(java.lang.String label)
           
protected  void Symbol()
           
protected  void Symbol(int role)
           
protected  void SynchronizedStatement()
           
protected  ParseException syntaxError(java.lang.String expected)
           
protected  void TerminalArgumentList()
           
protected  void TerminalAssignableExpression()
           
protected  void TerminalAssignmentExpression()
           
protected  void TerminalExpression()
           
protected  Expression[] TerminalForeachAssignmentExpression()
           
protected  java.lang.Object[] TerminalForExpressionList()
           
protected  void TerminalFunctionParameterList(ParameterListDeclaration parameters)
           
protected  void TerminalList()
           
protected  void TerminalValueExpression()
           
protected  void ThrowStatement()
           
abstract  Location toLocation(int line, int column)
           
 Location toLocation(Token t)
           
protected  void TryStatement()
           
protected  void UnaryExpression()
           
protected  void ValueExpression()
           
protected  void Variable(Modifiers mods)
           
protected  void VariablePart(Modifiers mods)
           
protected  void WhileStatement(java.lang.String label)
           
protected  void YieldStatement()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEMICOLON_SCANNER

protected static final ParserBase.Scanner SEMICOLON_SCANNER

_tokenizer

protected Tokenizer _tokenizer

_token

protected Token _token

_statement

protected Statement _statement

_nodes

protected NodeStack _nodes

ASSIGNMENT_SCANNER

protected static ParserBase.Scanner ASSIGNMENT_SCANNER
Constructor Detail

ParserBase

protected ParserBase(Tokenizer tokenizer)
Method Detail

getSourceFile

public abstract SourceFile getSourceFile()
Specified by:
getSourceFile in interface ParserInterface

getEnvelope

public abstract ModuleEnvelope getEnvelope()
Specified by:
getEnvelope in interface ParserInterface

toLocation

public abstract Location toLocation(int line,
                                    int column)
Specified by:
toLocation in interface ParserInterface

error

public abstract void error(Location location,
                           java.lang.Throwable throwable)
Specified by:
error in interface ErrorListener

error

public abstract void error(Location location,
                           java.lang.String message)
Specified by:
error in interface ErrorListener

errors

public abstract int errors()
Specified by:
errors in interface ErrorListener

getEvents

public abstract java.util.Iterator getEvents()
Specified by:
getEvents in interface ErrorListener

merge

public abstract void merge(ErrorListener listener)
Specified by:
merge in interface ErrorListener

toLocation

public final Location toLocation(Token t)

getCurrentStatement

public Statement getCurrentStatement()
Specified by:
getCurrentStatement in interface ParserInterface

flowPushChild

protected final void flowPushChild(Statement stmt)

flowPush

protected final void flowPush(Statement stmt)

flowPop

protected final Statement flowPop()

flowPeek

protected final Statement flowPeek()

getEnclosingTryBlock

protected final TryStatement getEnclosingTryBlock()

push

protected final void push(Node node)

pop

protected final Node pop()

eat

protected final Token eat()

peek

protected final Token peek()

lookAhead

protected final boolean lookAhead(int kind)

lookAheadOneOf

protected final boolean lookAheadOneOf(int kind1,
                                       int kind2)

lookAheadOneOf

protected final boolean lookAheadOneOf(int kind1,
                                       int kind2,
                                       int kind3)

lookAheadOneOf

protected final boolean lookAheadOneOf(int kind1,
                                       int kind2,
                                       int kind3,
                                       int kind4)

lookAhead

protected final boolean lookAhead(int kind1,
                                  int kind2)

peekKind

protected final int peekKind()

peek

protected final Token peek(int ahead)

peekKind

protected final int peekKind(int ahead)

eat

protected final Token eat(int kind)
                   throws ParseException
ParseException

eatIf

protected final boolean eatIf(int kind)

errorYank

protected final void errorYank()

parseError

protected final void parseError(ParseException e)

syntaxError

protected final ParseException syntaxError(java.lang.String expected)
                                    throws ParseException
ParseException

eof

protected final ParseException eof()

scan

protected final boolean scan(ParserBase.Scanner scanner)

scan

protected final boolean scan(ParserBase.Scanner scanner,
                             int skipAhead)

scanForModified

public final int scanForModified()

eatModifiers

public final Modifiers eatModifiers(Modifiers allowed)
                             throws ParseException
ParseException

parse

protected void parse()
              throws ParseException
ParseException

Module

protected void Module()
               throws ParseException
ParseException

Declarations

protected void Declarations(int endMarker)
                     throws ParseException
ParseException

Pragma

protected void Pragma()
               throws ParseException
ParseException

Import

protected void Import()
               throws ParseException
ParseException

EntitiesToImport

protected Name[] EntitiesToImport()
                           throws ParseException
ParseException

EntityToImport

protected Name EntityToImport()
                       throws ParseException
ParseException

NamespacePart

protected NamespaceStatement NamespacePart(Modifiers mods,
                                           DefinitionStatement scope)
                                    throws ParseException
ParseException

Namespace

protected void Namespace(Modifiers mods)
                  throws ParseException
ParseException

EntityRef

protected LinkNode EntityRef()
                      throws ParseException
ParseException

Class

protected void Class(Modifiers mods)
              throws ParseException
ParseException

ClassDeclarations

protected void ClassDeclarations()
                          throws ParseException
ParseException

InterfaceRef

protected void InterfaceRef(java.util.List interfaces)
                     throws ParseException
ParseException

Interfaces

protected InterfaceRef[] Interfaces()
                             throws ParseException
ParseException

Interface

protected void Interface(Modifiers mods)
                  throws ParseException
ParseException

InterfaceDeclarations

protected void InterfaceDeclarations()
                              throws ParseException
ParseException

InterfaceMethod

protected void InterfaceMethod(Modifiers mods)
                        throws ParseException
ParseException

Constant

protected void Constant(Modifiers mods)
                 throws ParseException
ParseException

ConstantPart

protected void ConstantPart(Modifiers mods)
                     throws ParseException
ParseException

Variable

protected void Variable(Modifiers mods)
                 throws ParseException
ParseException

VariablePart

protected void VariablePart(Modifiers mods)
                     throws ParseException
ParseException

Function

protected void Function(Modifiers mods)
                 throws ParseException
ParseException

InlineFunction

protected void InlineFunction()
                       throws ParseException
ParseException

ParameterList

protected void ParameterList(ParameterListDeclaration parameters)
                      throws ParseException
ParseException

Parameter

protected void Parameter(ParameterListDeclaration parameters)
                  throws ParseException
ParseException

Statements

protected void Statements()
                   throws ParseException
ParseException

Statement

protected void Statement()
                  throws ParseException
ParseException

isExpressionStart

protected boolean isExpressionStart(Token t)

PrintStatement

protected void PrintStatement()
                       throws ParseException
ParseException

ExpressionStatement

protected void ExpressionStatement()
                            throws ParseException
ParseException

BreakStatement

protected void BreakStatement()
                       throws ParseException
ParseException

ContinueStatement

protected void ContinueStatement()
                          throws ParseException
ParseException

ReturnStatement

protected void ReturnStatement()
                        throws ParseException
ParseException

YieldStatement

protected void YieldStatement()
                       throws ParseException
ParseException

ThrowStatement

protected void ThrowStatement()
                       throws ParseException
ParseException

ExitStatement

protected void ExitStatement()
                      throws ParseException
ParseException

AssertStatement

protected void AssertStatement()
                        throws ParseException
ParseException

StatementModifier

protected void StatementModifier(Statement stmt)
                          throws ParseException
ParseException

TryStatement

protected void TryStatement()
                     throws ParseException
ParseException

CatchStatement

protected void CatchStatement(TryStatement trystmt)
                       throws ParseException
ParseException

FinallyStatement

protected void FinallyStatement(TryStatement trystmt)
                         throws ParseException
ParseException

SynchronizedStatement

protected void SynchronizedStatement()
                              throws ParseException
ParseException

ForStatement

protected void ForStatement(java.lang.String label)
                     throws ParseException
ParseException

ForExpressionList

protected java.lang.Object[] ForExpressionList()
                                        throws ParseException
ParseException

ForeachStatement

protected void ForeachStatement(java.lang.String label)
                         throws ParseException
ParseException

ForeachHeader

protected ForeachStatement ForeachHeader(Statement parent,
                                         java.lang.String label)
                                  throws ParseException
ParseException

ForeachExpressions

protected Expression[] ForeachExpressions()
                                   throws ParseException
ParseException

SwitchStatement

protected void SwitchStatement(java.lang.String label)
                        throws ParseException
ParseException

Case

protected void Case(SwitchStatement stmt)
             throws ParseException
ParseException

Default

protected void Default(SwitchStatement stmt)
                throws ParseException
ParseException

BlockStatement

protected void BlockStatement(java.lang.String label)
                       throws ParseException
ParseException

IfStatement

protected void IfStatement()
                    throws ParseException
ParseException

WhileStatement

protected void WhileStatement(java.lang.String label)
                       throws ParseException
ParseException

DoStatement

protected void DoStatement(java.lang.String label)
                    throws ParseException
ParseException

Expression

protected void Expression()
                   throws ParseException
ParseException

ListExpression

protected void ListExpression()
                       throws ParseException
ParseException

AssignableExpression

protected void AssignableExpression()
                             throws ParseException
ParseException

EtSymbol

protected void EtSymbol()
                 throws ParseException
ParseException

AssignmentExpression

protected void AssignmentExpression()
                             throws ParseException
ParseException

ValueExpression

protected void ValueExpression()
                        throws ParseException
ParseException

ExpressionStart

protected void ExpressionStart()
                        throws ParseException
ParseException

ForeachExpression

protected void ForeachExpression()
                          throws ParseException
ParseException

PipeExpression

protected void PipeExpression()
                       throws ParseException
ParseException

MappingExpression

protected void MappingExpression()
                          throws ParseException
ParseException

ConditionalExpression

protected void ConditionalExpression()
                              throws ParseException
ParseException

RangeExpression

protected void RangeExpression()
                        throws ParseException
ParseException

LogicalORExpression

protected void LogicalORExpression()
                            throws ParseException
ParseException

LogicalXORExpression

protected void LogicalXORExpression()
                             throws ParseException
ParseException

LogicalAndExpression

protected void LogicalAndExpression()
                             throws ParseException
ParseException

EqualityExpression

protected void EqualityExpression()
                           throws ParseException
ParseException

RelationalExpression

protected void RelationalExpression()
                             throws ParseException
ParseException

InExpression

protected void InExpression()
                     throws ParseException
ParseException

AdditiveExpression

protected void AdditiveExpression()
                           throws ParseException
ParseException

MultiplicativeExpression

protected void MultiplicativeExpression()
                                 throws ParseException
ParseException

MatchExpression

protected void MatchExpression()
                        throws ParseException
ParseException

UnaryExpression

protected void UnaryExpression()
                        throws ParseException
ParseException

PostfixExpression

protected void PostfixExpression()
                          throws ParseException
ParseException

IsExpression

protected void IsExpression()
                     throws ParseException
ParseException

LazyExpression

protected void LazyExpression()
                       throws ParseException
ParseException

Primary

protected void Primary()
                throws ParseException
ParseException

Name

protected Name Name(Name name)
             throws ParseException
ParseException

NewExpression

protected void NewExpression()
                      throws ParseException
ParseException

Symbol

protected void Symbol()
               throws ParseException
ParseException

Symbol

protected void Symbol(int role)
               throws ParseException
ParseException

ObjectConstruct

protected void ObjectConstruct(int role)
                        throws ParseException
ParseException

List

protected void List(boolean forcelist,
                    boolean mutable)
             throws ParseException
ParseException

Comprehension

protected void Comprehension(ComprehensionNode compr,
                             Statement root,
                             Statement parent)
                      throws ParseException
ParseException

ComprehensionIf

protected void ComprehensionIf(ComprehensionNode compr,
                               Statement root,
                               Statement parent)
                        throws ParseException
ParseException

ComprehensionForeach

protected void ComprehensionForeach(ComprehensionNode compr,
                                    Statement root,
                                    Statement parent)
                             throws ParseException
ParseException

ListConstruct

protected void ListConstruct()
                      throws ParseException
ParseException

QuotedWords

protected void QuotedWords()
                    throws ParseException
ParseException

ArrayConstruct

protected void ArrayConstruct()