Package st.gravel.support.compiler.ast

Examples of st.gravel.support.compiler.ast.Statement


  }

  public SequenceNode parseSequenceNode_(final st.gravel.support.jvm.Block1<Object, PragmaNode[]> _extraPragmaBlock) {
    VariableDeclarationNode[] _temporaries;
    Statement[] _statements;
    Statement _statement;
    final int _start;
    final PragmaNode[] _pragmas;
    _start = st.gravel.support.jvm.ReadStreamExtensions.position(_stream);
    this.eatWhitespace();
    _temporaries = new VariableDeclarationNode[] {};
View Full Code Here


    return this;
  }

  public SourcePrinter printStatements_indent_(final Statement[] _stmts, final boolean _aBoolean) {
    final int _show;
    Statement _thisStatement;
    boolean _indent;
    _indent = _aBoolean;
    _show = _stmts.length;
    for (int _i = 1; _i <= _show; _i++) {
      _thisStatement = _stmts[_i - 1];
      if ((_thisStatement.comment().length > 0)) {
        if (st.gravel.support.jvm.IntegerExtensions.equals_(_i, 1)) {
          SourcePrinter.this.crtab_(_indentation);
        }
        _stream.append('\t');
      }
View Full Code Here

  public Statement produceBlock_arguments_(final BlockNode _block, final Expression[] _arguments) {
    final SequenceNode[] _body;
    final Statement[] _stmts;
    final Expression[] _argTemps;
    final VariableNode _result;
    final Statement _lastStatement;
    _body = new SequenceNode[1];
    _body[0] = _block.body();
    if (_body[0].statements().length == 0) {
      return NilLiteralNode.factory.basicNew();
    }
    for (final VariableDeclarationNode _temp : _block.body().temporaries()) {
      _body[0] = ((SequenceNode) VariableRenamer.factory.in_rename_to_(_body[0], _temp.name(), LiteralSendInliner.this.newTempSuggestion_(_temp.name()).name()));
    }
    _argTemps = st.gravel.support.jvm.ArrayExtensions.collect_(_arguments, ((st.gravel.support.jvm.Block1<Expression, Expression>) (new st.gravel.support.jvm.Block1<Expression, Expression>() {

      @Override
      public Expression value_(final Expression _each) {
        if (_each.isVariableNode()) {
          return _each;
        } else {
          final VariableNode _t;
          _t = LiteralSendInliner.this.newTempSuggestion_("extract");
          LiteralSendInliner.this.extraEmit_(LocalWriteNode.factory.name_value_(_t.name(), _each));
          return _t;
        }
      }
    })));
    _stmts = _body[0].statements();
    int _temp1 = (_stmts.length - 1);
    for (int _i = 1; _i <= _temp1; _i++) {
      final Statement _stmt;
      _stmt = _stmts[_i - 1];
      LiteralSendInliner.this.extraEmit_(LiteralSendInliner.this.in_replaceAll_with_(_stmt, _block.arguments(), _argTemps));
    }
    _lastStatement = this.in_replaceAll_with_(_stmts[_stmts.length - 1], _block.arguments(), _argTemps);
    if (_lastStatement.isReturnNode()) {
View Full Code Here

    }));
  }

  @Override
  public Statement visitNonLocalReturnNode_(final NonLocalReturnNode _anObject) {
    Statement _value;
    _value = ((Statement) this.visit_(_anObject.value()));
    if (_value.isNonLocalReturnNode()) {
      return _value;
    }
    if (_value.isReturnNode()) {
      _value = _value.returnValue();
    }
    if ((_localNlrMarker != null) && st.gravel.support.jvm.StringExtensions.equals_(_localNlrMarker, _anObject.marker())) {
      return ReturnNode.factory.value_(((Expression) _value));
    }
    return NonLocalReturnNode.factory.marker_value_(_anObject.marker(), ((Expression) _value));
View Full Code Here

    return NonLocalReturnNode.factory.marker_value_(_anObject.marker(), ((Expression) _value));
  }

  @Override
  public Statement visitReturnNode_(final ReturnNode _anObject) {
    final Statement _value;
    _value = ((Statement) this.visit_(_anObject.value()));
    if (_value.isReturnNode()) {
      return _value;
    }
    return ReturnNode.factory.value_(((Expression) _value));
  }
View Full Code Here

      final VariableDeclarationNode _newTemp;
      _newTemp = ((VariableDeclarationNode) LiteralSendInliner.this.visit_(_each));
      _temporaries[0].add(_newTemp);
    }
    for (final Statement _each : _anObject.statements()) {
      final Statement _res;
      final List<Statement> _oldExtraEmits;
      _oldExtraEmits = _extraEmits;
      _oldExtraTemps[0] = _extraTemps;
      _extraEmits = new java.util.ArrayList();
      _extraTemps = new java.util.ArrayList();
View Full Code Here

    final st.gravel.support.jvm.Block1<Statement, MessageNode> _res;
    _selector = st.gravel.core.Symbol.value(_anObject.selector());
    st.gravel.support.jvm.Block1<Statement, MessageNode> _temp1 = _specialSelectors.get(_selector);
    _res = ((st.gravel.support.jvm.Block1<Statement, MessageNode>) _temp1);
    if (_res != null) {
      final Statement _trans;
      _trans = _res.value_(_anObject);
      if (_trans != null) {
        return _trans;
      }
    }
View Full Code Here

    final st.gravel.support.jvm.Block1<Statement, MessageNode> _res;
    _selector = st.gravel.core.Symbol.value(_anObject.selector());
    st.gravel.support.jvm.Block1<Statement, MessageNode> _temp1 = _specialSelectors.get(_selector);
    _res = ((st.gravel.support.jvm.Block1<Statement, MessageNode>) _temp1);
    if (_res != null) {
      final Statement _trans;
      _trans = _res.value_(_anObject);
      if (_trans != null) {
        return _trans;
      }
    }
View Full Code Here

    final st.gravel.support.jvm.Block1<Statement, MessageNode> _res;
    _selector = st.gravel.core.Symbol.value(_anObject.selector());
    st.gravel.support.jvm.Block1<Statement, MessageNode> _temp1 = _specialSelectors.get(_selector);
    _res = ((st.gravel.support.jvm.Block1<Statement, MessageNode>) _temp1);
    if (_res != null) {
      final Statement _trans;
      _trans = _res.value_(_anObject);
      if (_trans != null) {
        return _trans;
      }
    }
View Full Code Here

  public void initialize() {
  }

  @Test
  public void testAssignmentExpression() {
    final Statement _node;
    _node = Parser.factory.source_(" foo := 7 ").parseStatement();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), AssignmentNode.factory));
    assertEquals((String) "foo := 7", (String) _node.prettySourceString());
  }
View Full Code Here

TOP

Related Classes of st.gravel.support.compiler.ast.Statement

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.