Search in sources :

Example 1 with TypeNode

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

the class GenericTypeVariableNode method innerSourceOn_.

@Override
public GenericTypeVariableNode innerSourceOn_(final StringBuilder _aStream) {
    _root.sourceOn_(_aStream);
    _aStream.append('[');
    boolean _temp1 = true;
    for (final TypeNode _arg : _arguments) {
        if (_temp1) {
            _temp1 = false;
        } else {
            _aStream.append(", ");
        }
        _arg.sourceOn_(_aStream);
    }
    _aStream.append(']');
    return this;
}
Also used : TypeNode(st.gravel.support.compiler.ast.TypeNode)

Example 2 with TypeNode

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

the class BlockTypeNode method innerSourceOn_.

@Override
public BlockTypeNode innerSourceOn_(final StringBuilder _aStream) {
    _aStream.append('[');
    boolean _temp1 = true;
    for (final TypeNode _arg : _arguments) {
        if (_temp1) {
            _temp1 = false;
        } else {
            _aStream.append(", ");
        }
        _arg.sourceOn_(_aStream);
    }
    if (_returnType != null) {
        if (_arguments.length != 0) {
            _aStream.append(", ");
        }
        _aStream.append('^');
        _returnType.sourceOn_(_aStream);
    }
    _aStream.append(']');
    return this;
}
Also used : TypeNode(st.gravel.support.compiler.ast.TypeNode)

Example 3 with TypeNode

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

the class Parser method parseTypeExpressionBlockAndClose.

public BlockTypeNode parseTypeExpressionBlockAndClose() {
    TypeNode[] _args;
    TypeNode _returnType;
    _args = new TypeNode[] {};
    _returnType = null;
    boolean _temp1 = true;
    while (_temp1) {
        Parser.this.eatWhitespace();
        if (st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, '^')) {
            _returnType = Parser.this.parseTypeNode();
        } else {
            _args = st.gravel.support.jvm.ArrayExtensions.copyWith_(_args, Parser.this.parseTypeNode());
        }
        Parser.this.eatWhitespace();
        _temp1 = st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, ',');
    }
    st.gravel.support.jvm.ObjectExtensions.assert_(this, st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, ']'));
    return BlockTypeNode.factory.arguments_returnType_(_args, _returnType);
}
Also used : BlockTypeNode(st.gravel.support.compiler.ast.BlockTypeNode) SelfTypeNode(st.gravel.support.compiler.ast.SelfTypeNode) InstanceTypeNode(st.gravel.support.compiler.ast.InstanceTypeNode) TypeNode(st.gravel.support.compiler.ast.TypeNode)

Example 4 with TypeNode

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

the class Parser method parseTypeExpressionAndClose.

public TypeNode parseTypeExpressionAndClose() {
    final TypeNode _exp;
    _exp = this.parseTypeNode();
    st.gravel.support.jvm.ObjectExtensions.assert_(this, st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, '}'));
    return _exp;
}
Also used : BlockTypeNode(st.gravel.support.compiler.ast.BlockTypeNode) SelfTypeNode(st.gravel.support.compiler.ast.SelfTypeNode) InstanceTypeNode(st.gravel.support.compiler.ast.InstanceTypeNode) TypeNode(st.gravel.support.compiler.ast.TypeNode)

Example 5 with TypeNode

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

the class Parser method parseVariableDeclaration.

public VariableDeclarationNode parseVariableDeclaration() {
    final String _varName;
    TypeNode _type;
    int _wsWidth;
    final int _start;
    _start = st.gravel.support.jvm.ReadStreamExtensions.position(_stream);
    _varName = this.parseIdentifier();
    this.eatWhitespace();
    _type = null;
    if (st.gravel.support.jvm.CharacterExtensions.equals_(st.gravel.support.jvm.ReadStreamExtensions.peek(_stream), '{')) {
        st.gravel.support.jvm.ReadStreamExtensions.next(_stream);
        _wsWidth = Parser.this.eatWhitespace();
        if (st.gravel.support.jvm.CharacterExtensions.equals_(st.gravel.support.jvm.ReadStreamExtensions.peek(_stream), '^')) {
            st.gravel.support.jvm.ReadStreamExtensions.skip_(_stream, (-1 - _wsWidth));
        } else {
            _type = Parser.this.parseTypeExpressionAndClose();
        }
    }
    return ((VariableDeclarationNode) this.setSourcePosition_node_(_start, VariableDeclarationNode.factory.name_type_(_varName, _type)));
}
Also used : BlockTypeNode(st.gravel.support.compiler.ast.BlockTypeNode) SelfTypeNode(st.gravel.support.compiler.ast.SelfTypeNode) InstanceTypeNode(st.gravel.support.compiler.ast.InstanceTypeNode) TypeNode(st.gravel.support.compiler.ast.TypeNode)

Aggregations

TypeNode (st.gravel.support.compiler.ast.TypeNode)15 BlockTypeNode (st.gravel.support.compiler.ast.BlockTypeNode)12 InstanceTypeNode (st.gravel.support.compiler.ast.InstanceTypeNode)12 SelfTypeNode (st.gravel.support.compiler.ast.SelfTypeNode)12 ArrayList (java.util.ArrayList)4 List (java.util.List)4 PragmaNode (st.gravel.support.compiler.ast.PragmaNode)4 VariableDeclarationNode (st.gravel.support.compiler.ast.VariableDeclarationNode)4 SequenceNode (st.gravel.support.compiler.ast.SequenceNode)3 TypeCast (st.gravel.support.compiler.ast.TypeCast)3 BottomTypeNode (st.gravel.support.compiler.ast.BottomTypeNode)2 ClassTypeNode (st.gravel.support.compiler.ast.ClassTypeNode)2 BlockNode (st.gravel.support.compiler.ast.BlockNode)1 Expression (st.gravel.support.compiler.ast.Expression)1 Statement (st.gravel.support.compiler.ast.Statement)1