use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class UnitLexicalScope method createInitializationBlock.
@Override
BlockNode createInitializationBlock() {
VirtualFrame unitFrame = PascalLanguage.INSTANCE.createUnitFrame(this.getName(), this.getFrameDescriptor());
List<StatementNode> initializationNodes = this.generateInitializationNodes(unitFrame);
initializationNodes.addAll(this.scopeInitializationNodes);
return new BlockNode(initializationNodes.toArray(new StatementNode[initializationNodes.size()]));
}
use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class FatalError method IdentifierBeginningStatement.
StatementNode IdentifierBeginningStatement() {
StatementNode statement;
statement = null;
Expect(1);
Token identifierToken = t;
if (StartOf(6)) {
statement = factory.createSubroutineCall(identifierToken, new ArrayList<>());
} else if (la.kind == 6) {
statement = SubroutineCall(identifierToken);
} else if (StartOf(7)) {
statement = Assignment(identifierToken);
} else
SynErr(82);
return statement;
}
use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class FatalError method Block.
StatementNode Block() {
StatementNode blockNode;
Expect(35);
List<StatementNode> bodyNodes = new ArrayList<>();
if (StartOf(5)) {
StatementSequence(bodyNodes);
}
Expect(22);
blockNode = factory.createBlockNode(bodyNodes, this.extendedGotoSupport);
return blockNode;
}
use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class FatalError method IfStatement.
StatementNode IfStatement() {
StatementNode statement;
Expect(47);
ExpressionNode condition = Expression();
Expect(48);
StatementNode thenStatement = Statement();
StatementNode elseStatement = null;
if (la.kind == 38) {
Get();
elseStatement = Statement();
}
statement = factory.createIfStatement(condition, thenStatement, elseStatement);
return statement;
}
use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class FatalError method WhileLoop.
StatementNode WhileLoop() {
StatementNode statement;
factory.startLoop();
Expect(46);
ExpressionNode condition = Expression();
Expect(40);
StatementNode loopBody = Statement();
statement = factory.createWhileLoop(condition, loopBody);
factory.finishLoop();
return statement;
}
Aggregations