use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class LexicalScope method generateInitializationNodes.
/**
* Generates initialization node for each declared identifier in the current scope and returns list of these nodes.
* @param frame frame of the scope (used in scopes of units)
*/
List<StatementNode> generateInitializationNodes(VirtualFrame frame) {
List<StatementNode> initializationNodes = new ArrayList<>();
for (Map.Entry<String, TypeDescriptor> entry : this.localIdentifiers.getAllIdentifiers().entrySet()) {
String identifier = entry.getKey();
TypeDescriptor typeDescriptor = entry.getValue();
StatementNode initializationNode = createInitializationNode(identifier, typeDescriptor, frame);
if (initializationNode != null) {
initializationNodes.add(initializationNode);
}
}
return initializationNodes;
}
use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class FatalError method GotoStatement.
StatementNode GotoStatement() {
StatementNode statement;
Expect(47);
Expect(3);
statement = factory.createGotoStatement(t);
return statement;
}
use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class FatalError method Assignment.
StatementNode Assignment(Token identifierToken) {
StatementNode assignment;
AssignmentData assignmentData;
assignment = null;
if (isReturnVariable(identifierToken)) {
Expect(35);
ExpressionNode value = Expression();
assignment = factory.createSimpleAssignment(identifierToken, value);
} else if (StartOf(5)) {
assignmentData = AssignmentRoute(identifierToken);
Expect(35);
ExpressionNode value = Expression();
assignment = factory.finishAssignmentNode(assignmentData, value);
} else
SynErr(76);
return assignment;
}
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(34);
List<StatementNode> bodyNodes = new ArrayList<>();
if (StartOf(3)) {
StatementSequence(bodyNodes);
}
Expect(21);
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 MainFunction.
void MainFunction() {
factory.startMainFunction();
StatementNode blockNode = Block();
mainNode = factory.finishMainFunction(blockNode);
Expect(33);
}
Aggregations