Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
erezsh committed Mar 8, 2023
1 parent a565069 commit ac36ed0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/how_to_use.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ A likely source of bugs occurs when two regexes in a grammar can match the same

These collisions can be hard to notice, and their effects can be difficult to debug, as they are subtle and sometimes hard to reproduce.

To help with these situation, Lark can utilize the a new external library called `interegular`. If it is installed, Lark will use it to check for collisions, and warn about any conflicts that it can find:
To help with these situations, Lark can utilize a new external library called `interegular`. If it is installed, Lark uses it to check for collisions, and warn about any conflicts that it can find:

```
import logging
Expand All @@ -62,6 +62,10 @@ A: /a+/
B: /[ab]+/
'''
p = Lark(collision_grammar, parser='lalr')
# Output:
# Collision between Terminals B and A. The lexer will choose between them arbitrarily
# Example Collision: a
```

You can install interegular for Lark using `pip install 'lark[interegular]'`.
Expand Down
2 changes: 1 addition & 1 deletion lark/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def __init__(self, conf: 'LexerConf', comparator=None) -> None:
# raise LexError("Collision between Terminals %s and %s" % (a.name, b.name))
example = comparator.get_example_overlap(a, b).format_multiline()
logger.warning(f"Collision between Terminals {a.name} and {b.name}. "
f"The lexer will choose between them arbitrarily\n" + example)
f"The lexer will choose between them arbitrarily.\n" + example)

# Init
self.newline_types = frozenset(t.name for t in terminals if _regexp_has_newline(t.pattern.to_regexp()))
Expand Down

0 comments on commit ac36ed0

Please sign in to comment.