Browse Source

Documented regexp flags. Issue #230

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.10.0
Erez Sh 4 years ago
parent
commit
b174d5eae8
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      docs/grammar.md

+ 13
- 0
docs/grammar.md View File

@@ -112,6 +112,19 @@ Terminals can be assigned priority only when using a lexer (future versions may


Priority can be either positive or negative. If not specified for a terminal, it defaults to 1. Priority can be either positive or negative. If not specified for a terminal, it defaults to 1.


### Regexp Flags

You can use flags on regexps and strings. For example:

```perl
SELECT: "select"i //# Will ignore case, and match SELECT or Select, etc.
MULTILINE_TEXT: /.+/s
```

Supported flags are one of: `imslu`. See Python's regex documentation for more details on each one.

Regexps/strings of different flags can only be concatenated in Python 3.6+

#### Notes for when using a lexer: #### Notes for when using a lexer:


When using a lexer (standard or contextual), it is the grammar-author's responsibility to make sure the literals don't collide, or that if they do, they are matched in the desired order. Literals are matched according to the following precedence: When using a lexer (standard or contextual), it is the grammar-author's responsibility to make sure the literals don't collide, or that if they do, they are matched in the desired order. Literals are matched according to the following precedence:


Loading…
Cancel
Save