use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class FatalError method ForLoop.
StatementNode ForLoop() {
StatementNode statement;
factory.startLoop();
Expect(41);
boolean ascending = true;
Expect(1);
Token variableToken = t;
Expect(37);
ExpressionNode startValue = Expression();
if (la.kind == 42) {
Get();
ascending = true;
} else if (la.kind == 43) {
Get();
ascending = false;
} else
SynErr(81);
ExpressionNode finalValue = Expression();
Expect(40);
StatementNode loopBody = Statement();
statement = factory.createForLoop(ascending, variableToken, startValue, finalValue, loopBody);
factory.finishLoop();
return statement;
}
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(34);
}
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(37);
ExpressionNode value = Expression();
assignment = factory.createSimpleAssignment(identifierToken, value);
} else if (StartOf(7)) {
assignmentData = AssignmentRoute(identifierToken);
Expect(37);
ExpressionNode value = Expression();
assignment = factory.finishAssignmentNode(assignmentData, value);
} else
SynErr(83);
return assignment;
}
use of cz.cuni.mff.d3s.trupple.language.nodes.statement.StatementNode in project TrufflePascal by Aspect26.
the class FatalError method CaseList.
CaseStatementData CaseList() {
CaseStatementData data;
data = new CaseStatementData();
ExpressionNode caseConstant = Expression();
data.indexNodes.add(caseConstant);
Expect(25);
StatementNode caseStatement = Statement();
data.statementNodes.add(caseStatement);
while (!caseEnds()) {
Expect(8);
caseConstant = Expression();
data.indexNodes.add(caseConstant);
Expect(25);
caseStatement = Statement();
data.statementNodes.add(caseStatement);
}
if (la.kind == 8) {
Get();
}
if (la.kind == 38) {
Get();
data.elseNode = Statement();
}
if (la.kind == 8) {
Get();
}
return data;
}
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(49);
Expect(3);
statement = factory.createGotoStatement(t);
return statement;
}
Aggregations