doc: sample: add/update sample source files
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
Get-Verb | %{ echo "Item: $($_.verb)" }
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
if ($x -gt 5) {
|
||||||
|
echo hi
|
||||||
|
} elseif ($x -lt 10) {
|
||||||
|
echo bye
|
||||||
|
} else {
|
||||||
|
echo none
|
||||||
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
echo hello 2> error.txt | ls -la | echo done; exit -1
|
echo hello$name 2> error.txt | ls -la | echo done; exit -1
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
echo 1 2 3 | %{ echo "Item: $_" }
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
func test-function($name) {
|
func test-function($name) {
|
||||||
echo "Hello, $name! $(2 + 4 + 2) wow"
|
if (5 -lt $var) {
|
||||||
|
echo good
|
||||||
|
} else {
|
||||||
|
echo bad
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Hello, $name! $(2 + 4 + 2) wow"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Example of instantiating an FX runtime object.
|
# Example of instantiating an FX runtime object.
|
||||||
@@ -11,4 +17,6 @@ $hash = @{
|
|||||||
'three' = 3
|
'three' = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hash2 = @{ 1 = 'one'; 2 = 'two'; 'three' = 3 }
|
||||||
|
|
||||||
test-function -name $obj
|
test-function -name $obj
|
||||||
|
|||||||
+14
-11
@@ -31,12 +31,12 @@ $a$b
|
|||||||
# VAR(a)
|
# VAR(a)
|
||||||
# VAR(b)
|
# 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.
|
# mode, which will allow the following word construction to be used.
|
||||||
# this executes the command whose name is equal to concatenating the values
|
# this executes the command whose name is equal to concatenating the values
|
||||||
# of $a and $b (in this case, '24')
|
# of $a and $b (in this case, '24')
|
||||||
% $a$b
|
& $a$b
|
||||||
# SYMBOL(%)
|
# SYMBOL(&)
|
||||||
# WORD_START
|
# WORD_START
|
||||||
# VAR(a)
|
# VAR(a)
|
||||||
# VAR(b)
|
# VAR(b)
|
||||||
@@ -51,7 +51,7 @@ a+2b
|
|||||||
# the first char encountered is a symbol, which is read as a word in COMMAND
|
# the first char encountered is a symbol, which is read as a word in COMMAND
|
||||||
# mode
|
# mode
|
||||||
-no$a
|
-no$a
|
||||||
# WORD(-no)
|
# WORD(-no$a)
|
||||||
|
|
||||||
# returns the result of applying the NOT operator to the value of $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
|
# the first char encountered is a symbol, which is read as a word in COMMAND
|
||||||
@@ -62,16 +62,19 @@ a+2b
|
|||||||
# OP(not)
|
# OP(not)
|
||||||
# VAR(a)
|
# 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.
|
# because of the preceding hyphen, variable substitution is not performed.
|
||||||
% -not$a
|
& -not$a
|
||||||
# SYMBOL(%)
|
# SYMBOL(&)
|
||||||
# WORD(-not$a)
|
# 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.
|
# variable substitution IS performed in dquote strings regardless of the hyphen.
|
||||||
% "-not$a"
|
& "-not$a"
|
||||||
# SYMBOL(%)
|
# SYMBOL(&)
|
||||||
# STR_START
|
# STR_START
|
||||||
# STRING(-not)
|
# STRING(-not)
|
||||||
# VAR(a)
|
# VAR(a)
|
||||||
|
|||||||
Reference in New Issue
Block a user