| @@ -33,7 +33,7 @@ Most importantly, Lark will save you time and prevent you from getting parsing h | |||||
| ### Install Lark | ### Install Lark | ||||
| $ pip install lark-parser | |||||
| $ pip install lark-parser --upgrade | |||||
| Lark has no dependencies. | 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 | ### 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": | |||||
|  |  | ||||
| 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 | ## List of main features | ||||
| @@ -19,8 +19,8 @@ | |||||
| [Read more about the parsers](parsers.md) | [Read more about the parsers](parsers.md) | ||||
| # Extra features | # Extra features | ||||
| - Import rules and tokens from other Lark grammars, for code reuse and modularity. | - 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)) | - Import grammars from Nearley.js ([read more](/docs/nearley.md)) | ||||
| - CYK parser | - CYK parser | ||||
| @@ -72,7 +72,11 @@ class UnexpectedInput(LarkError): | |||||
| class UnexpectedCharacters(LexError, UnexpectedInput): | class UnexpectedCharacters(LexError, UnexpectedInput): | ||||
| def __init__(self, seq, lex_pos, line, column, allowed=None, considered_tokens=None, state=None, token_history=None): | 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.line = line | ||||
| self.column = column | self.column = column | ||||