Skip to content

Commit ea7703d

Browse files
authored
Merge pull request #22 from scikit-hep/add-subvariables
Add rudimentary support for nested variables
2 parents 3a513c2 + 04b79b3 commit ea7703d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

formulate/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from collections import defaultdict
88

99
import pyparsing
10-
from pyparsing import Literal, Suppress, pyparsing_common, opAssoc, Word
10+
from pyparsing import Literal, Suppress, pyparsing_common, opAssoc, Word, delimitedList
1111

1212
from .expression import Expression, Variable, NamedConstant, UnnamedConstant, ExpressionComponent
1313
from .identifiers import order_of_operations
@@ -268,7 +268,7 @@ class ParsingException(Exception):
268268
def create_parser(config, constants):
269269
EXPRESSION = pyparsing.Forward()
270270

271-
VARIABLE = Word(pyparsing.alphas+'_', pyparsing.alphanums+'_-')
271+
VARIABLE = delimitedList(Word(pyparsing.alphas+'_', pyparsing.alphanums+'_-'), delim='.', combine=True)
272272
VARIABLE.setName('Variable')
273273
VARIABLE.setParseAction(add_logging(lambda string, location, result: Variable(result[0])))
274274

formulate/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
]
1212

1313

14-
__version__ = '0.0.7'
14+
__version__ = '0.0.8'
1515
version = __version__
1616
version_info = __version__.split('.')

0 commit comments

Comments
 (0)