use of edu.rice.cs.caper.bayou.core.lexer.evidencel._1_0.TokenTypeIdentifier in project bayou by capergroup.
the class EvidenceLLexerTests method testLexAlternating.
@Test
public void testLexAlternating() {
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 TokenTypeColon);
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.TokenTypeIdentifier 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.TokenTypeIdentifier in project bayou by capergroup.
the class EvidenceLParserTests method parseIdentifier.
@Test
public void parseIdentifier() throws ParseException {
EvidenceLParser parser = makeParser();
SourceUnitNode unit = parser.parse(Collections.singletonList(Token.make("ident", new TokenTypeIdentifier())));
List<EvidenceElement> evidence = unit.getElements();
Assert.assertEquals(1, evidence.size());
}
use of edu.rice.cs.caper.bayou.core.lexer.evidencel._1_0.TokenTypeIdentifier in project bayou by capergroup.
the class EvidenceLLexerTests method testLexIdents.
@Test
public void testLexIdents() {
EvidenceLLexer lexer = makeLexer();
Iterator<Token> tokens = lexer.lex("ident1 ident2").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("ident2", token.getLexeme());
Assert.assertTrue(token.getType() instanceof TokenTypeIdentifier);
}
use of edu.rice.cs.caper.bayou.core.lexer.evidencel._1_0.TokenTypeIdentifier in project bayou by capergroup.
the class EvidenceLLexerTests method testLexIdent.
@Test
public void testLexIdent() {
EvidenceLLexer lexer = makeLexer();
Iterator<Token> tokens = lexer.lex("ident").iterator();
Assert.assertTrue(tokens.hasNext());
Token token = tokens.next();
Assert.assertEquals("ident", token.getLexeme());
Assert.assertTrue(token.getType() instanceof TokenTypeIdentifier);
}
Aggregations