예제 #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));
 }
예제 #2
0
 @Test
 public void cpp_operators() {
   assertThat(lexer.lex("#"), hasToken("#", CppPunctuator.HASH));
   assertThat(lexer.lex("##"), hasToken("##", CppPunctuator.HASHHASH));
 }
예제 #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));
 }
예제 #4
0
 @Test
 public void cpp_identifiers() {
   assertThat(lexer.lex("lala"), hasToken("lala", IDENTIFIER));
 }
예제 #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));
 }