doc: sample: add/update sample source files

This commit is contained in:
2026-05-24 20:26:40 +01:00
parent bb09e8b8d1
commit 28f8c8f71c
6 changed files with 33 additions and 13 deletions
+14 -11
View File
@@ -31,12 +31,12 @@ $a$b
# VAR(a)
# VAR(b)
# When the parser encounters SYMBOL(%) it should switch the lexer to COMMAND
# When the parser encounters SYMBOL(&) it should switch the lexer to COMMAND
# mode, which will allow the following word construction to be used.
# this executes the command whose name is equal to concatenating the values
# of $a and $b (in this case, '24')
% $a$b
# SYMBOL(%)
& $a$b
# SYMBOL(&)
# WORD_START
# VAR(a)
# VAR(b)
@@ -51,7 +51,7 @@ a+2b
# the first char encountered is a symbol, which is read as a word in COMMAND
# mode
-no$a
# WORD(-no)
# WORD(-no$a)
# returns the result of applying the NOT operator to the value of $a.
# the first char encountered is a symbol, which is read as a word in COMMAND
@@ -62,16 +62,19 @@ a+2b
# OP(not)
# VAR(a)
# executes the command with the name '-not$a' ($a is NOT substituted)
# executes the command with the name '-not$a' ($a is substituted)
# because of the preceding hyphen, variable substitution is not performed.
% -not$a
# SYMBOL(%)
# WORD(-not$a)
& -not$a
# SYMBOL(&)
# WORD_START
# WORD(-not)
# VAR(a)
# WORD_END
# executes the command with the name '-not2' ($a IS substituted)
# executes the command with the name "-not$a" ($a IS substituted)
# variable substitution IS performed in dquote strings regardless of the hyphen.
% "-not$a"
# SYMBOL(%)
& "-not$a"
# SYMBOL(&)
# STR_START
# STRING(-not)
# VAR(a)