�
K�g8: � �� � d Z ddlmZmZmZmZmZ ddlmZ ddl m
Z
ddlmZ ddl
mZmZ ddlmZmZ d d
lmZ ddlmZ d dlmZ d d
lmZmZmZmZmZ erddlm Z m!Z! G d� d� � Z"dS )a� This module implements an Earley parser.
The core Earley algorithm used here is based on Elizabeth Scott's implementation, here:
https://www.sciencedirect.com/science/article/pii/S1571066108001497
That is probably the best reference for understanding the algorithm here.
The Earley parser outputs an SPPF-tree as per that document. The SPPF tree format
is explained here: https://lark-parser.readthedocs.io/en/latest/_static/sppf/sppf.html
� )�
TYPE_CHECKING�Callable�Optional�List�Any)�deque� )�Token)�Tree)�
UnexpectedEOF�UnexpectedToken)�logger�
OrderedSet� )�GrammarAnalyzer)�NonTerminal)�Item)�ForestSumVisitor�
SymbolNode�StableSymbolNode� TokenNode�ForestToParseTree)� LexerConf�
ParserConfc � � e Zd ZU ded<