Ejemplo n.º 1
0
 @Test
 public void hash_followed_by_word() {
   List<Token> tokens = lexer.lex("#a");
   assertThat(tokens, hasToken("#", CppPunctuator.HASH));
   assertThat(tokens, hasToken("a", IDENTIFIER));
 }
Ejemplo n.º 2
0
 @Test
 public void cpp_operators() {
   assertThat(lexer.lex("#"), hasToken("#", CppPunctuator.HASH));
   assertThat(lexer.lex("##"), hasToken("##", CppPunctuator.HASHHASH));
 }
Ejemplo n.º 3
0
 @Test
 public void cpp_keywords_indented() {
   assertThat(lexer.lex(" #define"), hasToken("#define", CppKeyword.DEFINE));
   assertThat(lexer.lex("\t#define"), hasToken("#define", CppKeyword.DEFINE));
 }
Ejemplo n.º 4
0
 @Test
 public void cpp_identifiers() {
   assertThat(lexer.lex("lala"), hasToken("lala", IDENTIFIER));
 }
Ejemplo n.º 5
0
 @Test
 public void cpp_keywords_with_whitespaces() {
   assertThat(lexer.lex("#  define"), hasToken("#define", CppKeyword.DEFINE));
   assertThat(lexer.lex("#\tinclude"), hasToken("#include", CppKeyword.INCLUDE));
 }