Lines Matching refs:Lexer
5 from fontTools.feaLib.lexer import IncludingLexer, Lexer
13 return [(typ, tok) for (typ, tok, _) in Lexer(s, "test.fea")]
29 self.assertEqual(lex("a17"), [(Lexer.NAME, "a17")])
30 self.assertEqual(lex(".notdef"), [(Lexer.NAME, ".notdef")])
31 self.assertEqual(lex("two.oldstyle"), [(Lexer.NAME, "two.oldstyle")])
32 self.assertEqual(lex("_"), [(Lexer.NAME, "_")])
33 self.assertEqual(lex("\\table"), [(Lexer.NAME, "\\table")])
34 self.assertEqual(lex("a+*:^~!"), [(Lexer.NAME, "a+*:^~!")])
35 self.assertEqual(lex("with-dash"), [(Lexer.NAME, "with-dash")])
38 self.assertEqual(lex("\\0 \\987"), [(Lexer.CID, 0), (Lexer.CID, 987)])
41 self.assertEqual(lex("@Vowel.sc"), [(Lexer.GLYPHCLASS, "Vowel.sc")])
42 self.assertEqual(lex("@Vowel-sc"), [(Lexer.GLYPHCLASS, "Vowel-sc")])
56 (Lexer.NAME, "include"),
57 (Lexer.FILENAME, "~/foo/bar baz.fea"),
58 (Lexer.SYMBOL, ";")
61 (Lexer.NAME, "include"),
62 (Lexer.COMMENT, "# Comment"),
63 (Lexer.FILENAME, "foo"),
64 (Lexer.SYMBOL, ";")
71 [(Lexer.NUMBER, 123), (Lexer.NUMBER, -456)])
72 self.assertEqual(lex("0xCAFED00D"), [(Lexer.NUMBER, 0xCAFED00D)])
73 self.assertEqual(lex("0xcafed00d"), [(Lexer.NUMBER, 0xCAFED00D)])
77 [(Lexer.FLOAT, 1.23), (Lexer.FLOAT, -4.5)])
80 self.assertEqual(lex("a'"), [(Lexer.NAME, "a"), (Lexer.SYMBOL, "'")])
82 [(Lexer.SYMBOL, "-"), (Lexer.NAME, "A-B")])
85 [(Lexer.NAME, "foo"), (Lexer.SYMBOL, "-"), (Lexer.NUMBER, -2)])
89 [(Lexer.COMMENT, "# Comment"), (Lexer.COMMENT, "#")])
93 [(Lexer.STRING, "foo"), (Lexer.STRING, "bar")])
95 [(Lexer.STRING, "foo bar baz qux ")])
101 [(Lexer.STRING, r"M\00fcller-Lanc\00e9")])
103 [(Lexer.STRING, r"M\9fller-Lanc\8e")])
111 return [loc[1] for (_, _, loc) in Lexer(s, "test.fea")]
119 return ["%s:%d:%d" % loc for (_, _, loc) in Lexer(s, "test.fea")]
126 lexer = Lexer("abbacabba12", "test.fea")
138 lexer = Lexer("foo'bar", "test.fea")