Search in sources :

Example 11 with SequenceNode

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

the class Parser method parseKeywordMethod_.

public KeywordMethodNode parseKeywordMethod_(final String _aString) {
    String _res;
    final StringBuilder _str;
    final List<VariableDeclarationNode> _arguments;
    final SequenceNode _body;
    final TypeNode _returnType;
    final PragmaNode[][] _pragmas;
    _pragmas = new PragmaNode[1][];
    _str = st.gravel.support.jvm.WriteStreamFactory.on_(new String());
    _str.append(_aString);
    _str.append(':');
    _arguments = new java.util.ArrayList();
    this.eatWhitespace();
    _arguments.add(this.parseVariableDeclaration());
    this.eatWhitespace();
    _res = this.parseKeywordIdentifier();
    boolean _temp1 = false;
    while (!_temp1) {
        _temp1 = _res == null;
        if (!_temp1) {
            _str.append(_res);
            Parser.this.eatWhitespace();
            _arguments.add(Parser.this.parseVariableDeclaration());
            Parser.this.eatWhitespace();
            _res = Parser.this.parseKeywordIdentifier();
        }
    }
    _returnType = this.parseReturnType();
    _pragmas[0] = this.readPragmas();
    _body = this.parseSequenceNode_(new st.gravel.support.jvm.Block1<Object, PragmaNode[]>() {

        @Override
        public Object value_(final PragmaNode[] _extraPragmas) {
            return _pragmas[0] = st.gravel.support.jvm.ArrayExtensions.copyWithAll_(_pragmas[0], _extraPragmas);
        }
    });
    return KeywordMethodNode.factory.selector_arguments_body_returnType_pragmas_protocol_(_str.toString(), _arguments.toArray(new VariableDeclarationNode[_arguments.size()]), _body, _returnType, _pragmas[0], null);
}
Also used : TypeCast(st.gravel.support.compiler.ast.TypeCast) ArrayList(java.util.ArrayList) List(java.util.List) PragmaNode(st.gravel.support.compiler.ast.PragmaNode) SequenceNode(st.gravel.support.compiler.ast.SequenceNode) ArrayList(java.util.ArrayList) VariableDeclarationNode(st.gravel.support.compiler.ast.VariableDeclarationNode) 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 12 with SequenceNode

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

the class IntermediateNodeRewriter method produce$underscore$whileFalse_.

public WhileFalseNode produce$underscore$whileFalse_(final Expression _testExpr) {
    final BlockNode _testBlockNode;
    if (!_testExpr.isBlockNode()) {
        return null;
    }
    _testBlockNode = ((BlockNode) _testExpr);
    return WhileFalseNode.factory.testSequence_doSequence_(((SequenceNode) this.visit_(_testBlockNode.body())), null);
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Example 13 with SequenceNode

use of st.gravel.support.compiler.ast.SequenceNode 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)

Example 14 with SequenceNode

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

the class IntermediateNodeRewriter method produce$underscore$whileTrue_.

public WhileTrueNode produce$underscore$whileTrue_(final Expression _testExpr) {
    final BlockNode _testBlockNode;
    if (!_testExpr.isBlockNode()) {
        return null;
    }
    _testBlockNode = ((BlockNode) _testExpr);
    return WhileTrueNode.factory.testSequence_doSequence_(((SequenceNode) this.visit_(_testBlockNode.body())), null);
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Aggregations

SequenceNode (st.gravel.support.compiler.ast.SequenceNode)14 BlockNode (st.gravel.support.compiler.ast.BlockNode)9 Expression (st.gravel.support.compiler.ast.Expression)6 VariableDeclarationNode (st.gravel.support.compiler.ast.VariableDeclarationNode)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 BlockTypeNode (st.gravel.support.compiler.ast.BlockTypeNode)3 InstanceTypeNode (st.gravel.support.compiler.ast.InstanceTypeNode)3 PragmaNode (st.gravel.support.compiler.ast.PragmaNode)3 SelfTypeNode (st.gravel.support.compiler.ast.SelfTypeNode)3 TypeCast (st.gravel.support.compiler.ast.TypeCast)3 TypeNode (st.gravel.support.compiler.ast.TypeNode)3 Statement (st.gravel.support.compiler.ast.Statement)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 VariableNode (st.gravel.support.compiler.ast.VariableNode)1 VariableScopeAnalyzerState (st.gravel.support.compiler.ast.VariableScopeAnalyzerState)1