| Index: tools/lexer_generator/dfa.py
|
| diff --git a/tools/lexer_generator/dfa.py b/tools/lexer_generator/dfa.py
|
| index 8bfbeea76f68fa58daa193b5f4e5e593f1a309d2..c3807e0eabe8c20b427da3e88b3038d957e5e771 100644
|
| --- a/tools/lexer_generator/dfa.py
|
| +++ b/tools/lexer_generator/dfa.py
|
| @@ -117,23 +117,31 @@ class Dfa(Automaton):
|
| assert len(match) == 1
|
| return match[0]
|
|
|
| + @staticmethod
|
| + def terminal_action():
|
| + return Action(None, ('TERMINATE', None))
|
| +
|
| + @staticmethod
|
| + def miss_action():
|
| + return Action(None, ('Miss', None))
|
| +
|
| def collect_actions(self, string):
|
| state = self.__start
|
| for c in string:
|
| state = Dfa.__match_char(state, c)
|
| if not state:
|
| - yield Action('MISS')
|
| + yield self.miss_action()
|
| return
|
| if state.action():
|
| yield state.action()
|
| if state in self.__terminal_set:
|
| - yield Action('TERMINATE')
|
| + yield self.terminal_action()
|
| else:
|
| - yield Action('MISS')
|
| + yield self.miss_action()
|
|
|
| def matches(self, string):
|
| actions = list(self.collect_actions(string))
|
| - return actions and actions[-1].entry_action() == 'TERMINATE'
|
| + return actions and actions[-1] == self.terminal_action()
|
|
|
| def lex(self, string):
|
| state = self.__start
|
|
|