Merge pull request #2179 from jmtd/fix-matchgroups
import: fix scoping problems with match groups
This commit is contained in:
commit
6e5272f7df
@ -6,3 +6,5 @@ source_paths:
|
|||||||
cpp_options:
|
cpp_options:
|
||||||
- -DMIN_VERSION_megaparsec(x,y,z)=1
|
- -DMIN_VERSION_megaparsec(x,y,z)=1
|
||||||
- -DMIN_VERSION_aeson(x,y,z)=1
|
- -DMIN_VERSION_aeson(x,y,z)=1
|
||||||
|
exclude_paths:
|
||||||
|
- hledger/test/addons
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,23 @@
|
|||||||
fields _, date, _, description, account1, amount, _
|
fields _, date, _, description, account1, amount, _
|
||||||
# checking brackets in a field matcher are captured...
|
|
||||||
|
# checking brackets in a field matcher are captured and interpolated into field
|
||||||
|
# assignments (real-life use-case #2)
|
||||||
if %account1 liabilities:jon:(.*)
|
if %account1 liabilities:jon:(.*)
|
||||||
# ...and interpolated into field assignments (real-life use-case #2)
|
|
||||||
account1 \1
|
account1 \1
|
||||||
# checking brackets in a record matcher are captured, including
|
|
||||||
# nesting...
|
# This should match, as should the next block. Both blocks assign to comment1,
|
||||||
|
# so this block should be a no-op. It's here to test the match group numbering
|
||||||
|
# between blocks are not conflated (#2158).
|
||||||
|
if (Zettle)
|
||||||
|
comment1 ignore
|
||||||
|
|
||||||
|
# checking brackets in a record matcher are captured, including nesting and the
|
||||||
|
# interpolation token numerical offset is local to this match group; and the
|
||||||
|
# token is interpolated into surrounding text
|
||||||
if Zettle.*(Robert W. (Bell)).*£
|
if Zettle.*(Robert W. (Bell)).*£
|
||||||
# ... and the interpolation token numerical offset is local to
|
|
||||||
# this match group; and the token is interpolated into surrounding
|
|
||||||
# text
|
|
||||||
comment1 Bell=\2.
|
comment1 Bell=\2.
|
||||||
# Match the YYY-MM of a date field and warp the posting date, useful
|
|
||||||
# for credit cards (real-life use-case #1))
|
# Match the YYYY-MM of a date field and warp the posting date, useful for
|
||||||
|
# credit cards (real-life use-case #1))
|
||||||
if %date (....-..)-..
|
if %date (....-..)-..
|
||||||
comment2 date:\1-01
|
comment2 date:\1-01
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user