Lines Matching refs:lex

12 def lex(s):  function
25 self.assertEqual(lex(""), [])
26 self.assertEqual(lex(" \t "), [])
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")])
44 "Expected glyph class", lex, "@(a)")
46 "Expected glyph class", lex, "@ A")
49 lex, "@" + ("A" * 64))
52 lex, "@Ab:c")
55 self.assertEqual(lex("include (~/foo/bar baz.fea);"), [
60 self.assertEqual(lex("include # Comment\n (foo) \n;"), [
66 self.assertRaises(FeatureLibError, lex, "include blah")
67 self.assertRaises(FeatureLibError, lex, "include (blah")
70 self.assertEqual(lex("123 -456"),
72 self.assertEqual(lex("0xCAFED00D"), [(Lexer.NUMBER, 0xCAFED00D)])
73 self.assertEqual(lex("0xcafed00d"), [(Lexer.NUMBER, 0xCAFED00D)])
76 self.assertEqual(lex("1.23 -4.5"),
80 self.assertEqual(lex("a'"), [(Lexer.NAME, "a"), (Lexer.SYMBOL, "'")])
81 self.assertEqual(lex("-A-B"),
84 lex("foo - -2"),
88 self.assertEqual(lex("# Comment\n#"),
92 self.assertEqual(lex('"foo" "bar"'),
94 self.assertEqual(lex('"foo \nbar\r baz \r\nqux\n\n "'),
100 self.assertEqual(lex(r'"M\00fcller-Lanc\00e9"'), # 'nameid 9'
102 self.assertEqual(lex(r'"M\9fller-Lanc\8e"'), # 'nameid 9 1'
104 self.assertRaises(FeatureLibError, lex, '"foo\n bar')
107 self.assertRaises(FeatureLibError, lambda: lex("123 \u0001"))