Browse Source

lexer.py: Small simplification

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.12.0
Erez Sh 4 years ago
parent
commit
da3a993d02
1 changed files with 2 additions and 4 deletions
  1. +2
    -4
      lark/lexer.py

+ 2
- 4
lark/lexer.py View File

@@ -271,6 +271,8 @@ class Scanner:
self.use_bytes = use_bytes
self.match_whole = match_whole

self.allowed_types = {t.name for t in self.terminals}

self._mres = self._build_mres(terminals, len(terminals))

def _build_mres(self, terminals, max_size):
@@ -298,10 +300,6 @@ class Scanner:
if m:
return m.group(0), type_from_index[m.lastindex]

@property
def allowed_types(self):
return {v for m, tfi in self._mres for v in tfi.values()}


def _regexp_has_newline(r):
r"""Expressions that may indicate newlines in a regexp:


Loading…
Cancel
Save