Initial OHM grammar for extends tag
OHM is a PEG-based grammar parser generator which seems to be more compatible with the Jinja language. We are not making use of their automatic space handling since in Jinja whitespace is significant.
This commit is contained in:
parent
8710cabd4f
commit
72ab9b5015
34
grammar/jinja.ohm
Normal file
34
grammar/jinja.ohm
Normal file
@ -0,0 +1,34 @@
|
||||
Jinja {
|
||||
Template
|
||||
= expressions
|
||||
|
||||
expressions
|
||||
= expression*
|
||||
|
||||
expression
|
||||
= inlineStatement
|
||||
|
||||
inlineStatement
|
||||
= statementOpen sp? inlineStatementContent sp? statementClose
|
||||
|
||||
inlineStatementContent
|
||||
= statement_extends
|
||||
|
||||
statement_extends
|
||||
= statementId_extends sp stringLiteral
|
||||
|
||||
statementOpen = "{%"
|
||||
statementClose = "%}"
|
||||
|
||||
statementId_extends = "extends"
|
||||
|
||||
stringLiteral = stringLiteral_single | stringLiteral_double
|
||||
|
||||
stringLiteral_single = quote_single (~quote_single any)* quote_single
|
||||
stringLiteral_double = quote_double (~quote_double any)* quote_double
|
||||
|
||||
quote_single = "'"
|
||||
quote_double = "\""
|
||||
|
||||
sp = (" " | "\t")+
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user