I can define and eval BNF definitions

This commit is contained in:
2019-12-17 21:19:44 +01:00
parent c668cc46d2
commit 88cd3162be
25 changed files with 1099 additions and 569 deletions
+2 -3
View File
@@ -2,7 +2,6 @@ from core.builtin_concepts import BuiltinConcepts
from parsers.BaseParser import BaseParser, Node, ErrorNode
from dataclasses import dataclass
import ast
import copy
import logging
log = logging.getLogger(__name__)
@@ -57,10 +56,10 @@ class PythonParser(BaseParser):
Parse Python scripts
"""
def __init__(self, source="<undef>"):
def __init__(self, **kwargs):
BaseParser.__init__(self, "PythonParser")
self.source = source
self.source = kwargs.get("source", "<undef>")
def parse(self, context, text):
text = text if isinstance(text, str) else self.get_text_from_tokens(text)