Exemple #1
0
    def test_tokenizes_single_line_comment(self):
        self.check("// asd", [COMMENT(value=" asd")])

        self.check("asd// asd",
                   [IDENTIFIER(value="asd"),
                    COMMENT(value=" asd")])

        self.check("asd// asd //",
                   [IDENTIFIER(value="asd"),
                    COMMENT(value=" asd //")])
Exemple #2
0
 def test_tokenizes_define(self):
     self.check(
         "`define name",
         [
             PREPROCESSOR(value="define"),
             WHITESPACE(value=" "),
             IDENTIFIER(value="name"),
         ],
     )
Exemple #3
0
 def test_has_location_information(self):
     self.check(
         "`define foo",
         [
             PREPROCESSOR(value="define", location=(("fn.v",
                                                     (0, 6)), None)),
             WHITESPACE(value=" ", location=(("fn.v", (7, 7)), None)),
             IDENTIFIER(value="foo", location=(("fn.v", (8, 10)), None)),
         ],
         strip_loc=False,
     )
Exemple #4
0
 def test_escaped_newline_ignored(self):
     self.check("a\\\nb", [IDENTIFIER(value="a"), IDENTIFIER(value="b")])
Exemple #5
0
 def test_tokenizes_newline(self):
     self.check("asd\n", [IDENTIFIER(value="asd"), NEWLINE(value="")])
Exemple #6
0
 def test_tokenizes_semi_colon(self):
     self.check("asd;", [IDENTIFIER(value="asd"), SEMI_COLON(value="")])