diff --git a/autotests/folding/highlight.sh.fold b/autotests/folding/highlight.sh.fold index c568cd9f7901bb2664e097e3d2e6844af6c3cbf5..14a4d99b9e0fe5f9123149c471901d1da0775b24 100644 --- a/autotests/folding/highlight.sh.fold +++ b/autotests/folding/highlight.sh.fold @@ -29,6 +29,19 @@ mkdir this\ isnt\ #a\ comment mkdir this\ isnt\\\;#a\ comment mkdir this\\ #is a comment +<<'#BLOCK-COMMENT' +NOTE This is the "miltiline" comment. + +[===[.rst: + +Docs +---- + +Documentation block in ``RST`` format **starts** *here*. + +]===] +#BLOCK-COMMENT + # brace expansion mv my_file.{JPG,jpg} echo f.{01..100..3} f.{Z..a..-3} @@ -56,17 +69,17 @@ echo ${10} $10a # 9 is max # expression subst: -echo $(( cd << ed + 1 )) +echo $(( cd << ed + 1 )) # command subst: -echo $(ls -l) +echo $(ls -l) echo `cat myfile` # file subst: -echo $(<$filename) -echo $() +echo $(<$filename) +echo $() # process subst: sort <(show_labels) | sed 's/a/bg' > my_file.txt 2>&1 @@ -74,7 +87,7 @@ sort <(show_labels) | sed 's/a/bg' > my_file.txt 2>&1 # All substitutions also work in strings: echo "subst ${in}side string" 'not $inside this ofcourse' -echo "The result is $(( $a + $b )). Thanks!" +echo "The result is $(( $a + $b )). Thanks!" echo "Your homedir contains `ls $HOME |wc -l` files." @@ -89,53 +102,53 @@ login # Other colorings: -error() { +error() { cat /usr/bin/lesspipe.sh runscript >& redir.bak exec 3>&4 -} +} # do - done make code blocks -while [ $p -lt $q ] -do +while [ $p -lt $q ] +do chown 0644 $file.$p -done +done # braces as well run_prog | sort -u | -{ +{ echo Header while read a b d - do + do echo $a/$b/$c - done + done echo Footer -} +} # Any constructions can be nested: -echo "A long string with $( - if [ $count -gt 100 ] ; then +echo "A long string with $( + if [ $count -gt 100 ] ; then echo "much" else echo "not much" - fi ) substitutions." ; + fi ) substitutions." ; # Even the case construct is correctly folded: test -f blaat && -( do_something - case $p in - *bak) +( do_something + case $p in + *bak) do_bak $p - ;; - *) + ;; + *) dont_bak $p - ;; - esac -) # despite the extra parentheses in the case construction. + ;; + esac +) # despite the extra parentheses in the case construction. # more control flow @@ -143,7 +156,7 @@ while :; break continue return -done +done # variable assignments: @@ -180,11 +193,11 @@ make destdir=/usr/ # [[ and [ correctly need spaces to be regarded as structure, # otherwise they are patterns (currently treated as normal text) -if [ "$p" == "" ] ; then +if [ "$p" == "" ] ; then ls /usr/bin/[a-z]* -elif [[ $p == 0 ]] ; then +elif [[ $p == 0 ]] ; then ls /usr/share/$p -fi +fi # Fixed: ls a[ab]* # dont try to interprete as assignment with subscript (fixed) @@ -211,33 +224,33 @@ bla # indented: -if true +if true then cat <<- EOF Indented text with a $dollar or \$two EOF -elif [ -d $file ]; then +elif [ -d $file ]; then cat <<- "EOF" Indented text without a $dollar EOF -fi +fi -if ! { cmd1 && cmd2 ; }; then echo ok ; fi -if ! cmd1 arg; then echo ok ; fi +if ! { cmd1 && cmd2 ; }; then echo ok ; fi +if ! cmd1 arg; then echo ok ; fi -case 1 in -2) echo xxx; -;; -?) foo || yyy ; foo abc || echo abc ;; -1) echo yyy; -esac +case 1 in +2) echo xxx; +;; +?) foo || yyy ; foo abc || echo abc ;; +1) echo yyy; +esac ls #should be outside of case 1 folding block -for i in `ls tests/auto/output/*.html`; do +for i in `ls tests/auto/output/*.html`; do refFile=`echo $i | sed -e s,build,src, | sed -e s,output,reference, | sed -e s,.html,.ref.html,` cp -v $i $refFile -done +done ## >Settings >Configure Kate >Fonts & Colors >Highlitghing Text Styles >Scripts/Bash >Option >Change colors to some distinct color ## 1- In following line the -ucode should not be colored as option @@ -246,13 +259,13 @@ pacman -Syu --needed intel-ucode grub pacman -syu --needed intel-ucode grub # Braces (bug ##387915) -[[ $line_name =~ \{([0-9]{1,})\}\{([0-9]{1,})\}(.*) ]] -[[ $name =~ (.*)_(S[0-9]{2})(E[0-9]{2,3}[a-z]{0,1})_(.*) ]] +[[ $line_name =~ \{([0-9]{1,})\}\{([0-9]{1,})\}(.*) ]] +[[ $name =~ (.*)_(S[0-9]{2})(E[0-9]{2,3}[a-z]{0,1})_(.*) ]] # Comments in Braces (bug 450878) -[[ # comment 1 +[[ # comment 1 1 == 1 # comment 2 # comment 3 -]] +]] rm /data/{hello1,hello2}/input/{bye1,$bye2}/si{a,${b},c{k,p{e,a}}}/*.non rm /data/{aa,{e,i}t{b,c} # Not closed @@ -354,7 +367,7 @@ h <<"'" cat bla ' -r=$(xxx $@ 2>&1) +r=$(xxx $@ 2>&1) # branches cat a|cat @@ -372,115 +385,115 @@ cat a'a';cat # substitutions echo '' 'a' '\' "" "a" "\\" "$a" "a""a"'a''a' a'b'c a"b"c a$'\n'c echo a!bc a{a}b a{b,c}d a{b,{d,e}}d a\ b -echo a$bc a$b/c a${b}c a$((b-3))c a$(b)c a$(a b c)c +echo a$bc a$b/c a${b}c a$((b-3))c a$(b)c a$(a b c)c echo ${a[*]} ${a[@]} ${a[${b}]} ${a:-x$z} ${a-x} ${a/g} ${a//f/f} ${a//f*/f*} -echo ${a^^l*} ${a,} ${!a} ${#a[1]} ${a:1:$b} $((++i,i--)) +echo ${a^^l*} ${a,} ${!a} ${#a[1]} ${a:1:$b} $((++i,i--)) echo "${var#lo+(r)em}" x "${var#+(r)em}" x echo "${var#refs/heads}" x "${var#refs}" x -[ a ] -[ -f f'f'f ] -[ -f f]'f'f] ] -[ -t 13 ] -[ -t 13] ] -[ -t 13] ] -[ -v abc ] -[ -z abc ] -[ abc -ef abc ] -[ abc -ef abc ] -[ abc-ef -ef abc-ef ] -[ abc == abc ] -[ abc < abc ] -[ abc -eq abc ] -[[ abc -eq abc ]] -[ 1+2 -eq 1+2 ] -[[ 1+2 -eq 1+2 ]] -[ a = b c ] -[[ a = b c ]] -[ -z 1 -a 1 -eq 1 ] -[ 2 -eq 1 -o 1 -eq 1 ] -[[ x =~ a(b c|$)' '{1,}[a[.digit.]] ]] -[[ x =~ [ ] ]] -[[ x =~ ([ ]) ]] -[[ x =~ [ ]] -[[ x =~ ([) ]] -[[ (a =~ a) ]] -[[ a =~ a || a -eq 2 ]] -[[ (a =~ a) || a -eq 2 ]] -[[ (0 -le $b) ]] -[[ ( 0 -le $b ) ]] -[[ ( 0 -le $b || $b -le 100 ) ]] -[[ a]] -[[ a ]] -[[ a< b ]] -[[ a < b ]] -[[(! -d .)]] -[[ ! -d . ]] -[[ !(-d .) ]] -[[ -f a || -f b ]] -[[ -f a||-f b ]] -[[ ! (a -eq b) ]] -[ -d `echo .`] ] -[[ -d `echo .`]] ]] -[[ a != b && ${a}a = b${b} ]] -[[ +[ a ] +[ -f f'f'f ] +[ -f f]'f'f] ] +[ -t 13 ] +[ -t 13] ] +[ -t 13] ] +[ -v abc ] +[ -z abc ] +[ abc -ef abc ] +[ abc -ef abc ] +[ abc-ef -ef abc-ef ] +[ abc == abc ] +[ abc < abc ] +[ abc -eq abc ] +[[ abc -eq abc ]] +[ 1+2 -eq 1+2 ] +[[ 1+2 -eq 1+2 ]] +[ a = b c ] +[[ a = b c ]] +[ -z 1 -a 1 -eq 1 ] +[ 2 -eq 1 -o 1 -eq 1 ] +[[ x =~ a(b c|$)' '{1,}[a[.digit.]] ]] +[[ x =~ [ ] ]] +[[ x =~ ([ ]) ]] +[[ x =~ [ ]] +[[ x =~ ([) ]] +[[ (a =~ a) ]] +[[ a =~ a || a -eq 2 ]] +[[ (a =~ a) || a -eq 2 ]] +[[ (0 -le $b) ]] +[[ ( 0 -le $b ) ]] +[[ ( 0 -le $b || $b -le 100 ) ]] +[[ a]] +[[ a ]] +[[ a< b ]] +[[ a < b ]] +[[(! -d .)]] +[[ ! -d . ]] +[[ !(-d .) ]] +[[ -f a || -f b ]] +[[ -f a||-f b ]] +[[ ! (a -eq b) ]] +[ -d `echo .`] ] +[[ -d `echo .`]] ]] +[[ a != b && ${a}a = b${b} ]] +[[ 1 -eq 2 -]] -[[ -&&- ]] -[[ ]] -[[ -f ]] -[[ -f [0-9a] ]] -[[ ?*[0-9] = [^0-9] ]] -[[ -f = ?*[0-9] ]] -[[ ?*[0-9] = ?*[0-9] ]] -[[ a/sa[s = dsad?*[0-9]dsa$ds ]] -[[ a/sa[s = dsad?*[0-9]ds/a$ds ]] -[[ a =~ [12]a([!d]a?s[x[:alnum:]]|d?)p ]] - -[[ #comm1 +]] +[[ -&&- ]] +[[ ]] +[[ -f ]] +[[ -f [0-9a] ]] +[[ ?*[0-9] = [^0-9] ]] +[[ -f = ?*[0-9] ]] +[[ ?*[0-9] = ?*[0-9] ]] +[[ a/sa[s = dsad?*[0-9]dsa$ds ]] +[[ a/sa[s = dsad?*[0-9]ds/a$ds ]] +[[ a =~ [12]a([!d]a?s[x[:alnum:]]|d?)p ]] + +[[ #comm1 #comm2 p[1] == p[2] #comm3 #comm4 -]] +]] -[[ #comm1 +[[ #comm1 #comm2 -f p[2] #comm3 #comm4 -]] +]] -((3+1+a+$c*(x) & 0x43422fd+03-085/23#D9a@_^8)) -((1/(2-(a-4)))) +((3+1+a+$c*(x) & 0x43422fd+03-085/23#D9a@_^8)) +((1/(2-(a-4)))) # they are not arithmetic evaluations... -((cmd && cmd) || cmd) -$((cmd && cmd) || cmd) -((cmd && -cmd) || cmd) -$((cmd && -cmd) || cmd) - -{ echo +((cmd && cmd) || cmd) +$((cmd && cmd) || cmd) +((cmd && +cmd) || cmd) +$((cmd && +cmd) || cmd) + +{ echo echo -} -{ echo ; } -(echo ; echo) -(echo - echo) -(echo a) -({ echo plop;}) -[ a -eq 2 ] || [ a -eq 2] ] && [[ a -eq 2 ]] || [[ a != b ]]; -[ a -eq 2 ]||[ a -eq 2] ]&&[[ a -eq 2 ]]||[[ a != b ]]; +} +{ echo ; } +(echo ; echo) +(echo + echo) +(echo a) +({ echo plop;}) +[ a -eq 2 ] || [ a -eq 2] ] && [[ a -eq 2 ]] || [[ a != b ]]; +[ a -eq 2 ]||[ a -eq 2] ]&&[[ a -eq 2 ]]||[[ a != b ]]; test a -eq b # functions -a() { echo x; } -a () { echo x; } -function f { echo x; } -kde.org() { echo x; } ---func() { echo x; } +a() { echo x; } +a () { echo x; } +function f { echo x; } +kde.org() { echo x; } +--func() { echo x; } # variables a=(a b c) @@ -488,9 +501,9 @@ a='a' a+=b a[1]='a' a[$i]='x' -a[$(( +a[$(( 2+4 -))]='x' +))]='x' a=([a]=2 `echo` -s > 'ds') a=(#comment value#nocomment #comment) @@ -499,41 +512,41 @@ a=a cat a=`ls` cat # errors -a a(s) a +a a(s) a # control structure -for name in a b c {d,e} ; do echo ; done -for name; do echo ; done -for name do echo ; done -for ((i=0;i<5;++i)) ; do echo $i ; done -select name in a ; do echo ; done -select name; do echo ; done -if : ; then echo ; elif [[ : ]] ; then echo ; else echo ; fi -while : || : ; do echo ; done -until : ; : ; do echo ; done -case a in a) esac -case a in a) echo ; esac -case pwd in (patt1) echo ; echo ;; (patt*) echo ;;& patt?|patt) echo ;& -patt) echo ;; esac +for name in a b c {d,e} ; do echo ; done +for name; do echo ; done +for name do echo ; done +for ((i=0;i<5;++i)) ; do echo $i ; done +select name in a ; do echo ; done +select name; do echo ; done +if : ; then echo ; elif [[ : ]] ; then echo ; else echo ; fi +while : || : ; do echo ; done +until : ; : ; do echo ; done +case a in a) esac +case a in a) echo ; esac +case pwd in (patt1) echo ; echo ;; (patt*) echo ;;& patt?|patt) echo ;& +patt) echo ;; esac for name in a b c ; -do +do echo -done +done -case a in - a\( | b*c? ) echo - (b$c) # no pattern - ;; - (b$c) ;; +case a in + a\( | b*c? ) echo + (b$c) # no pattern + ;; + (b$c) ;; # no pattern - (b$c) -esac - -case "$1" in - "a") run_a|&a;; - "b") run_b;; - "c") run_c;; - *) echo "Plase choose between 'a', 'b' or 'c'" && exit 1;; -esac + (b$c) +esac + +case "$1" in + "a") run_a|&a;; + "b") run_b;; + "c") run_c;; + *) echo "Plase choose between 'a', 'b' or 'c'" && exit 1;; +esac diff --git a/autotests/html/highlight.sh.dark.html b/autotests/html/highlight.sh.dark.html index 0850c0602e4711443a5c83ffaed2df9475d4267a..ef9a54fc14e79c5dede9d1cd54e05ea3accc1153 100644 --- a/autotests/html/highlight.sh.dark.html +++ b/autotests/html/highlight.sh.dark.html @@ -35,6 +35,19 @@ mkdir this\ isnt\\\;#a\ comment mkdir this\\ #is a comment +<<'#BLOCK-COMMENT' +NOTE This is the "miltiline" comment. + +[===[.rst: + +Docs +---- + +Documentation block in ``RST`` format **starts** *here*. + +]===] +#BLOCK-COMMENT + # brace expansion mv my_file.{JPG,jpg} echo f.{01..100..3} f.{Z..a..-3} diff --git a/autotests/html/highlight.sh.html b/autotests/html/highlight.sh.html index 86d05dbf2004ed73f2257a7a0d9c78f6d9f61b44..20acbb56ad251291d0a782637c99270c34e60e17 100644 --- a/autotests/html/highlight.sh.html +++ b/autotests/html/highlight.sh.html @@ -35,6 +35,19 @@ mkdir this\ isnt\\\;#a\ comment mkdir this\\ #is a comment +<<'#BLOCK-COMMENT' +NOTE This is the "miltiline" comment. + +[===[.rst: + +Docs +---- + +Documentation block in ``RST`` format **starts** *here*. + +]===] +#BLOCK-COMMENT + # brace expansion mv my_file.{JPG,jpg} echo f.{01..100..3} f.{Z..a..-3} diff --git a/autotests/input/highlight.sh b/autotests/input/highlight.sh index e9781f36e6edf1191a5712aeb2a6fe47cd156a69..6a4e15f6f397c50f6707a5b2d3eb53386b44ddc5 100644 --- a/autotests/input/highlight.sh +++ b/autotests/input/highlight.sh @@ -29,6 +29,19 @@ mkdir this\ isnt\ #a\ comment mkdir this\ isnt\\\;#a\ comment mkdir this\\ #is a comment +<<'#BLOCK-COMMENT' +NOTE This is the "miltiline" comment. + +[===[.rst: + +Docs +---- + +Documentation block in ``RST`` format **starts** *here*. + +]===] +#BLOCK-COMMENT + # brace expansion mv my_file.{JPG,jpg} echo f.{01..100..3} f.{Z..a..-3} diff --git a/autotests/reference/highlight.sh.ref b/autotests/reference/highlight.sh.ref index ec1f1779c58aa8fde9919ea98c57c4446c53a0b8..6bbe16c931d3ce5a6ac83b974d33013dd4bf1147 100644 --- a/autotests/reference/highlight.sh.ref +++ b/autotests/reference/highlight.sh.ref @@ -29,6 +29,19 @@ mkdir this\ isnt\\\;#a\ comment
mkdir this\\ #is a comment

+<<'#BLOCK-COMMENT'
+NOTE This is the "miltiline" comment.
+
+[===[.rst:
+
+Docs
+----
+
+Documentation block in ``RST`` format **starts** *here*.
+
+]===]
+#BLOCK-COMMENT
+
# brace expansion
mv my_file.{JPG,jpg}
echo f.{01..100..3} f.{Z..a..-3}
diff --git a/data/syntax/bash.xml b/data/syntax/bash.xml index 905851ea188cedb2f6745a955851f2decbba6625..1acb9c1938f3eadd8223679a81d200c09e496c07 100644 --- a/data/syntax/bash.xml +++ b/data/syntax/bash.xml @@ -1,70 +1,80 @@ - - - - |&;)])"> - - - |&;()"> - - - - - - - - - - |&;()\\[\]]+|&strings;|\[:\w+:\])+\])"> - - - - - - - - - - - - - - - - - - - - - |&;)])"> - - - - |&;{}\\`'"$"> - - - - - - - - - - - - - - - - - - + + + + + |&;)])"> + + + |&;()"> + + + + + + + + + + |&;()\\[\]]+|&strings;|\[:\w+:\])+\])"> + + + + + + + + + + + + + + + + + + + + + |&;)])"> + + + + |&;{}\\`'"$"> + + + + + + + + + + + + + + + + + + ]> - + + @@ -1020,6 +1031,18 @@ + + + + + + + + + + + + @@ -1800,37 +1823,38 @@ - - - - - - - - + + + + + + + + - + - - - + + + - - - - - - - - - + + + + + + + + + - - + + +