Fix import of parser

This commit is contained in:
Peter J. Holzer 2022-02-28 12:47:17 +01:00 committed by Peter J. Holzer
parent 0f3cd9be19
commit 5faff969db
1 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,8 @@ import psycopg2
from psycopg2 import sql
from psycopg2 import extras
from . import parser
log = logging.getLogger(__name__)
log_action = log.getChild("action")
log_check = log.getChild("check")
@ -247,14 +249,14 @@ def main():
logging.basicConfig(format="%(asctime)s %(levelname)s %(name)s %(lineno)d | %(message)s", level=logging.DEBUG)
with open(sys.argv[1]) as rf:
text = rf.read()
ps = procrusql.parser.ParseState(text)
ps = parser.ParseState(text)
ps2 = procrusql.parser.parse_ruleset(ps)
ps2 = parser.parse_ruleset(ps)
if not ps2:
ps.printerror()
sys.exit(1)
db = psycopg2.connect(sys.argv[2])
procrusql.fit(db, ps2.ast)
fit(db, ps2.ast)