Adding basic import statement support

This commit is contained in:
Kevin 2024-05-21 15:25:54 -04:00
parent 38d2923eae
commit 249d551e5e
2 changed files with 14 additions and 2 deletions

View File

@ -25,7 +25,7 @@ list_literal_value
variable_name : IDENTIFIER;
statement_include_template_list
statement_include_template
: STRING_LITERAL
| list_literal
| variable_name
@ -38,11 +38,20 @@ statement_include_context
statement_include
: STATEMENT_ID_INCLUDE
(SP statement_include_template_list)
(SP statement_include_template)
(SP STATEMENT_INCLUDE_IGNORE_MISSING)?
(SP statement_include_context)?
;
statement_import_file
: STRING_LITERAL
| variable_name
;
statement_import
: STATEMENT_ID_IMPORT SP statement_import_file SP STATEMENT_ID_IMPORT_AS SP variable_name
;
block_statement_id
: STATEMENT_ID_BLOCK
| STATEMENT_ID_SET
@ -64,6 +73,7 @@ block_statement_start_content
inline_statement_content
: statement_include
| statement_import
;
inline_statement : STATEMENT_OPEN inline_statement_content STATEMENT_CLOSE;

View File

@ -84,6 +84,8 @@ STATEMENT_ID_INCLUDE : 'include';
STATEMENT_ID_RAW : 'raw';
STATEMENT_ID_SET : 'set';
STATEMENT_ID_IMPORT_AS : 'as';
STATEMENT_INCLUDE_IGNORE_MISSING : 'ignore missing';
STATEMENT_INCLUDE_WITH_CONTEXT : 'with context';
STATEMENT_INCLUDE_WITHOUT_CONTEXT : 'without context';