use of edu.rice.cs.caper.bayou.core.lexer.evidencel._1_0.TokenTypeComma in project bayou by capergroup.
the class EvidenceLLexerTests method testLexMixed1.
@Test
public void testLexMixed1() {
EvidenceLLexer lexer = makeLexer();
Iterator<Token> tokens = lexer.lex("ident1: ident2, ident3").iterator();
Assert.assertTrue(tokens.hasNext());
Token token = tokens.next();
Assert.assertEquals("ident1", token.getLexeme());
Assert.assertTrue(token.getType() instanceof TokenTypeIdentifier);
token = tokens.next();
Assert.assertEquals(":", token.getLexeme());
Assert.assertTrue(token.getType() instanceof TokenTypeColon);
token = tokens.next();
Assert.assertEquals("ident2", token.getLexeme());
Assert.assertTrue(token.getType() instanceof TokenTypeIdentifier);
token = tokens.next();
Assert.assertEquals(",", token.getLexeme());
Assert.assertTrue(token.getType() instanceof TokenTypeComma);
token = tokens.next();
Assert.assertEquals("ident3", token.getLexeme());
Assert.assertTrue(token.getType() instanceof TokenTypeIdentifier);
}
use of edu.rice.cs.caper.bayou.core.lexer.evidencel._1_0.TokenTypeComma in project bayou by capergroup.
the class EvidenceLParserTests method parseMultiCall.
@Test
public void parseMultiCall() throws ParseException {
EvidenceLParser parser = makeParser();
// calls: setTitle, setMessage
SourceUnitNode unit = parser.parse(Arrays.asList(Token.make("calls", new TokenTypeIdentifier()), Token.make(":", new TokenTypeColon()), Token.make("setTitle", new TokenTypeIdentifier()), Token.make(",", new TokenTypeComma()), Token.make("setMessage", new TokenTypeIdentifier())));
List<EvidenceElement> evidences = unit.getElements();
Assert.assertEquals(1, evidences.size());
EvidenceElementWithTypeIdentifierNode evidence = (EvidenceElementWithTypeIdentifierNode) evidences.get(0);
Assert.assertEquals("calls", evidence.getTypeIdentifier().getIdentifier());
Assert.assertEquals(2, evidence.getIdentifierList().getIdentifiers().size());
Assert.assertEquals("setTitle", evidence.getIdentifierList().getIdentifiers().get(0).getIdentifier());
Assert.assertEquals("setMessage", evidence.getIdentifierList().getIdentifiers().get(1).getIdentifier());
}
Aggregations