Browse Source

tools.nearley: Add support for case-insensitive strings (Issue #753)

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.11.0
Erez Sh 3 years ago
parent
commit
5149d38e25
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      lark/tools/nearley.py

+ 4
- 2
lark/tools/nearley.py View File

@@ -35,7 +35,9 @@ nearley_grammar = r"""
COMMENT: /#[^\n]*/
REGEXP: /\[.*?\]/

%import common.ESCAPED_STRING -> STRING
STRING: _STRING "i"?

%import common.ESCAPED_STRING -> _STRING
%import common.WS
%ignore WS
%ignore COMMENT
@@ -183,7 +185,7 @@ def main(fn, start, nearley_lib, es6=False):
return create_code_for_nearley_grammar(grammar, start, os.path.join(nearley_lib, 'builtin'), os.path.abspath(os.path.dirname(fn)), es6=es6)

def get_arg_parser():
parser = argparse.ArgumentParser('Reads Nearley grammar (with js functions) outputs an equivalent lark parser.')
parser = argparse.ArgumentParser(description='Reads a Nearley grammar (with js functions), and outputs an equivalent lark parser.')
parser.add_argument('nearley_grammar', help='Path to the file containing the nearley grammar')
parser.add_argument('start_rule', help='Rule within the nearley grammar to make the base rule')
parser.add_argument('nearley_lib', help='Path to root directory of nearley codebase (used for including builtins)')


Loading…
Cancel
Save