Browse Source

Fixed docs for maybe_placeholders

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.8.2
Erez Sh 5 years ago
parent
commit
93976e360e
2 changed files with 4 additions and 2 deletions
  1. +1
    -1
      docs/classes.md
  2. +3
    -1
      docs/tree_construction.md

+ 1
- 1
docs/classes.md View File

@@ -34,7 +34,7 @@ The Lark class accepts a grammar string or file object, and keyword options:

* **propagate_positions** - Propagate line/column count to tree nodes, at the cost of performance (default=`False`)

* **maybe_placeholders** - The `[]` operator returns `None` when not matched. Setting this to `False` makes it behave like the `?` operator, and return no value at all, which may be a little faster (default=`True`)
* **maybe_placeholders** - When True, the `[]` operator returns `None` when not matched. When `False`, `[]` behaves like the `?` operator, and return no value at all, which may be a little faster (default=`False`)

* **lexer_callbacks** - A dictionary of callbacks of type f(Token) -> Token, used to interface with the lexer Token generation. Only works with the standard and contextual lexers. See [Recipes](recipes.md) for more information.



+ 3
- 1
docs/tree_construction.md View File

@@ -9,7 +9,9 @@ Using `item+` or `item*` will result in a list of items, equivalent to writing `

Using `item?` will return the item if it matched, or nothing.

Using `[item]` will return the item if it matched, or the value `None`, if it didn't. It's possible to force `[]` to behave like `()?`, by using the `maybe_placeholders=False` option when initializing Lark.
If `maybe_placeholders=False` (the default), then `[]` behaves like `()?`.

If `maybe_placeholders=True`, then using `[item]` will return the item if it matched, or the value `None`, if it didn't.

### Terminals



Loading…
Cancel
Save