use of de.be4.eventbalg.core.parser.node.EOF in project probparsers by bendisposto.
the class CreateFreetypeTest method createMachine.
private Start createMachine(String name) {
final AFreetypesMachineClause freetypes = createFreetype();
final AConstantsMachineClause variables = new AConstantsMachineClause(createIdentifiers(VAR_NAME));
final AMemberPredicate member = new AMemberPredicate(createIdentifier(VAR_NAME), new APowSubsetExpression(createIdentifier(FREETYPE_NAME)));
final AInvariantMachineClause inv = new AInvariantMachineClause(member);
final AInitialisationMachineClause init = new AInitialisationMachineClause(createAssignment(VAR_NAME, new AEmptySetExpression()));
final AOperationsMachineClause operations = createOperations();
final AMachineHeader header = new AMachineHeader(createIdLits(name), EMPTY_EXPRS);
final AAbstractMachineParseUnit machine = new AAbstractMachineParseUnit(new AMachineMachineVariant(), header, Arrays.asList(freetypes, variables, inv, init, operations));
return new Start(machine, new EOF());
}
use of de.be4.eventbalg.core.parser.node.EOF in project probparsers by bendisposto.
the class EventBLexer method collectMultiLineComment.
private void collectMultiLineComment() throws EventBLexerException {
if (state.equals(State.MULTI_COMMENT)) {
if (token instanceof EOF) {
// tokenList.add(token);
throw new EventBLexerException(token, "Comment not closed");
}
/*
* Starting a new multiline comment, so first token is
* TMultiCommentStart
*/
if (commentStart == null) {
commentStart = (TMultiCommentStart) token;
commentBuffer = new StringBuilder();
token = null;
} else {
// end of comment reached?
if (token instanceof TMultiCommentEnd) {
token = new TComment(commentBuffer.toString(), commentStart.getLine(), commentStart.getPos());
commentStart = null;
commentBuffer = null;
state = State.NORMAL;
} else {
commentBuffer.append(token.getText());
token = null;
}
}
}
}
use of de.be4.eventbalg.core.parser.node.EOF in project probparsers by bendisposto.
the class UnitPragmaTest method testUnitAlias.
@Test
public void testUnitAlias() throws Exception {
String input = "/*@ unit_alias kmph \"km/h\" */ MACHINE UnitAlias VARIABLES lala INVARIANT lala=0 INITIALISATION lala:=0 END";
BLexer lex = new BLexer(new PushbackReader(new StringReader(input), 500));
Token t;
while (!((t = lex.next()) instanceof EOF)) {
System.out.print(t.getClass().getSimpleName() + "(" + t.getText() + ")");
System.out.print(" ");
}
BParser p = new BParser();
Start ast = p.parse(input, false);
ASTPrinter pr = new ASTPrinter();
ast.apply(pr);
System.out.println(printAST(ast));
}
use of de.be4.eventbalg.core.parser.node.EOF in project probparsers by bendisposto.
the class EventBLexer method collectMultiLineComment.
private void collectMultiLineComment() throws EventBLexerException {
if (state.equals(State.MULTI_COMMENT)) {
if (token instanceof EOF) {
// tokenList.add(token);
throw new EventBLexerException(token, "Comment not closed");
}
/*
* Starting a new multiline comment, so first token is
* TMultiCommentStart
*/
if (commentStart == null) {
commentStart = (TMultiCommentStart) token;
commentBuffer = new StringBuilder();
token = null;
} else {
// end of comment reached?
if (token instanceof TMultiCommentEnd) {
token = new TComment(commentBuffer.toString(), commentStart.getLine(), commentStart.getPos());
commentStart = null;
commentBuffer = null;
state = State.NORMAL;
} else {
commentBuffer.append(token.getText());
token = null;
}
}
}
}
use of de.be4.eventbalg.core.parser.node.EOF in project prob2 by bendisposto.
the class DomBuilder method createExpressionAST.
private Start createExpressionAST(final PExpression expression) {
Start start = new Start();
AExpressionParseUnit node = new AExpressionParseUnit();
start.setPParseUnit(node);
start.setEOF(EOF);
node.setExpression((PExpression) expression.clone());
node.getExpression().apply(new RenameIdentifiers());
return start;
}
Aggregations