From 9d5ed45e6c4c48c48a22a02f0571bc3ae820f150 Mon Sep 17 00:00:00 2001 From: sagebind Date: Sat, 3 Feb 2024 07:31:59 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=208486a?= =?UTF-8?q?1c883386eb0ded700862257a50c216cfafe=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- guide.html | 2 +- reference.html | 25 ++++++++++++++++++------- ripshell.html | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/guide.html b/guide.html index ecde57b..18d5041 100644 --- a/guide.html +++ b/guide.html @@ -1044,7 +1044,7 @@

9. Examples

diff --git a/reference.html b/reference.html index b7a5878..9846693 100644 --- a/reference.html +++ b/reference.html @@ -641,20 +641,23 @@

2.5. Formal grammar

block_params = { "<" ~ block_params_list ~ ">" } block_params_list = _{ vararg_param_decl - | param_decl ~ block_params_list? + | param_decl ~ ("," ~ block_params_list)? } param_decl = { symbol } vararg_param_decl = { "..." ~ symbol } +// A subroutine is just a block with an explicit name. +subroutine = { "sub" ~ symbol ~ block } + // Blocks and programs are lists of statements. statement_list = { statement_separator* ~ (statement ~ (statement_separator+ ~ statement)*)? ~ statement_separator* } statement_separator = _{ NEWLINE | ";" } // A statement can be either an assignment or a pipeline. -statement = _{ import_statement | assignment_statement | pipeline_statement } +statement = _{ import_statement | assignment_statement | return_statement | pipeline_statement } -import_statement = { "import" ~ string_literal ~ "for" ~ import_clause } +import_statement = { KEYWORD_IMPORT ~ string_literal ~ "for" ~ import_clause } import_clause = { import_wildcard | import_items } import_items = { string_literal+ } import_wildcard = { "*" } @@ -667,6 +670,8 @@

2.5. Formal grammar

| &"$" ~ variable_substitution } +return_statement = { KEYWORD_RETURN ~ expr? } + pipeline_statement = { pipeline } // Expression is the main syntax building block. @@ -676,6 +681,7 @@

2.5. Formal grammar

} unary_expr = _{ block + | subroutine | "(" ~ pipeline ~ ")" | cvar_scope | cvar @@ -712,7 +718,7 @@

2.5. Formal grammar

cvar = ${ "@" ~ string_literal } // Binds a context variable to a value for the duration of a scope. -cvar_scope = { "let" ~ cvar ~ "=" ~ expr ~ block } +cvar_scope = { KEYWORD_LET ~ cvar ~ "=" ~ expr ~ block } // Dollar sign indicates the start of some form of substitution. substitution = ${ &"$" ~ ( @@ -756,7 +762,7 @@

2.5. Formal grammar

// A list of keywords that are not allowed as bare identifiers because they have // special meaning. -reserved_words = _{ "import" | "let" } +reserved_words = _{ KEYWORD_IMPORT | KEYWORD_LET | KEYWORD_RETURN } // Operator to access namespaces and table members. member_operator = _{ "->" } @@ -770,7 +776,12 @@

2.5. Formal grammar

// Only horizontal whitespace is insignificant; vertical whitespace is used to // separate staements in blocks. -WHITESPACE = _{ " " | "\t" | "\\" ~ NEWLINE } +WHITESPACE = _{ " " | "\t" | "\\" ~ NEWLINE } + +// All reserved keywords. +KEYWORD_IMPORT = _{ "import" } +KEYWORD_LET = _{ "let" } +KEYWORD_RETURN = _{ "return" }
@@ -1501,7 +1512,7 @@

Appendix B: Influences

diff --git a/ripshell.html b/ripshell.html index 6138085..a1b7f75 100644 --- a/ripshell.html +++ b/ripshell.html @@ -556,7 +556,7 @@

Appendix A: Goals