Package com.google.minijoe.compiler.ast

Examples of com.google.minijoe.compiler.ast.Identifier


    return new BlockStatement(Util.vectorToStatementArray(vector));
  }

  private Statement parseBreakStatement() throws CompilerException {
    Identifier identifier = null;

    readToken(Token.KEYWORD_BREAK);

    if (nextToken != Token.OPERATOR_SEMICOLON) {
      identifier = parseIdentifier();
View Full Code Here


    return new BreakStatement(identifier);
  }

  private Statement parseContinueStatement() throws CompilerException {
    Identifier identifier = null;

    readToken(Token.KEYWORD_CONTINUE);

    if (nextToken != Token.OPERATOR_SEMICOLON) {
      identifier = parseIdentifier();
View Full Code Here

    return new ThrowStatement(parseExpression(true));
  }

  private Statement parseTryStatement() throws CompilerException {
    Statement tryBlock = null;
    Identifier catchIdentifier = null;
    Statement catchBlock = null;
    Statement finallyBlock = null;

    readToken(Token.KEYWORD_TRY);
    tryBlock = parseBlockStatement();
View Full Code Here

  //
  // Expressions
  //

  private VariableDeclaration parseVariableDeclaration(boolean inFlag) throws CompilerException {
    Identifier identifier = parseIdentifier();
    Expression initializer = null;

    if (nextToken == Token.OPERATOR_ASSIGNMENT) {
      readToken(Token.OPERATOR_ASSIGNMENT);
      initializer = parseAssignmentExpression(inFlag);
View Full Code Here

        readToken(Token.OPERATOR_CLOSESQUARE);
        expression = new PropertyExpression(expression, property);
      } else if (nextToken == Token.OPERATOR_DOT) {
        // transform x.bar to x["bar"]
        readToken(Token.OPERATOR_DOT);
        Identifier identifier = parseIdentifier();
        expression = new PropertyExpression(expression, new StringLiteral(identifier.string));
      } else {
        return expression;
      }
    }
View Full Code Here

    return new ArrayLiteral(Util.vectorToExpressionArray(arrayElements));
  }

  private FunctionLiteral parseFunctionLiteral(boolean nameFlag) throws CompilerException {
    Identifier name = null;
    Vector parameterVector = new Vector();
    Vector statementVector = new Vector();

    readToken(Token.KEYWORD_FUNCTION);
View Full Code Here

    return new ObjectLiteralProperty(propertyName, propertyValue);
  }

  private Identifier parseIdentifier() throws CompilerException {
    Identifier identifier = null;

    if (nextToken.getType() == Token.TYPE_IDENTIFIER) {
      identifier = new Identifier(nextToken.getValue());
    } else {
      throwCompilerException("identifier or numeric literal expected");
    }

    readToken();
View Full Code Here

    this.globalStringTable = parent.globalStringTable;
    this.dos = dos;
    this.enableLocalsOptimization = function.enableLocalsOptimization;

    for (int i = 0; i < function.variables.length; i++) {
      Identifier variable = function.variables[i];
      addToGlobalStringTable(variable.string);
      localVariableTable.put(variable, variable);
    }

    for (int i = 0; i < function.variables.length; i++) {
View Full Code Here

  public Expression visit(Identifier identifier) throws CompilerException {
    Expression pa = pendingAssignment;
    pendingAssignment = null;

    Identifier localVariable = (Identifier) localVariableTable.get(identifier);

    if (localVariable != null) {
      identifier = localVariable;
    }
View Full Code Here

    return result;
  }

  public Expression visit(VariableDeclaration declaration) throws CompilerException {
    Identifier identifier = visitIdentifier(declaration.identifier);
    Expression initializer = visitExpression(declaration.initializer);
    Expression result = null;

    if (variableVector != null) {
      addVariable(identifier);
View Full Code Here

TOP

Related Classes of com.google.minijoe.compiler.ast.Identifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.