Mercurial > hg > expressionparser
comparison expr.py @ 10:15fb1081784f
add ExpressionParser to the exports
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Fri, 03 Jun 2011 10:16:19 -0700 |
| parents | 421e26c0299f |
| children | e17a3464a0b9 |
comparison
equal
deleted
inserted
replaced
| 9:421e26c0299f | 10:15fb1081784f |
|---|---|
| 20 # IDENT := [A-Za-z_]\w* | 20 # IDENT := [A-Za-z_]\w* |
| 21 | 21 |
| 22 # Identifiers take their values from a mapping dictionary passed as the second | 22 # Identifiers take their values from a mapping dictionary passed as the second |
| 23 # argument. | 23 # argument. |
| 24 | 24 |
| 25 __all__ = ['parse', 'ParseError'] | 25 __all__ = ['parse', 'ParseError', 'ExpressionParser'] |
| 26 import re | 26 import re |
| 27 | 27 |
| 28 # token classes | 28 # token classes |
| 29 class token(object): | |
| 30 pass | |
| 31 | |
| 29 class ident_token(object): | 32 class ident_token(object): |
| 30 def __init__(self, value): | 33 def __init__(self, value): |
| 31 self.value = value | 34 self.value = value |
| 32 def nud(self, parser): | 35 def nud(self, parser): |
| 33 # identifiers take their value from the value mappings passed | 36 # identifiers take their value from the value mappings passed |
