Search in sources :

Example 26 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method CaseStatement.

StatementNode CaseStatement() {
    StatementNode statement;
    Expect(23);
    ExpressionNode caseExpression = Expression();
    Expect(13);
    CaseStatementData caseData = CaseList();
    caseData.caseExpression = caseExpression;
    Expect(21);
    statement = factory.createCaseStatement(caseData);
    return statement;
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 27 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method RepeatLoop.

StatementNode RepeatLoop() {
    StatementNode statement;
    factory.startLoop();
    Expect(42);
    List<StatementNode> bodyNodes = new ArrayList<>();
    StatementSequence(bodyNodes);
    Expect(43);
    ExpressionNode condition = Expression();
    statement = factory.createRepeatLoop(condition, factory.createBlockNode(bodyNodes, this.extendedGotoSupport));
    factory.finishLoop();
    return statement;
}
Also used : ArrayList(java.util.ArrayList) StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 28 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method StatementSequence.

void StatementSequence(List<StatementNode> body) {
    StatementNode statement = Statement();
    body.add(statement);
    while (la.kind == 8) {
        Get();
        statement = Statement();
        body.add(statement);
    }
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 29 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method Statement.

StatementNode Statement() {
    StatementNode statement;
    statement = null;
    Token label = null;
    if (la.kind == 3) {
        label = Label();
        Expect(25);
    }
    switch(la.kind) {
        case 8:
        case 22:
        case 38:
        case 45:
            {
                statement = factory.createNopStatement();
                break;
            }
        case 47:
            {
                statement = IfStatement();
                break;
            }
        case 41:
            {
                statement = ForLoop();
                break;
            }
        case 46:
            {
                statement = WhileLoop();
                break;
            }
        case 44:
            {
                statement = RepeatLoop();
                break;
            }
        case 24:
            {
                statement = CaseStatement();
                break;
            }
        case 36:
            {
                Get();
                statement = factory.createBreak();
                break;
            }
        case 39:
            {
                statement = WithStatement();
                break;
            }
        case 49:
            {
                statement = GotoStatement();
                break;
            }
        case 35:
            {
                statement = Block();
                break;
            }
        case 1:
            {
                statement = IdentifierBeginningStatement();
                break;
            }
        default:
            SynErr(80);
            break;
    }
    if (label != null)
        statement = factory.createLabeledStatement(statement, label);
    return statement;
}
Also used : StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Example 30 with StatementNode

use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.

the class FatalError method RepeatLoop.

StatementNode RepeatLoop() {
    StatementNode statement;
    factory.startLoop();
    Expect(44);
    List<StatementNode> bodyNodes = new ArrayList<>();
    StatementSequence(bodyNodes);
    Expect(45);
    ExpressionNode condition = Expression();
    statement = factory.createRepeatLoop(condition, factory.createBlockNode(bodyNodes, this.extendedGotoSupport));
    factory.finishLoop();
    return statement;
}
Also used : ArrayList(java.util.ArrayList) StatementNode(cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)

Aggregations

StatementNode (cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode)30 ArrayList (java.util.ArrayList)6 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)2 VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)1 BlockNode (cz.cuni.mff.d3s.trupple.language.nodes.statement.BlockNode)1 TypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)1 EnumTypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.compound.EnumTypeDescriptor)1 ReturnTypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.ReturnTypeDescriptor)1