Пример #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));
 }