Browse Source

Restore bad code (needs better fix). Updated readme & docs.

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.10.0
Erez Sh 4 years ago
parent
commit
5954fdf87a
3 changed files with 9 additions and 6 deletions
  1. +3
    -4
      README.md
  2. +1
    -1
      docs/features.md
  3. +5
    -1
      lark/exceptions.py

+ 3
- 4
README.md View File

@@ -33,7 +33,7 @@ Most importantly, Lark will save you time and prevent you from getting parsing h

### Install Lark

$ pip install lark-parser
$ pip install lark-parser --upgrade

Lark has no dependencies.

@@ -77,12 +77,11 @@ Notice punctuation doesn't appear in the resulting tree. It's automatically filt

### Fruit flies like bananas

Lark is great at handling ambiguity. Let's parse the phrase "fruit flies like bananas":
Lark is great at handling ambiguity. Here is the result of parsing the phrase "fruit flies like bananas":

![fruitflies.png](examples/fruitflies.png)

See more [examples here](https://github.com/lark-parser/lark/tree/master/examples)

See the code and more [examples here](https://github.com/lark-parser/lark/tree/master/examples)


## List of main features


+ 1
- 1
docs/features.md View File

@@ -19,8 +19,8 @@
[Read more about the parsers](parsers.md)

# Extra features

- Import rules and tokens from other Lark grammars, for code reuse and modularity.
- Support for external regex module ([see here](/docs/classes.md#using-unicode-character-classes-with-regex))
- Import grammars from Nearley.js ([read more](/docs/nearley.md))
- CYK parser



+ 5
- 1
lark/exceptions.py View File

@@ -72,7 +72,11 @@ class UnexpectedInput(LarkError):

class UnexpectedCharacters(LexError, UnexpectedInput):
def __init__(self, seq, lex_pos, line, column, allowed=None, considered_tokens=None, state=None, token_history=None):
message = "No terminal defined for '%s' at line %d col %d" % (seq[lex_pos], line, column)

if isinstance(seq, bytes):
message = "No terminal defined for '%s' at line %d col %d" % (seq[lex_pos:lex_pos+1].decode("ascii", "backslashreplace"), line, column)
else:
message = "No terminal defined for '%s' at line %d col %d" % (seq[lex_pos], line, column)

self.line = line
self.column = column


Loading…
Cancel
Save