Search in sources :

Example 1 with LiteralNode

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

the class ArrayLiteralNode method innerSourceOn_.

@Override
public ArrayLiteralNode innerSourceOn_(final StringBuilder _aStream) {
    _aStream.append("#(");
    boolean _temp1 = true;
    for (final LiteralNode _each : _elements) {
        if (_temp1) {
            _temp1 = false;
        } else {
            _aStream.append(' ');
        }
        _each.sourceOn_(_aStream);
    }
    _aStream.append(')');
    return this;
}
Also used : LiteralNode(st.gravel.support.compiler.ast.LiteralNode)

Example 2 with LiteralNode

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

the class SourcePrinter method visitArrayLiteralNode_.

@Override
public SourcePrinter visitArrayLiteralNode_(final ArrayLiteralNode _anObject) {
    _stream.append("#(");
    boolean _temp1 = true;
    for (final LiteralNode _each : _anObject.elements()) {
        if (_temp1) {
            _temp1 = false;
        } else {
            _stream.append(' ');
        }
        SourcePrinter.this.visit_(_each);
    }
    _stream.append(')');
    return this;
}
Also used : CharacterLiteralNode(st.gravel.support.compiler.ast.CharacterLiteralNode) NilLiteralNode(st.gravel.support.compiler.ast.NilLiteralNode) LiteralNode(st.gravel.support.compiler.ast.LiteralNode) ReferenceLiteralNode(st.gravel.support.compiler.ast.ReferenceLiteralNode) SymbolLiteralNode(st.gravel.support.compiler.ast.SymbolLiteralNode) ByteArrayLiteralNode(st.gravel.support.compiler.ast.ByteArrayLiteralNode) IntegerLiteralNode(st.gravel.support.compiler.ast.IntegerLiteralNode) ArrayLiteralNode(st.gravel.support.compiler.ast.ArrayLiteralNode) FloatLiteralNode(st.gravel.support.compiler.ast.FloatLiteralNode) BooleanLiteralNode(st.gravel.support.compiler.ast.BooleanLiteralNode) DoubleLiteralNode(st.gravel.support.compiler.ast.DoubleLiteralNode) StringLiteralNode(st.gravel.support.compiler.ast.StringLiteralNode) FixedPointLiteralNode(st.gravel.support.compiler.ast.FixedPointLiteralNode)

Example 3 with LiteralNode

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

the class MethodNode method pragmaPropertyAt_ifAbsent_.

public Object pragmaPropertyAt_ifAbsent_(final st.gravel.core.Symbol _aKey, final st.gravel.support.jvm.Block0<Object> _aBlock) {
    final Object _temp1 = new Object();
    try {
        final PragmaNode _pr;
        _pr = ((PragmaNode) st.gravel.support.jvm.ArrayExtensions.detect_ifNone_(_pragmas, new st.gravel.support.jvm.Predicate1<PragmaNode>() {

            @Override
            public boolean value_(final PragmaNode _each) {
                return _each.isPropertyPragmaAt_(_aKey);
            }
        }, ((st.gravel.support.jvm.Block0<PragmaNode>) (new st.gravel.support.jvm.Block0<PragmaNode>() {

            @Override
            public PragmaNode value() {
                throw new NonLocalReturn(_aBlock.value(), _temp1);
            }
        }))));
        return ((LiteralNode) _pr.expression().arguments()[1]).value();
    } catch (NonLocalReturn nlr) {
        if (nlr.marker == _temp1) {
            return (Object) nlr.returnValue;
        } else {
            throw nlr;
        }
    }
}
Also used : NilLiteralNode(st.gravel.support.compiler.ast.NilLiteralNode) LiteralNode(st.gravel.support.compiler.ast.LiteralNode) SymbolLiteralNode(st.gravel.support.compiler.ast.SymbolLiteralNode) StringLiteralNode(st.gravel.support.compiler.ast.StringLiteralNode) ArrayLiteralNode(st.gravel.support.compiler.ast.ArrayLiteralNode) PragmaNode(st.gravel.support.compiler.ast.PragmaNode) NonLocalReturn(st.gravel.support.jvm.NonLocalReturn)

Aggregations

LiteralNode (st.gravel.support.compiler.ast.LiteralNode)3 ArrayLiteralNode (st.gravel.support.compiler.ast.ArrayLiteralNode)2 NilLiteralNode (st.gravel.support.compiler.ast.NilLiteralNode)2 StringLiteralNode (st.gravel.support.compiler.ast.StringLiteralNode)2 SymbolLiteralNode (st.gravel.support.compiler.ast.SymbolLiteralNode)2 BooleanLiteralNode (st.gravel.support.compiler.ast.BooleanLiteralNode)1 ByteArrayLiteralNode (st.gravel.support.compiler.ast.ByteArrayLiteralNode)1 CharacterLiteralNode (st.gravel.support.compiler.ast.CharacterLiteralNode)1 DoubleLiteralNode (st.gravel.support.compiler.ast.DoubleLiteralNode)1 FixedPointLiteralNode (st.gravel.support.compiler.ast.FixedPointLiteralNode)1 FloatLiteralNode (st.gravel.support.compiler.ast.FloatLiteralNode)1 IntegerLiteralNode (st.gravel.support.compiler.ast.IntegerLiteralNode)1 PragmaNode (st.gravel.support.compiler.ast.PragmaNode)1 ReferenceLiteralNode (st.gravel.support.compiler.ast.ReferenceLiteralNode)1 NonLocalReturn (st.gravel.support.jvm.NonLocalReturn)1