Esempio n. 1
0
 def _rewrite(self, text, source, symbol_table=None):
     character_table = symbol_table or self._character_table
     factory = Factory(character_table)
     macros = MacroFactory(self)
     parser = Parser(factory.as_tokens(text, source), factory,
                     Context(definitions=macros.all()))
     return parser.process()
Esempio n. 2
0
 def _do_test_with(self, input, output):
     parser = Parser(self._factory.as_tokens(input, "Unknown"), self._factory, self._engine, self._environment)
     tokens = parser.rewrite()
     self._verify_output_is(output, tokens)
Esempio n. 3
0
 def _evaluate(self, expression):
     parser = Parser(self._factory.as_tokens(expression, "Unknown"),
                     self._factory, self._environment)
     return "".join(map(str, parser.evaluate()))
Esempio n. 4
0
 def _classify(self, expression):
     parser = Parser(self._factory.as_tokens(expression, "Unknown"),
                     self._factory, self._environment)
     parser.evaluate()
     return parser.shall_expand()
Esempio n. 5
0
 def _do_test_with(self, collected, expected):
     parser = Parser(self._factory.as_tokens(collected, "Unknown"),
                     self._factory, self._environment)
     tokens = parser.process()
     self._verify_output_is(expected, tokens)
Esempio n. 6
0
 def _rewrite(self, text, source, symbol_table=SymbolTable.default()):
     factory = Factory(symbol_table)
     parser = Parser(factory.as_tokens(text, source),
                     factory, self, Context())
     return parser.rewrite()
Esempio n. 7
0
 def _do_test_with(self, input, output):
     parser = Parser(self._factory.as_tokens(input, "Unknown"),
                     self._factory, self._environment)
     tokens = parser.rewrite()
     self._verify_output_is(output, tokens)
Esempio n. 8
0
 def _rewrite(self, text, source, symbol_table=SymbolTable.default()):
     factory = Factory(symbol_table)
     macros = MacroFactory(self)
     parser = Parser(factory.as_tokens(text, source), factory,
                     Context(definitions=macros.all()))
     return parser.rewrite()