use of de.be4.eventbalg.core.parser.node.AVariable in project probparsers by bendisposto.
the class CommentTest method testCommentVariables1.
@Test
public void testCommentVariables1() throws Exception {
final Start rootNode = parseInput("machine CommentVariables1 variables\n" + "varA" + "//varA comment\n" + " varB\n" + "varC\n" + "/*varC\ncomment*/" + "end", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) rootNode.getPParseUnit();
final LinkedList<PVariable> variables = parseUnit.getVariables();
assertEquals(3, variables.size());
AVariable variable = (AVariable) variables.get(0);
assertEquals("varA", variable.getName().getText());
assertEquals("varA comment", variable.getComments().get(0).getText());
variable = (AVariable) variables.get(1);
assertEquals("varB", variable.getName().getText());
assertEquals(0, variable.getComments().size());
variable = (AVariable) variables.get(2);
assertEquals("varC", variable.getName().getText());
final LinkedList<TComment> comments = variable.getComments();
assertNotNull(comments);
assertEquals(1, comments.size());
final StringTokenizer tokenizer = new StringTokenizer(comments.get(0).getText(), "\n\r");
assertEquals(2, tokenizer.countTokens());
assertEquals("varC", tokenizer.nextToken());
assertEquals("comment", tokenizer.nextToken());
}
use of de.be4.eventbalg.core.parser.node.AVariable in project probparsers by bendisposto.
the class StructureTest method testIdentifierTick.
@Test
public void testIdentifierTick() throws Exception {
final Start root = parseInput("machine Mac variables x' y end", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) root.getPParseUnit();
final LinkedList<PVariable> variables = parseUnit.getVariables();
assertEquals(2, variables.size());
assertEquals("x'", ((AVariable) variables.get(0)).getName().getText());
assertEquals("y", ((AVariable) variables.get(1)).getName().getText());
}
use of de.be4.eventbalg.core.parser.node.AVariable in project probparsers by bendisposto.
the class CommentTest method testCommentVariables1.
@Test
public void testCommentVariables1() throws Exception {
final Start rootNode = parseInput("machine CommentVariables1 variables\n" + "varA" + "//varA comment\n" + " varB\n" + "varC\n" + "/*varC\ncomment*/" + "end", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) rootNode.getPParseUnit();
final LinkedList<PVariable> variables = parseUnit.getVariables();
assertEquals(3, variables.size());
AVariable variable = (AVariable) variables.get(0);
assertEquals("varA", variable.getName().getText());
assertEquals("varA comment", variable.getComments().get(0).getText());
variable = (AVariable) variables.get(1);
assertEquals("varB", variable.getName().getText());
assertEquals(0, variable.getComments().size());
variable = (AVariable) variables.get(2);
assertEquals("varC", variable.getName().getText());
final LinkedList<TComment> comments = variable.getComments();
assertNotNull(comments);
assertEquals(1, comments.size());
final StringTokenizer tokenizer = new StringTokenizer(comments.get(0).getText(), "\n\r");
assertEquals(2, tokenizer.countTokens());
assertEquals("varC", tokenizer.nextToken());
assertEquals("comment", tokenizer.nextToken());
}
use of de.be4.eventbalg.core.parser.node.AVariable in project probparsers by bendisposto.
the class StructureTest method testIdentifierTick.
@Test
public void testIdentifierTick() throws Exception {
final Start root = parseInput("machine Mac variables x' y end", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) root.getPParseUnit();
final LinkedList<PVariable> variables = parseUnit.getVariables();
assertEquals(2, variables.size());
assertEquals("x'", ((AVariable) variables.get(0)).getName().getText());
assertEquals("y", ((AVariable) variables.get(1)).getName().getText());
}
Aggregations