nimgrep: first working version
This commit is contained in:
parent
9387913b73
commit
437eb2c37e
7 changed files with 174 additions and 46 deletions
|
|
@ -27,7 +27,11 @@ notation meaning
|
|||
``{E}`` Capture: Apply expression `E` and store the substring
|
||||
that matched `E` into a *capture* that can be accessed
|
||||
after the matching process.
|
||||
``$i`` back reference to the ``i``th capture. ``i`` counts from 1.
|
||||
``$i`` Back reference to the ``i``th capture. ``i`` counts from 1.
|
||||
``$`` Anchor: Matches at the end of the input. No character
|
||||
is consumed. Same as ``!.``.
|
||||
``^`` Anchor: Matches at the start of the input. No character
|
||||
is consumed.
|
||||
``&E`` And predicate: Indicate success if expression `E` matches
|
||||
the text ahead; otherwise indicate failure. Do not consume
|
||||
any text.
|
||||
|
|
@ -145,7 +149,7 @@ The PEG parser implements this grammar (written in PEG syntax)::
|
|||
rule <- identifier \s* "<-" expr ig
|
||||
identNoArrow <- identifier !(\s* "<-")
|
||||
prefixOpr <- ig '&' / ig '!' / ig '@' / ig '{@}' / ig '@@'
|
||||
literal <- ig identifier? '$' [0-9]+
|
||||
literal <- ig identifier? '$' [0-9]+ / '$' / '^' /
|
||||
ig identNoArrow /
|
||||
ig charset /
|
||||
ig stringlit /
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue