Browse Source
Support POSIX, bashism and mixed function declarations, all four compound command types, trailing comments and mixed whitespace. Even though Bash allows locale-dependent characters in function names <https://unix.stackexchange.com/a/245336/3645>, only detect function names with characters allowed by POSIX.1-2017 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_235> for simplicity. This should cover the vast majority of use cases, and produces system-agnostic results. Since a word pattern has to be specified, but there is no easy way to know the default word pattern, use the default `IFS` characters for a starter. A later patch can improve this. Signed-off-by: Victor Engmark <victor@engmark.name> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
Victor Engmark
4 years ago
committed by
Junio C Hamano
18 changed files with 91 additions and 0 deletions
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
RIGHT() (( |
||||
|
||||
ChangeMe = "$x" + "$y" |
||||
)) |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
function RIGHT { |
||||
function InvalidSyntax{ |
||||
: |
||||
echo 'ChangeMe' |
||||
} |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
function RIGHT { |
||||
: |
||||
echo 'ChangeMe' |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
function RIGHT ( ) { |
||||
|
||||
ChangeMe |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
RIGHT() [[ \ |
||||
|
||||
"$a" > "$ChangeMe" |
||||
]] |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
function RIGHT { |
||||
functionInvalidSyntax { |
||||
: |
||||
echo 'ChangeMe' |
||||
} |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
function RIGHT(){ |
||||
: |
||||
echo 'ChangeMe' |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
function RIGHT() { |
||||
|
||||
ChangeMe |
||||
} |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
outer() { |
||||
RIGHT() { |
||||
: |
||||
echo 'ChangeMe' |
||||
} |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
_RIGHT_0n() { |
||||
|
||||
ChangeMe |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
RIGHT(){ |
||||
|
||||
ChangeMe |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
RIGHT() { |
||||
|
||||
ChangeMe |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
RIGHT ( ) { |
||||
|
||||
ChangeMe |
||||
} |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
RIGHT() ( |
||||
|
||||
ChangeMe=2 |
||||
) |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
RIGHT() { # Comment |
||||
|
||||
ChangeMe |
||||
} |
Loading…
Reference in new issue