Mercurial > lcfOS
diff test/testpyy.py @ 341:4d204f6f7d4e devel
Rewrite of assembler parts
author | Windel Bouwman |
---|---|
date | Fri, 28 Feb 2014 18:07:14 +0100 |
parents | 8d07a4254f04 |
children | fb3c1f029b30 |
line wrap: on
line diff
--- a/test/testpyy.py Sun Feb 23 16:24:01 2014 +0100 +++ b/test/testpyy.py Fri Feb 28 18:07:14 2014 +0100 @@ -37,7 +37,7 @@ # 2. define input: tokens = genTokens(['identifier', '+', 'identifier', '+', 'identifier']) # 3. build parser: - p = g.genParser() + p = g.generate_parser() # 4. feed input: p.parse(tokens) @@ -52,7 +52,7 @@ g.add_production('c', ['id']) g.start_symbol = 'goal' with self.assertRaises(ParserGenerationException): - p = g.genParser() + p = g.generate_parser() def testShiftReduceConflict(self): """ Must be handled automatically by doing shift """ @@ -63,7 +63,7 @@ g.add_production('stmt', ['if_stmt']) g.add_production('stmt', ['ass']) g.start_symbol = 'stmt' - p = g.genParser() + p = g.generate_parser() # Ambiguous program: tokens = genTokens(['if', 'then','if', 'then', 'ass', 'else', 'ass']) p.parse(tokens) @@ -76,7 +76,7 @@ g.add_production('a', ['c']) g.start_symbol = 'goal' with self.assertRaises(ParserGenerationException): - g.genParser() + g.generate_parser() def testRedefineTerminal(self): """ Test correct behavior when a terminal is redefined """ @@ -86,14 +86,14 @@ g.add_production('b', ['c']) # Not allowed g.add_production('a', ['c']) g.start_symbol = 'goal' - g.genParser() + g.generate_parser() def testEmpty(self): """ Test empty token stream """ g = Grammar([',']) g.add_production('input', [',']) g.start_symbol = 'input' - p = g.genParser() + p = g.generate_parser() tokens = genTokens([]) with self.assertRaises(ParserException): p.parse(tokens) @@ -105,7 +105,7 @@ g.add_production('optional_a', ['a']) g.add_production('optional_a', []) g.start_symbol = 'input' - p = g.genParser() + p = g.generate_parser() tokens = genTokens(['b']) p.parse(tokens) @@ -117,7 +117,7 @@ g.add_production('ins', ['id']) g.add_production('op1', ['id']) g.start_symbol = 'input' - p = g.genParser() + p = g.generate_parser() tokens = genTokens(['id', ':', 'id', 'id']) # i.e. "lab_0: inc rax" p.parse(tokens) tokens = genTokens(['id', 'id']) # i.e. "inc rax" @@ -129,7 +129,7 @@ g.add_production('aas', []) g.add_production('aas', ['aas', 'a']) g.start_symbol = 'aas' - p = g.genParser() + p = g.generate_parser() tokens = genTokens(['a', 'a', 'a']) p.parse(tokens) tokens = genTokens([]) @@ -146,7 +146,7 @@ g = Grammar(['a', 'b', 'c']) g.add_production('goal', ['a', 'c', 'b'], cb) g.start_symbol = 'goal' - p = g.genParser() + p = g.generate_parser() tokens = genTokens(['a', 'c', 'b']) p.parse(tokens) self.assertTrue(self.cb_called) @@ -239,7 +239,7 @@ def testParser(self): tokens = ['(', '(', ')', ')', '(', ')'] # 3. build parser: - p = self.g.genParser() + p = self.g.generate_parser() self.assertEqual(len(p.goto_table), 5) self.assertEqual(len(p.action_table), 19)