gnu.ecmascript
Class Parser

java.lang.Object
  extended by gnu.ecmascript.Parser

public class Parser
extends java.lang.Object


Field Summary
static Expression[] emptyArgs
           
static Expression eofExpr
           
 int errors
           
 
Constructor Summary
Parser(InPort port)
           
 
Method Summary
 Expression buildLoop(Expression init, Expression test, Expression incr, Expression body)
           
 java.lang.String getIdentifier()
           
 void getSemicolon()
          Skip an explicit or implicit semicolon.
 java.lang.Object getToken()
           
static void main(java.lang.String[] args)
           
 Expression makeCallExpression(Expression exp, Expression[] args)
           
 Expression makeNewExpression(Expression exp, Expression[] args)
           
 Expression makePropertyAccessor(Expression exp, Expression prop)
           
 Expression[] parseArguments()
           
 Expression parseAssignmentExpression()
           
 Expression parseBinaryExpression(int prio)
           
 Expression parseBlock()
           
 Expression parseConditionalExpression()
           
 Expression parseExpression()
           
 Expression parseFunctionDefinition()
           
 Expression parseIfStatement()
           
 Expression parseLeftHandSideExpression()
           
 Expression parsePostfixExpression()
           
 Expression parsePrimaryExpression()
           
 Expression parseStatement()
           
 Expression parseUnaryExpression()
           
 Expression parseWhileStatement()
           
 java.lang.Object peekToken()
          Return the next non-whitespace token from the lexer.
 java.lang.Object peekTokenOrLine()
          Return the next token from the lexer.
 void skipToken()
           
 Expression syntaxError(java.lang.String message)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eofExpr

public static Expression eofExpr

emptyArgs

public static final Expression[] emptyArgs

errors

public int errors
Constructor Detail

Parser

public Parser(InPort port)
Method Detail

parseConditionalExpression

public Expression parseConditionalExpression()
                                      throws java.io.IOException,
                                             SyntaxException
Throws:
java.io.IOException
SyntaxException

parseAssignmentExpression

public Expression parseAssignmentExpression()
                                     throws java.io.IOException,
                                            SyntaxException
Throws:
java.io.IOException
SyntaxException

parseExpression

public Expression parseExpression()
                           throws java.io.IOException,
                                  SyntaxException
Throws:
java.io.IOException
SyntaxException

peekTokenOrLine

public java.lang.Object peekTokenOrLine()
                                 throws java.io.IOException,
                                        SyntaxException
Return the next token from the lexer. A LineTerminator is considered a token.

Throws:
java.io.IOException
SyntaxException

peekToken

public java.lang.Object peekToken()
                           throws java.io.IOException,
                                  SyntaxException
Return the next non-whitespace token from the lexer. LineTerminators are skipped until a non-eolToken is found.

Throws:
java.io.IOException
SyntaxException

getToken

public java.lang.Object getToken()
                          throws java.io.IOException,
                                 SyntaxException
Throws:
java.io.IOException
SyntaxException

skipToken

public final void skipToken()

getSemicolon

public void getSemicolon()
                  throws java.io.IOException,
                         SyntaxException
Skip an explicit or implicit semicolon.

Throws:
java.io.IOException
SyntaxException

parsePrimaryExpression

public Expression parsePrimaryExpression()
                                  throws java.io.IOException,
                                         SyntaxException
Throws:
java.io.IOException
SyntaxException

makePropertyAccessor

public Expression makePropertyAccessor(Expression exp,
                                       Expression prop)

parseArguments

public Expression[] parseArguments()
                            throws java.io.IOException,
                                   SyntaxException
Throws:
java.io.IOException
SyntaxException

makeNewExpression

public Expression makeNewExpression(Expression exp,
                                    Expression[] args)

makeCallExpression

public Expression makeCallExpression(Expression exp,
                                     Expression[] args)

getIdentifier

public java.lang.String getIdentifier()
                               throws java.io.IOException,
                                      SyntaxException
Throws:
java.io.IOException
SyntaxException

parseLeftHandSideExpression

public Expression parseLeftHandSideExpression()
                                       throws java.io.IOException,
                                              SyntaxException
Throws:
java.io.IOException
SyntaxException

parsePostfixExpression

public Expression parsePostfixExpression()
                                  throws java.io.IOException,
                                         SyntaxException
Throws:
java.io.IOException
SyntaxException

parseUnaryExpression

public Expression parseUnaryExpression()
                                throws java.io.IOException,
                                       SyntaxException
Throws:
java.io.IOException
SyntaxException

syntaxError

public Expression syntaxError(java.lang.String message)

parseBinaryExpression

public Expression parseBinaryExpression(int prio)
                                 throws java.io.IOException,
                                        SyntaxException
Throws:
java.io.IOException
SyntaxException

parseIfStatement

public Expression parseIfStatement()
                            throws java.io.IOException,
                                   SyntaxException
Throws:
java.io.IOException
SyntaxException

buildLoop

public Expression buildLoop(Expression init,
                            Expression test,
                            Expression incr,
                            Expression body)

parseWhileStatement

public Expression parseWhileStatement()
                               throws java.io.IOException,
                                      SyntaxException
Throws:
java.io.IOException
SyntaxException

parseFunctionDefinition

public Expression parseFunctionDefinition()
                                   throws java.io.IOException,
                                          SyntaxException
Throws:
java.io.IOException
SyntaxException

parseBlock

public Expression parseBlock()
                      throws java.io.IOException,
                             SyntaxException
Throws:
java.io.IOException
SyntaxException

parseStatement

public Expression parseStatement()
                          throws java.io.IOException,
                                 SyntaxException
Throws:
java.io.IOException
SyntaxException

main

public static void main(java.lang.String[] args)