| Index: tools/lexer_generator/rule_lexer.py
|
| diff --git a/tools/lexer_generator/rule_lexer.py b/tools/lexer_generator/rule_lexer.py
|
| index 5dc4936a3802eaafc7e6fe672c099380eefe10f6..b5bb8c403530818c32b5c601197a47736fd07465 100644
|
| --- a/tools/lexer_generator/rule_lexer.py
|
| +++ b/tools/lexer_generator/rule_lexer.py
|
| @@ -36,8 +36,9 @@ class RuleLexer:
|
| 'CONDITION',
|
| 'CONDITION_BEGIN',
|
| 'CONDITION_END',
|
| - 'REGEX_AND_TRANSITION',
|
| - 'REGEX_AND_BODY',
|
| + 'REGEX_TRANSITION_BODY',
|
| + 'REGEX_TRANSITION',
|
| + 'REGEX_BODY',
|
| )
|
|
|
| t_ANY_ignore = " \t\n"
|
| @@ -75,21 +76,26 @@ class RuleLexer:
|
| return t
|
|
|
| def t_seenCondition_CONDITION_END(self, t):
|
| - r'>'
|
| + r'>\s*'
|
| self.lexer.begin('afterCondition')
|
| return t
|
|
|
| - def t_afterCondition_REGEX_AND_TRANSITION(self, t):
|
| + def t_afterCondition_REGEX_TRANSITION_BODY(self, t):
|
| + r'(?P<regex>.+)\s*=>\s*(?P<new>.+)\s*{\s*(?P<body>.+)\s*}\s*'
|
| + self.lexer.begin('INITIAL')
|
| + return t
|
| +
|
| + def t_afterCondition_REGEX_TRANSITION(self, t):
|
| r'(?P<regex>.+)\s*:=>\s*(?P<new>.+)\s*'
|
| self.lexer.begin('INITIAL')
|
| return t
|
|
|
| - def t_afterCondition_REGEX_AND_BODY(self, t):
|
| - r'(?P<regex>.+)\s*{\s*(?P<body>.+)\s*}\s*'
|
| + def t_afterCondition_REGEX_BODY(self, t):
|
| + r'(?P<regex>.+?)\s+{\s*(?P<body>.+)\s*}\s*'
|
| self.lexer.begin('INITIAL')
|
| return t
|
|
|
| - def t_error(self, t):
|
| + def t_ANY_error(self, t):
|
| raise Exception("Illegal character '%s'" % t.value[0])
|
|
|
| def build(self, **kwargs):
|
|
|