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,4 +1,10 @@
|
||||
func test-function($name) {
|
||||
if (5 -lt $var) {
|
||||
echo good
|
||||
} else {
|
||||
echo bad
|
||||
}
|
||||
|
||||
echo "Hello, $name! $(2 + 4 + 2) wow"
|
||||
}
|
||||
|
||||
@@ -11,4 +17,6 @@ $hash = @{
|
||||
'three' = 3
|
||||
}
|
||||
|
||||
$hash2 = @{ 1 = 'one'; 2 = 'two'; 'three' = 3 }
|
||||
|
||||
test-function -name $obj
|
||||
|
||||
+14
-11
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user