Commit 2fb9631
committed
Allow bareword keys in nested action-arg hashes
BNGL inherits Perl's `=>` fat-comma semantics, so action arguments like
`generate_network({overwrite=>1,max_stoich=>{R=>6}})` are syntactically
valid even though the inner hash key `R` is unquoted. The pyparsing
grammar in `ActionList.define_parser()` required `quote_word` for
nested-curly keys, so any model that relied on bareword keys (notably
`max_stoich=>{<molecule>=><N>}`) failed at parse time before BNG2.pl
was ever invoked.
Accept either bareword or quoted keys inside nested hashes:
curly_arg_token = (base_name ^ quote_word) + "=>" + arg_type_int
The existing dict-handling path in `BNGParser._parse_action_line` rebuilds
the literal substring verbatim, so round-trip via `Action.gen_string()`
is unchanged.1 parent f571e3a commit 2fb9631
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
491 | 494 | | |
492 | 495 | | |
493 | 496 | | |
| |||
0 commit comments