]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Describe import statement
authorKevin <github@kevin-brown.com>
Wed, 22 May 2024 16:10:26 +0000 (12:10 -0400)
committerKevin <github@kevin-brown.com>
Wed, 22 May 2024 16:10:26 +0000 (12:10 -0400)
grammar/jinja.ohm

index ff18bc40854b1d42f4eed3a2ab1f655f51d67f4a..8818d60f6cac3dc34775eb7585b55e0b73a11e5c 100644 (file)
@@ -13,6 +13,7 @@ Jinja {
     
     inlineStatementContent
     = statement_extends
+    | statement_import
     | statement_include
     
     statement_extends
@@ -22,6 +23,13 @@ Jinja {
     = stringLiteral
     | variableName
     
+    statement_import
+    = statementId_import sp statementImport_file sp statementModifier_as sp variableName
+    
+    statementImport_file
+    = stringLiteral
+    | variableName
+    
     statement_include
     = statementId_include sp statementInclude_file (sp importOptions_ignoreMissing)? (sp importOptions_contextManagement)?
     
@@ -36,8 +44,11 @@ Jinja {
     statementClose = "%}"
     
     statementId_extends = "extends"
+    statementId_import = "import"
     statementId_include = "include"
     
+    statementModifier_as = "as"
+    
     importOptions_ignoreMissing = "ignore missing"
     importOptions_contextManagement = importOptions_withContext | importOptions_withoutContext
     importOptions_withContext = "with context"