Browse Source

Merge pull request #393 from davaya/master

Clarify handling of filtered terminals
tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.7.2
Erez Shinan 5 years ago
committed by GitHub
parent
commit
db4ae9d20b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      docs/tree_construction.md

+ 18
- 0
docs/tree_construction.md View File

@@ -23,6 +23,24 @@ Lark filters out certain types of terminals by default, considering them punctua
- Unnamed regular expressions (like `/[0-9]/`)
- Named terminals whose name starts with a letter (like `DIGIT`)

Note: Terminals composed of literals and other terminals always include the entire match without filtering any part.

**Example:**
```
start: PNAME pname

PNAME: "(" NAME ")"
pname: "(" NAME ")"

NAME: /\w+/
%ignore /\s+/
```
Lark will parse "(Hello) (World)" as:

start
(Hello)
pname World

Rules prefixed with `!` will retain all their literals regardless.




Loading…
Cancel
Save