diff --git a/README.md b/README.md index 84e4921..6f5ed74 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Lark provides syntax highlighting for its grammar files (\*.lark): ### Clones -- [Lerche (Julia)](https://github.com/jamesrhester/Lerche.jl) - an unofficial clone, written entirely in Julia. +- [Lerche (Julia)](https://github.com/jamesrhester/Lerche.jl) - an unofficial clone, written entirely in Julia. ### Hello World @@ -141,10 +141,10 @@ Check out the [JSON tutorial](/docs/json_tutorial.md#conclusion) for more detail - [mappyfile](https://github.com/geographika/mappyfile) - a MapFile parser for working with MapServer configuration - [synapse](https://github.com/vertexproject/synapse) - an intelligence analysis platform - [Command-Block-Assembly](https://github.com/simon816/Command-Block-Assembly) - An assembly language, and C compiler, for Minecraft commands - - [SPFlow](https://github.com/SPFlow/SPFlow) - Library for Sum-Product Networks + - [SPFlow](https://github.com/SPFlow/SPFlow) - Library for Sum-Product Networks - [Torchani](https://github.com/aiqm/torchani) - Accurate Neural Network Potential on PyTorch - [required](https://github.com/shezadkhan137/required) - multi-field validation using docstrings - - [miniwdl](https://github.com/chanzuckerberg/miniwdl) - A static analysis toolkit for the Workflow Description Language + - [miniwdl](https://github.com/chanzuckerberg/miniwdl) - A static analysis toolkit for the Workflow Description Language - [pytreeview](https://gitlab.com/parmenti/pytreeview) - a lightweight tree-based grammar explorer diff --git a/docs/classes.md b/docs/classes.md index 021b2f4..284ce73 100644 --- a/docs/classes.md +++ b/docs/classes.md @@ -32,7 +32,7 @@ The Lark class accepts a grammar string or file object, and keyword options: * **keep_all_tokens** - Don't throw away any terminals from the tree (Default=`False`) -* **propagate_positions** - Propagate line/column count to tree nodes, at the cost of performance (default=`True`) +* **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`) @@ -52,7 +52,7 @@ The main tree class * `data` - The name of the rule or alias * `children` - List of matched sub-rules and terminals -* `meta` - Line & Column numbers (unless `propagate_positions` is disabled) +* `meta` - Line & Column numbers (if `propagate_positions` is enabled) * meta attributes: `line`, `column`, `start_pos`, `end_line`, `end_column`, `end_pos` #### \_\_init\_\_(self, data, children) diff --git a/lark/lark.py b/lark/lark.py index 33b57e3..3e69b7f 100644 --- a/lark/lark.py +++ b/lark/lark.py @@ -62,7 +62,7 @@ class LarkOptions(Serialize): 'start': 'start', 'priority': 'auto', 'ambiguity': 'auto', - 'propagate_positions': True, + 'propagate_positions': False, 'lexer_callbacks': {}, 'maybe_placeholders': True, 'edit_terminals': None, diff --git a/tests/test_parser.py b/tests/test_parser.py index 3f73990..72be997 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -151,7 +151,7 @@ class TestParsers(unittest.TestCase): g = Lark(r"""start: a+ a : "x" _NL? _NL: /\n/+ - """, parser='lalr', transformer=T() if internal else None) + """, parser='lalr', transformer=T() if internal else None, propagate_positions=True) except NotImplementedError: assert internal continue