Move semantics object into new_parser
This commit is contained in:
parent
05a3ad7be1
commit
cb6d4938e5
@ -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
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user