Search in sources :

Example 21 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class Parser method parseExpression.

public Expression parseExpression() {
    final Expression _receiver;
    final int _start;
    _start = st.gravel.support.jvm.ReadStreamExtensions.position(_stream);
    this.eatWhitespace();
    _receiver = this.parseOperand();
    return ((Expression) this.setSourcePosition_node_(_start, this.parseMessageChain_(((Expression) this.setSourcePosition_node_(_start, _receiver)))));
}
Also used : Expression(st.gravel.support.compiler.ast.Expression)

Example 22 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class KeywordMessageNode method innerSourceSendOn_.

@Override
public KeywordMessageNode innerSourceSendOn_(final StringBuilder _aStream) {
    final String[] _keywords;
    _keywords = st.gravel.support.jvm.StringExtensions.tokensBasedOn_(_selector, ':');
    for (int _i = 1; _i <= _arguments.length; _i++) {
        final String _keyword;
        final Expression _argument;
        _keyword = _keywords[_i - 1];
        _argument = _arguments[_i - 1];
        if (!st.gravel.support.jvm.IntegerExtensions.equals_(_i, 1)) {
            _aStream.append(' ');
        }
        _aStream.append(_keyword);
        _aStream.append(':');
        _aStream.append(' ');
        _argument.sourceOn_(_aStream);
    }
    return this;
}
Also used : Expression(st.gravel.support.compiler.ast.Expression)

Example 23 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class LiteralSendInliner method visitNonLocalReturnNode_.

@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));
}
Also used : Expression(st.gravel.support.compiler.ast.Expression) Statement(st.gravel.support.compiler.ast.Statement)

Example 24 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class InlineExpressionCollection method innerSourceOn_.

@Override
public InlineExpressionCollection innerSourceOn_(final StringBuilder _aStream) {
    _aStream.append("{");
    boolean _temp1 = true;
    for (final Expression _each : _expressions) {
        if (_temp1) {
            _temp1 = false;
        } else {
            _aStream.append(". ");
        }
        _each.innerSourceOn_(_aStream);
    }
    _aStream.append("]}");
    return this;
}
Also used : Expression(st.gravel.support.compiler.ast.Expression)

Example 25 with Expression

use of st.gravel.support.compiler.ast.Expression in project gravel by gravel-st.

the class IntermediateNodeRewriter method produce_or_.

public BooleanOrNode produce_or_(final Node _receiver, final Expression _testExpr) {
    final BlockNode _testBlockNode;
    if (!_testExpr.isBlockNode()) {
        return null;
    }
    _testBlockNode = ((BlockNode) _testExpr);
    return BooleanOrNode.factory.left_right_(((Expression) this.visit_(_receiver)), ((SequenceNode) this.visit_(_testBlockNode.body())));
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) Expression(st.gravel.support.compiler.ast.Expression) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Aggregations

Expression (st.gravel.support.compiler.ast.Expression)25 SequenceNode (st.gravel.support.compiler.ast.SequenceNode)7 BlockNode (st.gravel.support.compiler.ast.BlockNode)6 ArrayList (java.util.ArrayList)3 BinaryMessageNode (st.gravel.support.compiler.ast.BinaryMessageNode)3 MessageNode (st.gravel.support.compiler.ast.MessageNode)3 Statement (st.gravel.support.compiler.ast.Statement)3 VariableDeclarationNode (st.gravel.support.compiler.ast.VariableDeclarationNode)3 ArrayLiteralNode (st.gravel.support.compiler.ast.ArrayLiteralNode)2 StringLiteralNode (st.gravel.support.compiler.ast.StringLiteralNode)2 List (java.util.List)1 ArrayAtNode (st.gravel.support.compiler.ast.ArrayAtNode)1 ArrayAtPutNode (st.gravel.support.compiler.ast.ArrayAtPutNode)1 ArraySizeNode (st.gravel.support.compiler.ast.ArraySizeNode)1 BlockTypeNode (st.gravel.support.compiler.ast.BlockTypeNode)1 BooleanAndNode (st.gravel.support.compiler.ast.BooleanAndNode)1 BooleanLiteralNode (st.gravel.support.compiler.ast.BooleanLiteralNode)1 BooleanOrNode (st.gravel.support.compiler.ast.BooleanOrNode)1 ByteArrayLiteralNode (st.gravel.support.compiler.ast.ByteArrayLiteralNode)1 CascadeNode (st.gravel.support.compiler.ast.CascadeNode)1