From: Kevin Date: Wed, 22 May 2024 15:25:40 +0000 (-0400) Subject: Initial OHM grammar for extends tag X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72ab9b5015d54b3cf23e4b7e08580c756fefed22;p=thirdparty%2Fjinja.git 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. --- diff --git a/grammar/jinja.ohm b/grammar/jinja.ohm new file mode 100644 index 00000000..0b72ea08 --- /dev/null +++ b/grammar/jinja.ohm @@ -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")+ +} \ No newline at end of file