Move semantics object into new_parser

This commit is contained in:
Kevin 2020-05-13 20:39:32 -04:00
parent 05a3ad7be1
commit cb6d4938e5
2 changed files with 12 additions and 12 deletions

View File

@ -1,6 +1,18 @@
from . import nodes
class JinjaSemantics(object):
def block_expression_pair(self, ast):
start_block = ast['start']
end_block = ast['end']
if start_block['name'] != end_block['name']:
raise FailedSemantics()
return ast
def lineno_from_parseinfo(parseinfo):
return parseinfo.line + 1

View File

@ -9,18 +9,6 @@ from new_parser import parse_template
from jinja2.environment import Environment
class JinjaSemantics(object):
def block_expression_pair(self, ast):
start_block = ast['start']
end_block = ast['end']
if start_block['name'] != end_block['name']:
raise FailedSemantics()
return ast
with open('grammar.ebnf', 'r') as tatsu_grammar:
with open('test_template.jinja', 'r') as test_template:
template_string = test_template.read()