Browse Source

Lark now works under Python -OO (Issue #283)

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.66
Erez Shinan 6 years ago
parent
commit
6290b1647d
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      lark/lark.py

+ 5
- 2
lark/lark.py View File

@@ -46,7 +46,9 @@ class LarkOptions(object):
propagate_positions - Propagates [line, column, end_line, end_column] attributes into all tree branches.
lexer_callbacks - Dictionary of callbacks for the lexer. May alter tokens during lexing. Use with caution.
"""
__doc__ += OPTIONS_DOC
if __doc__:
__doc__ += OPTIONS_DOC

def __init__(self, options_dict):
o = dict(options_dict)

@@ -168,7 +170,8 @@ class Lark:

if self.profiler: self.profiler.enter_section('outside_lark')

__init__.__doc__ += "\nOPTIONS:" + LarkOptions.OPTIONS_DOC
if __init__.__doc__:
__init__.__doc__ += "\nOPTIONS:" + LarkOptions.OPTIONS_DOC

def _build_lexer(self):
return TraditionalLexer(self.lexer_conf.tokens, ignore=self.lexer_conf.ignore, user_callbacks=self.lexer_conf.callbacks)


Loading…
Cancel
Save