fix build under newer KConfig by bump cmake min version

This commit is contained in:
2024-09-04 19:01:58 +08:00
parent 727a2ec214
commit 9fb3681e3a
1022 changed files with 4414 additions and 1375 deletions

View File

@ -0,0 +1,21 @@
hello="hello, "
hello+=word
echo $hello
for ((i = 2; i > 0; i--)); do
echo postfix dec $i
done
for ((i = 2; i > 0; --i)); do
echo prefix dec $i
done
for ((i = 0; i < 2; i++)); do
echo postfix inc $i
done
for ((i = 0; i < 2; ++i)); do
echo prefix inc $i
done
# issue 215
for ((i = 0; i < 2; i++)); do
echo $((((1)) << i))
done

View File

@ -0,0 +1,22 @@
0 400 0 hello="hello, "
0 400 0 hello+=word
0 400 0 echo $hello
1 400 0
2 400 0 + for ((i = 2; i > 0; i--)); do
0 401 0 | echo postfix dec $i
0 401 0 | done
2 400 0 + for ((i = 2; i > 0; --i)); do
0 401 0 | echo prefix dec $i
0 401 0 | done
2 400 0 + for ((i = 0; i < 2; i++)); do
0 401 0 | echo postfix inc $i
0 401 0 | done
2 400 0 + for ((i = 0; i < 2; ++i)); do
0 401 0 | echo prefix inc $i
0 401 0 | done
1 400 0
0 400 0 # issue 215
2 400 0 + for ((i = 0; i < 2; i++)); do
0 401 0 | echo $((((1)) << i))
0 401 0 | done
0 400 0

View File

@ -0,0 +1,21 @@
{8}hello{7}={5}"hello, "{0}
{8}hello{7}+={8}word{0}
{4}echo{0} {9}$hello{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}2{7};{0} {8}i{0} {7}>{0} {3}0{7};{0} {8}i{7}--));{0} {4}do{0}
{4}echo{0} {8}postfix{0} {8}dec{0} {9}$i{0}
{4}done{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}2{7};{0} {8}i{0} {7}>{0} {3}0{7};{0} {7}--{8}i{7}));{0} {4}do{0}
{4}echo{0} {8}prefix{0} {8}dec{0} {9}$i{0}
{4}done{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}0{7};{0} {8}i{0} {7}<{0} {3}2{7};{0} {8}i{7}++));{0} {4}do{0}
{4}echo{0} {8}postfix{0} {8}inc{0} {9}$i{0}
{4}done{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}0{7};{0} {8}i{0} {7}<{0} {3}2{7};{0} {7}++{8}i{7}));{0} {4}do{0}
{4}echo{0} {8}prefix{0} {8}inc{0} {9}$i{0}
{4}done{0}
{2}# issue 215{0}
{4}for{0} {7}(({8}i{0} {7}={0} {3}0{7};{0} {8}i{0} {7}<{0} {3}2{7};{0} {8}i{7}++));{0} {4}do{0}
{4}echo{0} {7}$(((({3}1{7})){0} {7}<<{0} {8}i{7})){0}
{4}done{0}

View File

@ -0,0 +1,90 @@
# Lexing numeric literals
# From issue #199
# UUIDs
virsh start 61a6a312-86d3-458c-824a-fa0adc2bd22c
virsh start 61969312-86d3-458c-8249-fa0adc2bd22c
virsh restore /opt/61a6a312-86d3-458c-824a-fa0adc2bd22c-suspend
# Git items
git checkout 998d611b516b0e485803089ecd53fdf0ea707a8c
git log --no-walk 0e2ba9c
git log --no-walk rel-5-2-4-97-g7405d4e7
# Arithmetic and character ranges
declare -i a=1+1; echo $a
[[ $a == [0-9] ]] && echo 1
# Brace expansion
for i in {1..10..2}; do
echo $i
done
for a in {A..Z..2}; do
echo $a
done
# From Kein-Hong Man
#--------------------------------------------------------------------------
# Bash number formats
# (20070712)
# Octal lexing relaxed to allow hex digits to avoid flagging unnecessary
# and misleading number errors; radix-prefixed lexing behaviour is unchanged,
# as those cases are uncommon (to get strict lexing, define PEDANTIC_OCTAL).
# NOTE: Some people may want an entire non-number to be lexed in the normal
# style and not as part-number part-normal. If the user thinks there is a
# better case for the former, please lobby for it on the SF issue tracker.
0123 0567 # octal good
08 0789 077ABC # octal bad (disabled 20070712, now lexed as numbers)
066XYZ # octal bad
0xDEAD 0X1234 # hex good
0xABCMNO 0XGHI # hex bad
# extended "[base#]n" format where base is between 2-64
# digits range are 0-9a-zA-Z@_
# if base <= 36, then alphabets are case insensitive
# this style isn't likely in non-number code, so the lexer currently
# opts to colour the error in red -- send feedback if this is too
# intrusive; 'invalid octals' (but valid text) in red proved annoying...
2#10101 # binary
2#23456 # error (in red)
8#0123456789AB # error (in red)
16#abcDEF123
16#abcpqr # bad
64#xyzXYZ@_789 # full base-64
99#xyzXYZ@_789 # error (in red; invalid base)
111#xyzXYZ@_789 # error (in red; invalid base)
567+0123*0xBCD # with operators
(4#0123-3#012)
# 20070712:
# Octal lexing relaxed to avoid marking some number sequences as octal
# errors. This is because the elements or apps controlled by bash may
# have a different view of numbers, so we avoid flagging unnecessary
# (and misleading) number errors. Radix-prefixed number lexing is
# unchanged, as those cases are uncommon (no feedback on it yet.)
# In the following, red-flagged 'octals' should now be lexed as normal
# numbers, allowing hex digits.
# flightgear missing.sh
scriptversion=2004-09-07.08
# git t/t0000/basic.sh
P=087704a96baf1c2d1c869a8b084481e121c88b5b
# openssh config.guess
*:procnto*:*:* | *:QNX:[0123456789]*:*)
# with hex digits, the following will still be an invalid number
066XYZ

View File

@ -0,0 +1,91 @@
0 400 0 # Lexing numeric literals
1 400 0
0 400 0 # From issue #199
1 400 0
0 400 0 # UUIDs
1 400 0
0 400 0 virsh start 61a6a312-86d3-458c-824a-fa0adc2bd22c
0 400 0 virsh start 61969312-86d3-458c-8249-fa0adc2bd22c
0 400 0 virsh restore /opt/61a6a312-86d3-458c-824a-fa0adc2bd22c-suspend
1 400 0
0 400 0 # Git items
1 400 0
0 400 0 git checkout 998d611b516b0e485803089ecd53fdf0ea707a8c
1 400 0
0 400 0 git log --no-walk 0e2ba9c
0 400 0 git log --no-walk rel-5-2-4-97-g7405d4e7
1 400 0
0 400 0 # Arithmetic and character ranges
1 400 0
0 400 0 declare -i a=1+1; echo $a
0 400 0 [[ $a == [0-9] ]] && echo 1
1 400 0
0 400 0 # Brace expansion
1 400 0
2 400 0 + for i in {1..10..2}; do
0 401 0 | echo $i
0 401 0 | done
2 400 0 + for a in {A..Z..2}; do
0 401 0 | echo $a
0 401 0 | done
1 400 0
0 400 0 # From Kein-Hong Man
1 400 0
2 400 0 + #--------------------------------------------------------------------------
0 401 0 | # Bash number formats
0 401 0 | # (20070712)
0 401 0 | # Octal lexing relaxed to allow hex digits to avoid flagging unnecessary
0 401 0 | # and misleading number errors; radix-prefixed lexing behaviour is unchanged,
0 401 0 | # as those cases are uncommon (to get strict lexing, define PEDANTIC_OCTAL).
1 400 0
2 400 0 + # NOTE: Some people may want an entire non-number to be lexed in the normal
0 401 0 | # style and not as part-number part-normal. If the user thinks there is a
0 401 0 | # better case for the former, please lobby for it on the SF issue tracker.
1 400 0
0 400 0 0123 0567 # octal good
0 400 0 08 0789 077ABC # octal bad (disabled 20070712, now lexed as numbers)
0 400 0 066XYZ # octal bad
0 400 0 0xDEAD 0X1234 # hex good
0 400 0 0xABCMNO 0XGHI # hex bad
1 400 0
2 400 0 + # extended "[base#]n" format where base is between 2-64
0 401 0 | # digits range are 0-9a-zA-Z@_
0 401 0 | # if base <= 36, then alphabets are case insensitive
0 401 0 | # this style isn't likely in non-number code, so the lexer currently
0 401 0 | # opts to colour the error in red -- send feedback if this is too
0 401 0 | # intrusive; 'invalid octals' (but valid text) in red proved annoying...
1 400 0
0 400 0 2#10101 # binary
0 400 0 2#23456 # error (in red)
0 400 0 8#0123456789AB # error (in red)
0 400 0 16#abcDEF123
0 400 0 16#abcpqr # bad
0 400 0 64#xyzXYZ@_789 # full base-64
0 400 0 99#xyzXYZ@_789 # error (in red; invalid base)
0 400 0 111#xyzXYZ@_789 # error (in red; invalid base)
1 400 0
0 400 0 567+0123*0xBCD # with operators
0 400 0 (4#0123-3#012)
1 400 0
2 400 0 + # 20070712:
0 401 0 | # Octal lexing relaxed to avoid marking some number sequences as octal
0 401 0 | # errors. This is because the elements or apps controlled by bash may
0 401 0 | # have a different view of numbers, so we avoid flagging unnecessary
0 401 0 | # (and misleading) number errors. Radix-prefixed number lexing is
0 401 0 | # unchanged, as those cases are uncommon (no feedback on it yet.)
1 400 0
2 400 0 + # In the following, red-flagged 'octals' should now be lexed as normal
0 401 0 | # numbers, allowing hex digits.
1 400 0
0 400 0 # flightgear missing.sh
0 400 0 scriptversion=2004-09-07.08
1 400 0
0 400 0 # git t/t0000/basic.sh
0 400 0 P=087704a96baf1c2d1c869a8b084481e121c88b5b
1 400 0
0 400 0 # openssh config.guess
0 400 0 *:procnto*:*:* | *:QNX:[0123456789]*:*)
1 400 0
0 400 0 # with hex digits, the following will still be an invalid number
0 400 0 066XYZ
0 400 0

View File

@ -0,0 +1,90 @@
{2}# Lexing numeric literals{0}
{2}# From issue #199{0}
{2}# UUIDs{0}
{8}virsh{0} {8}start{0} {8}61a6a312-86d3-458c-824a-fa0adc2bd22c{0}
{8}virsh{0} {8}start{0} {8}61969312-86d3-458c-8249-fa0adc2bd22c{0}
{8}virsh{0} {8}restore{0} {7}/{8}opt{7}/{8}61a6a312-86d3-458c-824a-fa0adc2bd22c-suspend{0}
{2}# Git items{0}
{8}git{0} {8}checkout{0} {8}998d611b516b0e485803089ecd53fdf0ea707a8c{0}
{8}git{0} {8}log{0} {8}--no-walk{0} {8}0e2ba9c{0}
{8}git{0} {8}log{0} {8}--no-walk{0} {8}rel-5-2-4-97-g7405d4e7{0}
{2}# Arithmetic and character ranges{0}
{8}declare{0} {8}-i{0} {8}a{7}={3}1{7}+{3}1{7};{0} {4}echo{0} {9}$a{0}
{7}[[{0} {9}$a{0} {7}=={0} {7}[{8}0-9{7}]{0} {7}]]{0} {7}&&{0} {4}echo{0} {3}1{0}
{2}# Brace expansion{0}
{4}for{0} {8}i{0} {4}in{0} {7}{{3}1{7}..{3}10{7}..{3}2{7}};{0} {4}do{0}
{4}echo{0} {9}$i{0}
{4}done{0}
{4}for{0} {8}a{0} {4}in{0} {7}{{8}A{7}..{8}Z{7}..{3}2{7}};{0} {4}do{0}
{4}echo{0} {9}$a{0}
{4}done{0}
{2}# From Kein-Hong Man{0}
{2}#--------------------------------------------------------------------------{0}
{2}# Bash number formats{0}
{2}# (20070712){0}
{2}# Octal lexing relaxed to allow hex digits to avoid flagging unnecessary{0}
{2}# and misleading number errors; radix-prefixed lexing behaviour is unchanged,{0}
{2}# as those cases are uncommon (to get strict lexing, define PEDANTIC_OCTAL).{0}
{2}# NOTE: Some people may want an entire non-number to be lexed in the normal{0}
{2}# style and not as part-number part-normal. If the user thinks there is a{0}
{2}# better case for the former, please lobby for it on the SF issue tracker.{0}
{3}0123{0} {3}0567{0} {2}# octal good{0}
{3}08{0} {3}0789{0} {8}077ABC{0} {2}# octal bad (disabled 20070712, now lexed as numbers){0}
{8}066XYZ{0} {2}# octal bad{0}
{3}0xDEAD{0} {3}0X1234{0} {2}# hex good{0}
{8}0xABCMNO{0} {8}0XGHI{0} {2}# hex bad{0}
{2}# extended "[base#]n" format where base is between 2-64{0}
{2}# digits range are 0-9a-zA-Z@_{0}
{2}# if base <= 36, then alphabets are case insensitive{0}
{2}# this style isn't likely in non-number code, so the lexer currently{0}
{2}# opts to colour the error in red -- send feedback if this is too{0}
{2}# intrusive; 'invalid octals' (but valid text) in red proved annoying...{0}
{3}2#10101{0} {2}# binary{0}
{1}2#23456{0} {2}# error (in red){0}
{1}8#0123456789{8}AB{0} {2}# error (in red){0}
{3}16#abcDEF123{0}
{8}16#abcpqr{0} {2}# bad{0}
{3}64#xyzXYZ@_789{0} {2}# full base-64{0}
{1}99{8}#xyzXYZ{7}@{8}_789{0} {2}# error (in red; invalid base){0}
{1}111{8}#xyzXYZ{7}@{8}_789{0} {2}# error (in red; invalid base){0}
{3}567{7}+{3}0123{7}*{3}0xBCD{0} {2}# with operators{0}
{8}(4#0123-3#012){0}
{2}# 20070712:{0}
{2}# Octal lexing relaxed to avoid marking some number sequences as octal{0}
{2}# errors. This is because the elements or apps controlled by bash may{0}
{2}# have a different view of numbers, so we avoid flagging unnecessary{0}
{2}# (and misleading) number errors. Radix-prefixed number lexing is{0}
{2}# unchanged, as those cases are uncommon (no feedback on it yet.){0}
{2}# In the following, red-flagged 'octals' should now be lexed as normal{0}
{2}# numbers, allowing hex digits.{0}
{2}# flightgear missing.sh{0}
{8}scriptversion{7}={8}2004-09-07.08{0}
{2}# git t/t0000/basic.sh{0}
{8}P{7}={8}087704a96baf1c2d1c869a8b084481e121c88b5b{0}
{2}# openssh config.guess{0}
{7}*:{8}procnto{7}*:*:*{0} {7}|{0} {7}*:{8}QNX{7}:[{3}0123456789{7}]*:*){0}
{2}# with hex digits, the following will still be an invalid number{0}
{8}066XYZ{0}

View File

@ -0,0 +1,41 @@
-a
#
-b
#
declare -A optionSet=([--help]=0)
for option in {-h,--help,--version,--verbose,-,--}; do
case $option in
-h|--help)
optionSet[--help]=1
echo help: $option
;;
-*-version)
echo version: $option
;;
--)
echo stop
;;
-)
echo stdin
;;
-*[-a-zA-Z0-9])
echo other: $option
;;
esac
done
option=--help
[[ $option == *-h* ]] && echo $option=${optionSet[$option]}
for gcc in gcc{,-1{4..0..-1}}; do
echo $gcc
done
for gcc in gcc{,{-14..-10}}; do
echo $gcc
done
# Tilde-refix ~
~+/foo
~-/foo

View File

@ -0,0 +1,42 @@
0 400 0 -a
0 400 0 #
0 400 0 -b
0 400 0 #
1 400 0
0 400 0 declare -A optionSet=([--help]=0)
2 400 0 + for option in {-h,--help,--version,--verbose,-,--}; do
2 401 0 + case $option in
0 402 0 | -h|--help)
0 402 0 | optionSet[--help]=1
0 402 0 | echo help: $option
0 402 0 | ;;
0 402 0 | -*-version)
0 402 0 | echo version: $option
0 402 0 | ;;
0 402 0 | --)
0 402 0 | echo stop
0 402 0 | ;;
0 402 0 | -)
0 402 0 | echo stdin
0 402 0 | ;;
0 402 0 | -*[-a-zA-Z0-9])
0 402 0 | echo other: $option
0 402 0 | ;;
0 402 0 | esac
0 401 0 | done
1 400 0
0 400 0 option=--help
0 400 0 [[ $option == *-h* ]] && echo $option=${optionSet[$option]}
1 400 0
2 400 0 + for gcc in gcc{,-1{4..0..-1}}; do
0 401 0 | echo $gcc
0 401 0 | done
1 400 0
2 400 0 + for gcc in gcc{,{-14..-10}}; do
0 401 0 | echo $gcc
0 401 0 | done
1 400 0
0 400 0 # Tilde-refix ~
0 400 0 ~+/foo
0 400 0 ~-/foo
0 400 0

View File

@ -0,0 +1,41 @@
{8}-a{0}
{2}#{0}
{8}-b{0}
{2}#{0}
{8}declare{0} {8}-A{0} {8}optionSet{7}=([{8}--help{7}]={3}0{7}){0}
{4}for{0} {8}option{0} {4}in{0} {7}{{8}-h{7},{8}--help{7},{8}--version{7},{8}--verbose{7},{8}-{7},{8}--{7}};{0} {4}do{0}
{4}case{0} {9}$option{0} {4}in{0}
{8}-h{7}|{8}--help{7}){0}
{8}optionSet{7}[{8}--help{7}]={3}1{0}
{4}echo{0} {8}help{7}:{0} {9}$option{0}
{7};;{0}
{8}-{7}*{8}-version{7}){0}
{4}echo{0} {8}version{7}:{0} {9}$option{0}
{7};;{0}
{8}--{7}){0}
{4}echo{0} {8}stop{0}
{7};;{0}
{8}-{7}){0}
{4}echo{0} {8}stdin{0}
{7};;{0}
{8}-{7}*[{8}-a-zA-Z0-9{7}]){0}
{4}echo{0} {8}other{7}:{0} {9}$option{0}
{7};;{0}
{4}esac{0}
{4}done{0}
{8}option{7}={8}--help{0}
{7}[[{0} {9}$option{0} {7}=={0} {7}*{8}-h{7}*{0} {7}]]{0} {7}&&{0} {4}echo{0} {9}$option{7}={10}${optionSet[$option]}{0}
{4}for{0} {8}gcc{0} {4}in{0} {8}gcc{7}{,-{3}1{7}{{3}4{7}..{3}0{7}..-{3}1{7}}};{0} {4}do{0}
{4}echo{0} {9}$gcc{0}
{4}done{0}
{4}for{0} {8}gcc{0} {4}in{0} {8}gcc{7}{,{-{3}14{7}..-{3}10{7}}};{0} {4}do{0}
{4}echo{0} {9}$gcc{0}
{4}done{0}
{2}# Tilde-refix ~{0}
{7}~+/{8}foo{0}
{7}~-/{8}foo{0}

View File

@ -0,0 +1,24 @@
[[ $1 == -e* ]] && echo e
if [[ -d /usr/bin &&
-e /usr/bin/bash ]]; then
echo find bash
fi
if [[ -d /usr/bin && -e /usr/bin/bash ]]; then
echo find bash
fi
if [ -d /usr/bin && -e /usr/bin/bash ]; then
echo find bash
fi
if [ -d /usr/bin &&
-e /usr/bin/bash ]; then
echo find bash
fi
if [ -d /usr/bin && \
-e /usr/bin/bash ]; then
echo find bash
fi

View File

@ -0,0 +1,25 @@
0 400 0 [[ $1 == -e* ]] && echo e
1 400 0
2 400 0 + if [[ -d /usr/bin &&
0 401 0 | -e /usr/bin/bash ]]; then
0 401 0 | echo find bash
0 401 0 | fi
1 400 0
2 400 0 + if [[ -d /usr/bin && -e /usr/bin/bash ]]; then
0 401 0 | echo find bash
0 401 0 | fi
1 400 0
2 400 0 + if [ -d /usr/bin && -e /usr/bin/bash ]; then
0 401 0 | echo find bash
0 401 0 | fi
1 400 0
2 400 0 + if [ -d /usr/bin &&
0 401 0 | -e /usr/bin/bash ]; then
0 401 0 | echo find bash
0 401 0 | fi
1 400 0
2 400 0 + if [ -d /usr/bin && \
0 401 0 | -e /usr/bin/bash ]; then
0 401 0 | echo find bash
0 401 0 | fi
0 400 0

View File

@ -0,0 +1,24 @@
{7}[[{0} {9}$1{0} {7}=={0} {8}-e{7}*{0} {7}]]{0} {7}&&{0} {4}echo{0} {8}e{0}
{4}if{0} {7}[[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0}
{4}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}]];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}
{4}if{0} {7}[[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0} {4}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}]];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}
{4}if{0} {7}[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0} {8}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}
{4}if{0} {7}[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0}
{8}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}
{4}if{0} {7}[{0} {4}-d{0} {7}/{8}usr{7}/{8}bin{0} {7}&&{0} {7}\{0}
{8}-e{0} {7}/{8}usr{7}/{8}bin{7}/{8}bash{0} {7}];{0} {4}then{0}
{4}echo{0} {8}find{0} {8}bash{0}
{4}fi{0}

View File

@ -0,0 +1,73 @@
cat <<A\"
$(echo 00)
A"
cat <<A\\\"
$(echo 01)
A\"
cat <<A\B
$(echo 1)
AB
cat <<A\\B
$(echo 2)
A\B
cat <<A\\\B
$(echo 3)
A\B
cat <<A\\\\B
$(echo 4)
A\\B
cat <<A\\\\\B
$(echo 5)
A\\B
cat <<'A\'
$(echo 10)
A\
cat <<'A\B'
$(echo 11)
A\B
cat <<'A\\B'
$(echo 12)
A\\B
cat <<'A\\\B'
$(echo 13)
A\\\B
cat <<'A\\\\B'
$(echo 14)
A\\\\B
cat <<"A\""
$(echo 20)
A"
cat <<"A\B"
$(echo 21)
A\B
cat <<"A\\B"
$(echo 22)
A\B
cat <<"A\\\B"
$(echo 23)
A\\B
cat <<"A\\\\B"
$(echo 24)
A\\B
cat <<"A\\\\\B"
$(echo 25)
A\\\B
echo x

View File

@ -0,0 +1,74 @@
2 400 0 + cat <<A\"
0 401 0 | $(echo 00)
0 401 0 | A"
1 400 0
2 400 0 + cat <<A\\\"
0 401 0 | $(echo 01)
0 401 0 | A\"
1 400 0
2 400 0 + cat <<A\B
0 401 0 | $(echo 1)
0 401 0 | AB
1 400 0
2 400 0 + cat <<A\\B
0 401 0 | $(echo 2)
0 401 0 | A\B
1 400 0
2 400 0 + cat <<A\\\B
0 401 0 | $(echo 3)
0 401 0 | A\B
1 400 0
2 400 0 + cat <<A\\\\B
0 401 0 | $(echo 4)
0 401 0 | A\\B
1 400 0
2 400 0 + cat <<A\\\\\B
0 401 0 | $(echo 5)
0 401 0 | A\\B
1 400 0
2 400 0 + cat <<'A\'
0 401 0 | $(echo 10)
0 401 0 | A\
1 400 0
2 400 0 + cat <<'A\B'
0 401 0 | $(echo 11)
0 401 0 | A\B
1 400 0
2 400 0 + cat <<'A\\B'
0 401 0 | $(echo 12)
0 401 0 | A\\B
1 400 0
2 400 0 + cat <<'A\\\B'
0 401 0 | $(echo 13)
0 401 0 | A\\\B
1 400 0
2 400 0 + cat <<'A\\\\B'
0 401 0 | $(echo 14)
0 401 0 | A\\\\B
1 400 0
2 400 0 + cat <<"A\""
0 401 0 | $(echo 20)
0 401 0 | A"
1 400 0
2 400 0 + cat <<"A\B"
0 401 0 | $(echo 21)
0 401 0 | A\B
1 400 0
2 400 0 + cat <<"A\\B"
0 401 0 | $(echo 22)
0 401 0 | A\B
1 400 0
2 400 0 + cat <<"A\\\B"
0 401 0 | $(echo 23)
0 401 0 | A\\B
1 400 0
2 400 0 + cat <<"A\\\\B"
0 401 0 | $(echo 24)
0 401 0 | A\\B
1 400 0
2 400 0 + cat <<"A\\\\\B"
0 401 0 | $(echo 25)
0 401 0 | A\\\B
1 400 0
0 400 0 echo x
0 400 0

View File

@ -0,0 +1,73 @@
{4}cat{0} {12}<<A\"{13}
$(echo 00)
{12}A"{0}
{4}cat{0} {12}<<A\\\"{13}
$(echo 01)
{12}A\"{0}
{4}cat{0} {12}<<A\B{13}
$(echo 1)
{12}AB{0}
{4}cat{0} {12}<<A\\B{13}
$(echo 2)
{12}A\B{0}
{4}cat{0} {12}<<A\\\B{13}
$(echo 3)
{12}A\B{0}
{4}cat{0} {12}<<A\\\\B{13}
$(echo 4)
{12}A\\B{0}
{4}cat{0} {12}<<A\\\\\B{13}
$(echo 5)
{12}A\\B{0}
{4}cat{0} {12}<<'A\'{13}
$(echo 10)
{12}A\{0}
{4}cat{0} {12}<<'A\B'{13}
$(echo 11)
{12}A\B{0}
{4}cat{0} {12}<<'A\\B'{13}
$(echo 12)
{12}A\\B{0}
{4}cat{0} {12}<<'A\\\B'{13}
$(echo 13)
{12}A\\\B{0}
{4}cat{0} {12}<<'A\\\\B'{13}
$(echo 14)
{12}A\\\\B{0}
{4}cat{0} {12}<<"A\""{13}
$(echo 20)
{12}A"{0}
{4}cat{0} {12}<<"A\B"{13}
$(echo 21)
{12}A\B{0}
{4}cat{0} {12}<<"A\\B"{13}
$(echo 22)
{12}A\B{0}
{4}cat{0} {12}<<"A\\\B"{13}
$(echo 23)
{12}A\\B{0}
{4}cat{0} {12}<<"A\\\\B"{13}
$(echo 24)
{12}A\\B{0}
{4}cat{0} {12}<<"A\\\\\B"{13}
$(echo 25)
{12}A\\\B{0}
{4}echo{0} {8}x{0}

View File

@ -0,0 +1,61 @@
# Enumerate all styles: 0 to 13
# comment=2
# whitespace=0
# w
# error=1
0#0000
# number=3
123
# keyword=4
set
# double-quoted-string=5
"string"
# single-quoted-string=6
'str'
# operator=7
+
# identifier=8
identifier
# scalar=9
$scalar
$?Status
# parameter-expansion=10
${parameter}
# back-ticks=11
`ls`
# here-doc-delimiter=12, here-doc=13
<<EOF
Here-doc.
EOF
# other quoted types are mapped to current classes
# double-quoted-string=5
$"string"
$'str'
# back-ticks=11
`ls`
$`ls`
$(ls)
# Use substyles
# Substyled identifier=128
map
# Substyled scalar=129
$CWD

View File

@ -0,0 +1,62 @@
0 400 0 # Enumerate all styles: 0 to 13
1 400 0
0 400 0 # comment=2
1 400 0
2 400 0 + # whitespace=0
0 401 0 | # w
1 400 0
0 400 0 # error=1
0 400 0 0#0000
1 400 0
0 400 0 # number=3
0 400 0 123
1 400 0
0 400 0 # keyword=4
0 400 0 set
1 400 0
0 400 0 # double-quoted-string=5
0 400 0 "string"
1 400 0
0 400 0 # single-quoted-string=6
0 400 0 'str'
1 400 0
0 400 0 # operator=7
0 400 0 +
1 400 0
0 400 0 # identifier=8
0 400 0 identifier
1 400 0
0 400 0 # scalar=9
0 400 0 $scalar
0 400 0 $?Status
1 400 0
0 400 0 # parameter-expansion=10
0 400 0 ${parameter}
1 400 0
0 400 0 # back-ticks=11
0 400 0 `ls`
1 400 0
0 400 0 # here-doc-delimiter=12, here-doc=13
2 400 0 + <<EOF
0 401 0 | Here-doc.
0 401 0 | EOF
1 400 0
0 400 0 # other quoted types are mapped to current classes
1 400 0
0 400 0 # double-quoted-string=5
0 400 0 $"string"
0 400 0 $'str'
1 400 0
0 400 0 # back-ticks=11
0 400 0 `ls`
0 400 0 $`ls`
0 400 0 $(ls)
1 400 0
0 400 0 # Use substyles
1 400 0
0 400 0 # Substyled identifier=128
0 400 0 map
1 400 0
0 400 0 # Substyled scalar=129
0 400 0 $CWD
0 400 0

View File

@ -0,0 +1,61 @@
{2}# Enumerate all styles: 0 to 13{0}
{2}# comment=2{0}
{2}# whitespace=0{0}
{2}# w{0}
{2}# error=1{0}
{1}0#0000{0}
{2}# number=3{0}
{3}123{0}
{2}# keyword=4{0}
{4}set{0}
{2}# double-quoted-string=5{0}
{5}"string"{0}
{2}# single-quoted-string=6{0}
{6}'str'{0}
{2}# operator=7{0}
{7}+{0}
{2}# identifier=8{0}
{8}identifier{0}
{2}# scalar=9{0}
{9}$scalar{0}
{9}$?{8}Status{0}
{2}# parameter-expansion=10{0}
{10}${parameter}{0}
{2}# back-ticks=11{0}
{11}`ls`{0}
{2}# here-doc-delimiter=12, here-doc=13{0}
{12}<<EOF{13}
Here-doc.
{12}EOF{0}
{2}# other quoted types are mapped to current classes{0}
{2}# double-quoted-string=5{0}
{5}$"string"{0}
{5}$'str'{0}
{2}# back-ticks=11{0}
{11}`ls`{0}
${11}`ls`{0}
{11}$(ls){0}
{2}# Use substyles{0}
{2}# Substyled identifier=128{0}
{128}map{0}
{2}# Substyled scalar=129{0}
{129}$CWD{0}

View File

@ -0,0 +1,7 @@
echo '$'
echo "$"
echo "$"
echo "$"x""
echo x$'\t'y
echo "x$'\t'y"
echo "x\ty"

View File

@ -0,0 +1,8 @@
0 400 0 echo '$'
0 400 0 echo "$"
0 400 0 echo "$"
0 400 0 echo "$"x""
0 400 0 echo x$'\t'y
0 400 0 echo "x$'\t'y"
0 400 0 echo "x\ty"
0 400 0

View File

@ -0,0 +1,7 @@
{4}echo{0} {6}'$'{0}
{4}echo{0} {5}"$"{0}
{4}echo{0} {5}"$"{0}
{4}echo{0} {5}"$"{8}x{5}""{0}
{4}echo{0} {8}x{5}$'\t'{8}y{0}
{4}echo{0} {5}"x$'\t'y"{0}
{4}echo{0} {5}"x\ty"{0}

View File

@ -0,0 +1,7 @@
if [ -n "$eth" -o -n "$wlan" ]; then
fi
test $((1 + 1)) -eq 2 && echo yes
[ $((1 + 1)) -eq 2 ] && echo yes
ls -a --directory

View File

@ -0,0 +1,8 @@
2 400 0 + if [ -n "$eth" -o -n "$wlan" ]; then
0 401 0 | fi
1 400 0
0 400 0 test $((1 + 1)) -eq 2 && echo yes
0 400 0 [ $((1 + 1)) -eq 2 ] && echo yes
1 400 0
0 400 0 ls -a --directory
0 400 0

View File

@ -0,0 +1,7 @@
{4}if{0} {7}[{0} {4}-n{0} {5}"{9}$eth{5}"{0} {4}-o{0} {4}-n{0} {5}"{9}$wlan{5}"{0} {7}];{0} {4}then{0}
{4}fi{0}
{4}test{0} {7}$(({3}1{0} {7}+{0} {3}1{7})){0} {4}-eq{0} {3}2{0} {7}&&{0} {4}echo{0} {8}yes{0}
{7}[{0} {7}$(({3}1{0} {7}+{0} {3}1{7})){0} {4}-eq{0} {3}2{0} {7}]{0} {7}&&{0} {4}echo{0} {8}yes{0}
{8}ls{0} {8}-a{0} {8}--directory{0}

View File

@ -0,0 +1,11 @@
echo $*
echo $@
echo $?
echo $-
echo $$
echo $!
echo $_
echo $%
echo $<
ifeth=$(ls /sys/class/net | grep ^"$intf" | grep "$intf"$)

View File

@ -0,0 +1,12 @@
0 400 0 echo $*
0 400 0 echo $@
0 400 0 echo $?
0 400 0 echo $-
0 400 0 echo $$
0 400 0 echo $!
0 400 0 echo $_
0 400 0 echo $%
0 400 0 echo $<
1 400 0
0 400 0 ifeth=$(ls /sys/class/net | grep ^"$intf" | grep "$intf"$)
0 400 0

View File

@ -0,0 +1,11 @@
{4}echo{0} {9}$*{0}
{4}echo{0} {9}$@{0}
{4}echo{0} {9}$?{0}
{4}echo{0} {9}$-{0}
{4}echo{0} {9}$${0}
{4}echo{0} {9}$!{0}
{4}echo{0} {9}$_{0}
{4}echo{0} ${7}%{0}
{4}echo{0} ${7}<{0}
{8}ifeth{7}=$({8}ls{0} {7}/{8}sys{7}/{8}class{7}/{8}net{0} {7}|{0} {8}grep{0} {7}^{5}"{9}$intf{5}"{0} {7}|{0} {8}grep{0} {5}"{9}$intf{5}"{0}${7}){0}

View File

@ -0,0 +1,11 @@
echo $*
echo $@
echo $?
echo $-
echo $$
echo $!
echo $_
echo $%
echo $<
ifeth=$(ls /sys/class/net | grep ^"$intf" | grep "$intf"$)

View File

@ -0,0 +1,12 @@
0 400 0 echo $*
0 400 0 echo $@
0 400 0 echo $?
0 400 0 echo $-
0 400 0 echo $$
0 400 0 echo $!
0 400 0 echo $_
0 400 0 echo $%
0 400 0 echo $<
1 400 0
0 400 0 ifeth=$(ls /sys/class/net | grep ^"$intf" | grep "$intf"$)
0 400 0

View File

@ -0,0 +1,11 @@
{4}echo{0} {9}$*{0}
{4}echo{0} {9}$@{0}
{4}echo{0} {9}$?{0}
{4}echo{0} {9}$-{0}
{4}echo{0} {9}$${0}
{4}echo{0} {9}$!{0}
{4}echo{0} {9}$_{0}
{4}echo{0} {9}$%{0}
{4}echo{0} {9}$<{0}
{8}ifeth{7}=$({8}ls{0} {7}/{8}sys{7}/{8}class{7}/{8}net{0} {7}|{0} {8}grep{0} {7}^{5}"{9}$intf{5}"{0} {7}|{0} {8}grep{0} {5}"{9}$intf{5}"{0}${7}){0}

View File

@ -0,0 +1,81 @@
# Nested elements and other complex cases
# String with backtick inclusion
"x`ls`"
# Nested string
"x`ls "*.c"`"
# Not terminated at first "
"x`ls" # "`" #
# String with command inclusion
"x$(ls)"
# Nested command
$(ls -la$(ls *.c))
# Check strings and backticks in command
echo $('ls' "." `ls` $'.' $".")
# $( not terminated by ) if contains unterminated string
$('x) # ') #
$("x) # ") #
$(`x) # `) # Bash doesn't like this
$($'x) # ') #
$($"x) # ") #
# Parameter expansion
var=abcdef
sub=abc
rep='& '
echo ${var/$sub/"${rep}}"} #
# issue 216
option="no[foo]"
option=${option%%[<{().[]*}
echo $option
# '$' in variable
echo $$PID
echo $var${var}
# Here-doc with internal elements
cat <<EOF
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Quoted delimiter treats here-doc as simple string
cat <<"EOF"
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Escaped same as quoted
cat <<\EOF
$scalar
EOF
# Nesting
echo "$((1 + 2))" #
echo "$[1 + 2]" #
# Multiple nesting levels
$(ls -la$(ls $(c) $'*.c' ` $(${s})`))
# Multi-line
$(ls |
more)
$(
`x`
"x"
`ls`
$'x'
$"x"
)
#end -- checks termination of previous

View File

@ -0,0 +1,82 @@
0 400 0 # Nested elements and other complex cases
1 400 0
0 400 0 # String with backtick inclusion
0 400 0 "x`ls`"
0 400 0 # Nested string
0 400 0 "x`ls "*.c"`"
0 400 0 # Not terminated at first "
0 400 0 "x`ls" # "`" #
1 400 0
0 400 0 # String with command inclusion
0 400 0 "x$(ls)"
1 400 0
0 400 0 # Nested command
0 400 0 $(ls -la$(ls *.c))
1 400 0
0 400 0 # Check strings and backticks in command
0 400 0 echo $('ls' "." `ls` $'.' $".")
1 400 0
0 400 0 # $( not terminated by ) if contains unterminated string
0 400 0 $('x) # ') #
0 400 0 $("x) # ") #
0 400 0 $(`x) # `) # Bash doesn't like this
0 400 0 $($'x) # ') #
0 400 0 $($"x) # ") #
1 400 0
0 400 0 # Parameter expansion
0 400 0 var=abcdef
0 400 0 sub=abc
0 400 0 rep='& '
0 400 0 echo ${var/$sub/"${rep}}"} #
0 400 0 # issue 216
0 400 0 option="no[foo]"
0 400 0 option=${option%%[<{().[]*}
0 400 0 echo $option
1 400 0
0 400 0 # '$' in variable
0 400 0 echo $$PID
0 400 0 echo $var${var}
1 400 0
0 400 0 # Here-doc with internal elements
2 400 0 + cat <<EOF
0 401 0 | $scalar
0 401 0 | ${var}
0 401 0 | $((1+2))
0 401 0 | $(pwd)
0 401 0 | `pwd`
0 401 0 | EOF
1 400 0
0 400 0 # Quoted delimiter treats here-doc as simple string
2 400 0 + cat <<"EOF"
0 401 0 | $scalar
0 401 0 | ${var}
0 401 0 | $((1+2))
0 401 0 | $(pwd)
0 401 0 | `pwd`
0 401 0 | EOF
1 400 0
0 400 0 # Escaped same as quoted
2 400 0 + cat <<\EOF
0 401 0 | $scalar
0 401 0 | EOF
1 400 0
0 400 0 # Nesting
0 400 0 echo "$((1 + 2))" #
0 400 0 echo "$[1 + 2]" #
1 400 0
0 400 0 # Multiple nesting levels
0 400 0 $(ls -la$(ls $(c) $'*.c' ` $(${s})`))
1 400 0
0 400 0 # Multi-line
0 400 0 $(ls |
0 400 0 more)
1 400 0
0 400 0 $(
0 400 0 `x`
0 400 0 "x"
0 400 0 `ls`
0 400 0 $'x'
0 400 0 $"x"
0 400 0 )
0 400 0 #end -- checks termination of previous
0 400 0

View File

@ -0,0 +1,81 @@
{2}# Nested elements and other complex cases{0}
{2}# String with backtick inclusion{0}
{5}"x`ls`"{0}
{2}# Nested string{0}
{5}"x`ls "*.c"`"{0}
{2}# Not terminated at first "{0}
{5}"x`ls" # "`"{0} {2}#{0}
{2}# String with command inclusion{0}
{5}"x$(ls)"{0}
{2}# Nested command{0}
{11}$(ls -la$(ls *.c)){0}
{2}# Check strings and backticks in command{0}
{4}echo{0} {11}$('ls' "." `ls` $'.' $"."){0}
{2}# $( not terminated by ) if contains unterminated string{0}
{11}$('x) # '){0} {2}#{0}
{11}$("x) # "){0} {2}#{0}
{11}$(`x) # `){0} {2}# Bash doesn't like this{0}
{11}$($'x) # '){0} {2}#{0}
{11}$($"x) # "){0} {2}#{0}
{2}# Parameter expansion{0}
{8}var{7}={8}abcdef{0}
{8}sub{7}={8}abc{0}
{8}rep{7}={6}'& '{0}
{4}echo{0} {10}${var/$sub/"${rep}}"}{0} {2}#{0}
{2}# issue 216{0}
{8}option{7}={5}"no[foo]"{0}
{8}option{7}={10}${option%%[<{().[]*}{0}
{4}echo{0} {9}$option{0}
{2}# '$' in variable{0}
{4}echo{0} {9}$${8}PID{0}
{4}echo{0} {9}$var{10}${var}{0}
{2}# Here-doc with internal elements{0}
{4}cat{0} {12}<<EOF{13}
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
{12}EOF{0}
{2}# Quoted delimiter treats here-doc as simple string{0}
{4}cat{0} {12}<<"EOF"{13}
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
{12}EOF{0}
{2}# Escaped same as quoted{0}
{4}cat{0} {12}<<\EOF{13}
$scalar
{12}EOF{0}
{2}# Nesting{0}
{4}echo{0} {5}"$((1 + 2))"{0} {2}#{0}
{4}echo{0} {5}"$[1 + 2]"{0} {2}#{0}
{2}# Multiple nesting levels{0}
{11}$(ls -la$(ls $(c) $'*.c' ` $(${s})`)){0}
{2}# Multi-line{0}
{11}$(ls |
more){0}
{11}$(
`x`
"x"
`ls`
$'x'
$"x"
){0}
{2}#end -- checks termination of previous{0}

View File

@ -0,0 +1,26 @@
# Use lexer.bash.command.substitution=2 to style command substitution
# so that both the scope of the command and the internal structure are visible.
# Nested command
$(ls -la$(ls *.c))
# Check strings and backticks in command
echo $('ls' "." `ls` $'.' $".")
PROJECT_DIR=$(rlwrap -S "Enter source path: " -e '' -i -o cat)
# Multiple nesting levels
$(ls -la$(ls $(c) $'*.c' ` $(${s})`))
# Multi-line
$(ls |
more)
$(
`x`
"x"
`ls`
$'x'
$"x"
)
#end -- checks termination of previous

View File

@ -0,0 +1,27 @@
2 400 0 + # Use lexer.bash.command.substitution=2 to style command substitution
0 401 0 | # so that both the scope of the command and the internal structure are visible.
1 400 0
0 400 0 # Nested command
0 400 0 $(ls -la$(ls *.c))
1 400 0
0 400 0 # Check strings and backticks in command
0 400 0 echo $('ls' "." `ls` $'.' $".")
1 400 0
0 400 0 PROJECT_DIR=$(rlwrap -S "Enter source path: " -e '' -i -o cat)
1 400 0
0 400 0 # Multiple nesting levels
0 400 0 $(ls -la$(ls $(c) $'*.c' ` $(${s})`))
1 400 0
0 400 0 # Multi-line
0 400 0 $(ls |
0 400 0 more)
1 400 0
0 400 0 $(
0 400 0 `x`
0 400 0 "x"
0 400 0 `ls`
0 400 0 $'x'
0 400 0 $"x"
0 400 0 )
0 400 0 #end -- checks termination of previous
0 400 0

View File

@ -0,0 +1,26 @@
{2}# Use lexer.bash.command.substitution=2 to style command substitution{0}
{2}# so that both the scope of the command and the internal structure are visible.{0}
{2}# Nested command{0}
{71}$({72}ls{64} {72}-la{71}$({72}ls{64} {71}*.{72}c{71})){0}
{2}# Check strings and backticks in command{0}
{4}echo{0} {71}$({70}'ls'{64} {69}"."{64} {75}`ls`{64} {69}$'.'{64} {69}$"."{71}){0}
{8}PROJECT_DIR{7}={71}$({72}rlwrap{64} {72}-S{64} {69}"Enter source path: "{64} {72}-e{64} {70}''{64} {72}-i{64} {72}-o{64} {72}cat{71}){0}
{2}# Multiple nesting levels{0}
{71}$({72}ls{64} {72}-la{71}$({72}ls{64} {71}$({72}c{71}){64} {69}$'*.c'{64} {75}` $(${s})`{71})){0}
{2}# Multi-line{0}
{71}$({72}ls{64} {71}|{64}
{72}more{71}){0}
{71}$({64}
{75}`x`{64}
{69}"x"{64}
{75}`ls`{64}
{69}$'x'{64}
{69}$"x"{64}
{71}){0}
{2}#end -- checks termination of previous{0}

View File

@ -0,0 +1,77 @@
# Nested elements and other complex cases
# String with backtick inclusion
"x`ls`"
# Nested string
"x`ls "*.c"`"
# Not terminated at first "
"x`ls" # "`" #
# String with command inclusion
"x$(ls)"
# Nested command
$(ls -la$(ls *.c))
# Check strings and backticks in command
echo $('ls' "." `ls` $'.' $".")
# $( not terminated by ) if contains unterminated string
$('x) # ') #
$("x) # ") #
$(`x) # `) # Bash doesn't like this
$($'x) # ') #
$($"x) # ") #
# Parameter expansion
var=abcdef
sub=abc
rep='& '
echo ${var/$sub/"${rep}}"} #
# '$' in variable
echo $$PID
echo $var${var}
# Here-doc with internal elements
cat <<EOF
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Quoted delimiter treats here-doc as simple string
cat <<"EOF"
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
EOF
# Escaped same as quoted
cat <<\EOF
$scalar
EOF
# Nesting
echo "$((1 + 2))" #
echo "$[1 + 2]" #
# Multiple nesting levels
$(ls -la$(ls $(c) $'*.c' ` $(${s})`))
# Multi-line
$(ls |
more)
$(
`x`
"x"
`ls`
$'x'
$"x"
)
#end -- checks termination of previous

View File

@ -0,0 +1,78 @@
0 400 0 # Nested elements and other complex cases
1 400 0
0 400 0 # String with backtick inclusion
0 400 0 "x`ls`"
0 400 0 # Nested string
0 400 0 "x`ls "*.c"`"
0 400 0 # Not terminated at first "
0 400 0 "x`ls" # "`" #
1 400 0
0 400 0 # String with command inclusion
0 400 0 "x$(ls)"
1 400 0
0 400 0 # Nested command
0 400 0 $(ls -la$(ls *.c))
1 400 0
0 400 0 # Check strings and backticks in command
0 400 0 echo $('ls' "." `ls` $'.' $".")
1 400 0
0 400 0 # $( not terminated by ) if contains unterminated string
0 400 0 $('x) # ') #
0 400 0 $("x) # ") #
0 400 0 $(`x) # `) # Bash doesn't like this
0 400 0 $($'x) # ') #
0 400 0 $($"x) # ") #
1 400 0
0 400 0 # Parameter expansion
0 400 0 var=abcdef
0 400 0 sub=abc
0 400 0 rep='& '
0 400 0 echo ${var/$sub/"${rep}}"} #
1 400 0
0 400 0 # '$' in variable
0 400 0 echo $$PID
0 400 0 echo $var${var}
1 400 0
0 400 0 # Here-doc with internal elements
2 400 0 + cat <<EOF
0 401 0 | $scalar
0 401 0 | ${var}
0 401 0 | $((1+2))
0 401 0 | $(pwd)
0 401 0 | `pwd`
0 401 0 | EOF
1 400 0
0 400 0 # Quoted delimiter treats here-doc as simple string
2 400 0 + cat <<"EOF"
0 401 0 | $scalar
0 401 0 | ${var}
0 401 0 | $((1+2))
0 401 0 | $(pwd)
0 401 0 | `pwd`
0 401 0 | EOF
1 400 0
0 400 0 # Escaped same as quoted
2 400 0 + cat <<\EOF
0 401 0 | $scalar
0 401 0 | EOF
1 400 0
0 400 0 # Nesting
0 400 0 echo "$((1 + 2))" #
0 400 0 echo "$[1 + 2]" #
1 400 0
0 400 0 # Multiple nesting levels
0 400 0 $(ls -la$(ls $(c) $'*.c' ` $(${s})`))
1 400 0
0 400 0 # Multi-line
0 400 0 $(ls |
0 400 0 more)
1 400 0
0 400 0 $(
0 400 0 `x`
0 400 0 "x"
0 400 0 `ls`
0 400 0 $'x'
0 400 0 $"x"
0 400 0 )
0 400 0 #end -- checks termination of previous
0 400 0

View File

@ -0,0 +1,77 @@
{2}# Nested elements and other complex cases{0}
{2}# String with backtick inclusion{0}
{5}"x{11}`ls`{5}"{0}
{2}# Nested string{0}
{5}"x{11}`ls {5}"*.c"{11}`{5}"{0}
{2}# Not terminated at first "{0}
{5}"x{11}`ls{5}" # "{11}`{5}"{0} {2}#{0}
{2}# String with command inclusion{0}
{5}"x{7}$({8}ls{7}){5}"{0}
{2}# Nested command{0}
{7}$({8}ls{0} {8}-la{7}$({8}ls{0} {7}*.{8}c{7})){0}
{2}# Check strings and backticks in command{0}
{4}echo{0} {7}$({6}'ls'{0} {5}"."{0} {11}`ls`{0} {5}$'.'{0} {5}$"."{7}){0}
{2}# $( not terminated by ) if contains unterminated string{0}
{7}$({6}'x) # '{7}){0} {2}#{0}
{7}$({5}"x) # "{7}){0} {2}#{0}
{7}$({11}`x) # `{7}){0} {2}# Bash doesn't like this{0}
{7}$({5}$'x) # '{7}){0} {2}#{0}
{7}$({5}$"x) # "{7}){0} {2}#{0}
{2}# Parameter expansion{0}
{8}var{7}={8}abcdef{0}
{8}sub{7}={8}abc{0}
{8}rep{7}={6}'& '{0}
{4}echo{0} {10}${var/{9}$sub{10}/{5}"{10}${rep}{5}}"{10}}{0} {2}#{0}
{2}# '$' in variable{0}
{4}echo{0} {9}$${8}PID{0}
{4}echo{0} {9}$var{10}${var}{0}
{2}# Here-doc with internal elements{0}
{4}cat{0} {12}<<EOF{13}
{9}$scalar{13}
{10}${var}{13}
{7}$(({3}1{7}+{3}2{7})){13}
{7}$({4}pwd{7}){13}
{11}`pwd`{13}
{12}EOF{0}
{2}# Quoted delimiter treats here-doc as simple string{0}
{4}cat{0} {12}<<"EOF"{13}
$scalar
${var}
$((1+2))
$(pwd)
`pwd`
{12}EOF{0}
{2}# Escaped same as quoted{0}
{4}cat{0} {12}<<\EOF{13}
$scalar
{12}EOF{0}
{2}# Nesting{0}
{4}echo{0} {5}"{7}$(({3}1{0} {7}+{0} {3}2{7})){5}"{0} {2}#{0}
{4}echo{0} {5}"{7}$[{3}1{0} {7}+{0} {3}2{7}]{5}"{0} {2}#{0}
{2}# Multiple nesting levels{0}
{7}$({8}ls{0} {8}-la{7}$({8}ls{0} {7}$({8}c{7}){0} {5}$'*.c'{0} {11}` {7}$({10}${s}{7}){11}`{7})){0}
{2}# Multi-line{0}
{7}$({8}ls{0} {7}|{0}
{8}more{7}){0}
{7}$({0}
{11}`x`{0}
{5}"x"{0}
{11}`ls`{0}
{5}$'x'{0}
{5}$"x"{0}
{7}){0}
{2}#end -- checks termination of previous{0}

View File

@ -0,0 +1,41 @@
lexer.*.bsh;*.zsh=bash
fold=1
fold.comment=1
keywords.*.bsh;*.zsh=case cat do done echo else esac exit export fi find for if in print pwd set setopt then while
# Can use substyles for identifiers and scalars
substyles.bash.8=1
substylewords.8.1.*.bsh=map
substyles.bash.9=1
substylewords.9.1.*.bsh=CWD
lexer.bash.styling.inside.string=0
lexer.bash.styling.inside.backticks=0
lexer.bash.styling.inside.parameter=0
lexer.bash.styling.inside.heredoc=0
lexer.bash.command.substitution=0
match Issue180.bsh
lexer.bash.styling.inside.string=1
match Issue182.bsh
lexer.bash.styling.inside.string=1
match Issue184.bsh
lexer.bash.styling.inside.string=1
lexer.bash.command.substitution=1
match Issue184Copy.bsh
lexer.bash.styling.inside.string=1
lexer.bash.command.substitution=1
lexer.bash.special.parameter=*@#?-$!%<
match NestedStyledInside.bsh
lexer.bash.styling.inside.string=1
lexer.bash.styling.inside.backticks=1
lexer.bash.styling.inside.parameter=1
lexer.bash.styling.inside.heredoc=1
lexer.bash.command.substitution=1
match NestedRich.bsh
lexer.bash.command.substitution=2

View File

@ -0,0 +1,15 @@
# Tests for line continuation.
# Issue #195.
#backslash1\
echo 1
#backslash2\\
echo 2
if [ 1 ]; then
backslash1=A\
fi
backslash2=B\\
fi
echo $backslash1, $backslash2

View File

@ -0,0 +1,16 @@
2 400 0 + # Tests for line continuation.
0 401 0 | # Issue #195.
1 400 0
0 400 0 #backslash1\
0 400 0 echo 1
0 400 0 #backslash2\\
0 400 0 echo 2
1 400 0
2 400 0 + if [ 1 ]; then
0 401 0 | backslash1=A\
0 401 0 | fi
0 401 0 | backslash2=B\\
0 401 0 | fi
1 400 0
0 400 0 echo $backslash1, $backslash2
0 400 0

View File

@ -0,0 +1,15 @@
{2}# Tests for line continuation.{0}
{2}# Issue #195.{0}
{2}#backslash1\{0}
{4}echo{0} {3}1{0}
{2}#backslash2\\{0}
{4}echo{0} {3}2{0}
{4}if{0} {7}[{0} {3}1{0} {7}];{0} {4}then{0}
{8}backslash1{7}={8}A{7}\{0}
{8}fi{0}
{8}backslash2{7}={8}B\\{0}
{4}fi{0}
{4}echo{0} {9}$backslash1{7},{0} {9}$backslash2{0}

View File

@ -0,0 +1,51 @@
#!/bin/zsh
# Tests for zsh extensions
# Can be executed by zsh with reasonable results
# Some of these were implemented by commit [87286d] for Scintilla bug #1794
# https://zsh.sourceforge.io/Doc/Release/Expansion.html
# Where # does not start a comment
## Formatting base
print $(( [#8] y = 33 ))
print $(( [##8] 32767 ))
# Formatting base and grouping
print $(( [#16_4] 65536 ** 2 ))
## Character values
print $(( ##T+0 ))
print $(( ##^G+0 ))
# Failure: does not work when - included for bindkey syntax. \M-\C-x means Meta+Ctrl+x.
print $(( ##\M-\C-x+0 ))
# Value of first character of variable in expression
var=Tree
print $(( #var+0 ))
## Extended glob
setopt extended_glob
# # is similar to *, ## similar to +
echo [A-Za-z]#.bsh
echo [A-Za-z]##.bsh
# 13 character file names
echo **/[a-zA-Z.](#c13)
# 13-15 character file names
echo **/[a-zA-Z.](#c13,15)
## Glob flag
# i=case-insensitive
echo (#i)a*
# b=back-references
foo="a_string_with_a_message"
if [[ $foo = (a|an)_(#b)(*) ]]; then
print ${foo[$mbegin[1],$mend[1]]}
fi

View File

@ -0,0 +1,52 @@
2 400 0 + #!/bin/zsh
0 401 0 | # Tests for zsh extensions
0 401 0 | # Can be executed by zsh with reasonable results
0 401 0 | # Some of these were implemented by commit [87286d] for Scintilla bug #1794
0 401 0 | # https://zsh.sourceforge.io/Doc/Release/Expansion.html
1 400 0
0 400 0 # Where # does not start a comment
1 400 0
1 400 0
0 400 0 ## Formatting base
0 400 0 print $(( [#8] y = 33 ))
0 400 0 print $(( [##8] 32767 ))
1 400 0
0 400 0 # Formatting base and grouping
0 400 0 print $(( [#16_4] 65536 ** 2 ))
1 400 0
1 400 0
0 400 0 ## Character values
0 400 0 print $(( ##T+0 ))
0 400 0 print $(( ##^G+0 ))
0 400 0 # Failure: does not work when - included for bindkey syntax. \M-\C-x means Meta+Ctrl+x.
0 400 0 print $(( ##\M-\C-x+0 ))
1 400 0
0 400 0 # Value of first character of variable in expression
0 400 0 var=Tree
0 400 0 print $(( #var+0 ))
1 400 0
1 400 0
0 400 0 ## Extended glob
0 400 0 setopt extended_glob
1 400 0
0 400 0 # # is similar to *, ## similar to +
0 400 0 echo [A-Za-z]#.bsh
0 400 0 echo [A-Za-z]##.bsh
1 400 0
0 400 0 # 13 character file names
0 400 0 echo **/[a-zA-Z.](#c13)
0 400 0 # 13-15 character file names
0 400 0 echo **/[a-zA-Z.](#c13,15)
1 400 0
1 400 0
0 400 0 ## Glob flag
1 400 0
0 400 0 # i=case-insensitive
0 400 0 echo (#i)a*
1 400 0
0 400 0 # b=back-references
0 400 0 foo="a_string_with_a_message"
2 400 0 + if [[ $foo = (a|an)_(#b)(*) ]]; then
0 401 0 | print ${foo[$mbegin[1],$mend[1]]}
0 401 0 | fi
0 400 0

View File

@ -0,0 +1,51 @@
{2}#!/bin/zsh{0}
{2}# Tests for zsh extensions{0}
{2}# Can be executed by zsh with reasonable results{0}
{2}# Some of these were implemented by commit [87286d] for Scintilla bug #1794{0}
{2}# https://zsh.sourceforge.io/Doc/Release/Expansion.html{0}
{2}# Where # does not start a comment{0}
{2}## Formatting base{0}
{4}print{0} {7}$(({0} {7}[{8}#8{7}]{0} {8}y{0} {7}={0} {3}33{0} {7})){0}
{4}print{0} {7}$(({0} {7}[{8}##8{7}]{0} {3}32767{0} {7})){0}
{2}# Formatting base and grouping{0}
{4}print{0} {7}$(({0} {7}[{8}#16_4{7}]{0} {3}65536{0} {7}**{0} {3}2{0} {7})){0}
{2}## Character values{0}
{4}print{0} {7}$(({0} {8}##T{7}+{3}0{0} {7})){0}
{4}print{0} {7}$(({0} {8}##^G{7}+{3}0{0} {7})){0}
{2}# Failure: does not work when - included for bindkey syntax. \M-\C-x means Meta+Ctrl+x.{0}
{4}print{0} {7}$(({0} {8}##\M{7}-{8}\C{7}-{8}x{7}+{3}0{0} {7})){0}
{2}# Value of first character of variable in expression{0}
{8}var{7}={8}Tree{0}
{4}print{0} {7}$(({0} {8}#var{7}+{3}0{0} {7})){0}
{2}## Extended glob{0}
{4}setopt{0} {8}extended_glob{0}
{2}# # is similar to *, ## similar to +{0}
{4}echo{0} {7}[{8}A-Za-z{7}]{8}#.bsh{0}
{4}echo{0} {7}[{8}A-Za-z{7}]{8}##.bsh{0}
{2}# 13 character file names{0}
{4}echo{0} {7}**/[{8}a-zA-Z.{7}]{8}(#c13){0}
{2}# 13-15 character file names{0}
{4}echo{0} {7}**/[{8}a-zA-Z.{7}]{8}(#c13,15){0}
{2}## Glob flag{0}
{2}# i=case-insensitive{0}
{4}echo{0} {8}(#i)a{7}*{0}
{2}# b=back-references{0}
{8}foo{7}={5}"a_string_with_a_message"{0}
{4}if{0} {7}[[{0} {9}$foo{0} {7}={0} {7}({8}a{7}|{8}an{7}){8}_(#b){7}(*){0} {7}]];{0} {4}then{0}
{4}print{0} {10}${foo[$mbegin[1],$mend[1]]}{0}
{4}fi{0}

View File

@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -e
# -----------------------------------------------------------------------------
# Voluptatem dolore magnam eius quisquam eius dolor labore. Porro dolor amet ut.
# Numquam labore amet modi. Dolorem velit numquam porro est quiquia ipsum quisquam.
# Magnam consectetur est voluptatem aliquam adipisci. Sed dolorem quaerat quiquia.
# -----------------------------------------------------------------------------
export PYTHONPATH="scripts:$PYTHONPATH"
if [[ -z "$1" ]]; then
PROJECT_DIR=$(rlwrap -S "Enter source path: " -e '' -i -o cat)
PROJECT_PATH="$(pwd)/$PROJECT_DIR"
else
PROJECT_PATH="$(pwd)/${1}"
fi
OUT_FILE=${PROJECT_PATH}/testing.txt
(cat<<EOF
Last run $(date +'%Y-%m-%d') at $(date +'%H:%M:%S.%2N')
EOF
) > $OUT_FILE
# Issue 188, keyword before redirection operator
pwd>>$OUT_FILE
find "$PROJECT_PATH/src" -maxdepth 1 -type f |\
while read -r f; do
{
python3 -c "print();print('='*50)";\
echo `basename "$f"` | tr -d 'x';\
python3 -c "print('='*50)";\
python3 "$f";\
} >> $OUT_FILE
done
# Issue 137, should be shift but here-doc was detected
echo $(( x << END ))
pwd
END
# Issue 194, failed to understand character escaping so string unterminated
echo "foo `echo foo \\" bar` bar"
echo "xinput set-prop bla \"blub\" `grep bla $WRITE_APPENDIX/var/lib/path.txt | cut -d \\" -f 4`" >/some_file.sh
# Issue 194, $ before end of backticks is literal
echo `echo \$`
echo `echo \$bar\$`
echo `echo $`
echo `echo $bar$`
INVALID_NUMBER=0#0000

View File

@ -0,0 +1,53 @@
0 400 0 #!/usr/bin/env bash
0 400 0 set -e
2 400 0 + # -----------------------------------------------------------------------------
0 401 0 | # Voluptatem dolore magnam eius quisquam eius dolor labore. Porro dolor amet ut.
0 401 0 | # Numquam labore amet modi. Dolorem velit numquam porro est quiquia ipsum quisquam.
0 401 0 | # Magnam consectetur est voluptatem aliquam adipisci. Sed dolorem quaerat quiquia.
0 401 0 | # -----------------------------------------------------------------------------
0 400 0 export PYTHONPATH="scripts:$PYTHONPATH"
1 400 0
2 400 0 + if [[ -z "$1" ]]; then
0 401 0 | PROJECT_DIR=$(rlwrap -S "Enter source path: " -e '' -i -o cat)
0 401 0 | PROJECT_PATH="$(pwd)/$PROJECT_DIR"
0 401 0 | else
0 401 0 | PROJECT_PATH="$(pwd)/${1}"
0 401 0 | fi
1 400 0
0 400 0 OUT_FILE=${PROJECT_PATH}/testing.txt
1 400 0
2 400 0 + (cat<<EOF
0 401 0 | Last run $(date +'%Y-%m-%d') at $(date +'%H:%M:%S.%2N')
0 401 0 | EOF
0 400 0 ) > $OUT_FILE
1 400 0
0 400 0 # Issue 188, keyword before redirection operator
0 400 0 pwd>>$OUT_FILE
1 400 0
0 400 0 find "$PROJECT_PATH/src" -maxdepth 1 -type f |\
2 400 0 + while read -r f; do
2 401 0 + {
0 402 0 | python3 -c "print();print('='*50)";\
0 402 0 | echo `basename "$f"` | tr -d 'x';\
0 402 0 | python3 -c "print('='*50)";\
0 402 0 | python3 "$f";\
0 402 0 | } >> $OUT_FILE
0 401 0 | done
1 400 0
0 400 0 # Issue 137, should be shift but here-doc was detected
0 400 0 echo $(( x << END ))
0 400 0 pwd
0 400 0 END
1 400 0
0 400 0 # Issue 194, failed to understand character escaping so string unterminated
0 400 0 echo "foo `echo foo \\" bar` bar"
0 400 0 echo "xinput set-prop bla \"blub\" `grep bla $WRITE_APPENDIX/var/lib/path.txt | cut -d \\" -f 4`" >/some_file.sh
1 400 0
0 400 0 # Issue 194, $ before end of backticks is literal
0 400 0 echo `echo \$`
0 400 0 echo `echo \$bar\$`
0 400 0 echo `echo $`
0 400 0 echo `echo $bar$`
1 400 0
0 400 0 INVALID_NUMBER=0#0000
0 400 0

View File

@ -0,0 +1,52 @@
{2}#!/usr/bin/env bash{0}
{4}set{0} {8}-e{0}
{2}# -----------------------------------------------------------------------------{0}
{2}# Voluptatem dolore magnam eius quisquam eius dolor labore. Porro dolor amet ut.{0}
{2}# Numquam labore amet modi. Dolorem velit numquam porro est quiquia ipsum quisquam.{0}
{2}# Magnam consectetur est voluptatem aliquam adipisci. Sed dolorem quaerat quiquia.{0}
{2}# -----------------------------------------------------------------------------{0}
{4}export{0} {8}PYTHONPATH{7}={5}"scripts:$PYTHONPATH"{0}
{4}if{0} {7}[[{0} {4}-z{0} {5}"$1"{0} {7}]];{0} {4}then{0}
{8}PROJECT_DIR{7}={11}$(rlwrap -S "Enter source path: " -e '' -i -o cat){0}
{8}PROJECT_PATH{7}={5}"$(pwd)/$PROJECT_DIR"{0}
{4}else{0}
{8}PROJECT_PATH{7}={5}"$(pwd)/${1}"{0}
{4}fi{0}
{8}OUT_FILE{7}={10}${PROJECT_PATH}{7}/{8}testing.txt{0}
{7}({4}cat{12}<<EOF{13}
Last run $(date +'%Y-%m-%d') at $(date +'%H:%M:%S.%2N')
{12}EOF{0}
{7}){0} {7}>{0} {9}$OUT_FILE{0}
{2}# Issue 188, keyword before redirection operator{0}
{4}pwd{7}>>{9}$OUT_FILE{0}
{4}find{0} {5}"$PROJECT_PATH/src"{0} {8}-maxdepth{0} {3}1{0} {8}-type{0} {8}f{0} {7}|\{0}
{4}while{0} {8}read{0} {8}-r{0} {8}f{7};{0} {4}do{0}
{7}{{0}
{8}python3{0} {8}-c{0} {5}"print();print('='*50)"{7};\{0}
{4}echo{0} {11}`basename "$f"`{0} {7}|{0} {8}tr{0} {8}-d{0} {6}'x'{7};\{0}
{8}python3{0} {8}-c{0} {5}"print('='*50)"{7};\{0}
{8}python3{0} {5}"$f"{7};\{0}
{7}}{0} {7}>>{0} {9}$OUT_FILE{0}
{4}done{0}
{2}# Issue 137, should be shift but here-doc was detected{0}
{4}echo{0} {7}$(({0} {8}x{0} {7}<<{0} {8}END{0} {7})){0}
{4}pwd{0}
{8}END{0}
{2}# Issue 194, failed to understand character escaping so string unterminated{0}
{4}echo{0} {5}"foo `echo foo \\" bar` bar"{0}
{4}echo{0} {5}"xinput set-prop bla \"blub\" `grep bla $WRITE_APPENDIX/var/lib/path.txt | cut -d \\" -f 4`"{0} {7}>/{8}some_file.sh{0}
{2}# Issue 194, $ before end of backticks is literal{0}
{4}echo{0} {11}`echo \$`{0}
{4}echo{0} {11}`echo \$bar\$`{0}
{4}echo{0} {11}`echo $`{0}
{4}echo{0} {11}`echo $bar$`{0}
{8}INVALID_NUMBER{7}={1}0#0000{0}