diff --git a/autotests/folding/highlight.sh.fold b/autotests/folding/highlight.sh.fold index cd2291c..84d74db 100644 --- a/autotests/folding/highlight.sh.fold +++ b/autotests/folding/highlight.sh.fold @@ -1,207 +1,210 @@ #! /bin/sh # This is a test script for the Katepart Bash Syntax Highlighting by # Wilbert Berendsen. This is not runnable !!! # The highlighting recognizes basic types of input, and has a few special cases that # are all in FindCommands. The main objective is to create really proper nesting of # (multiline) strings, variables, expressions, etc. # ============== Tests: =============== # basic types: echo 'single quoted string' echo "double quoted string" echo $'string with esc\apes\x0din it' echo $"string meant to be translated" # comments: # this is a comment #this too echo this is#nt a comment dcop kate EditInterface#1 #this is - +grep -e "^default/linux/amd64/" |\ #this is a comment +mkdir this\ isnt\ #a\ comment +mkdir this\ isnt\\\;#a\ comment +mkdir this\\ #is a comment # brace expansion mv my_file.{JPG,jpg} # special characters are escaped: echo \(output\) \&\| \> \< \" \' \* # variable substitution: echo $filename.ext echo $filename_ext echo ${filename}_ext echo text${array[$subscript]}.text echo text${array["string"]}.text echo ${!prefix*} echo ${!redir} echo short are $_, $$, $?, ${@}, etc. echo ${variable/a/d} echo ${1:-default} # expression subst: echo $(( cd << ed + 1 )) # command subst: echo $(ls -l) echo `cat myfile` # file subst: echo $(<$filename) echo $( 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 "Your homedir contains `ls $HOME |wc -l` files." # Escapes in strings: p="String \` with \$ escapes \" "; # keywords are black, builtins dark purple and common commands lighter purple set exit login # Other colorings: error() { cat /usr/bin/lesspipe.sh runscript >& redir.bak exec 3>&4 } # do - done make code blocks while [ $p -lt $q ] do chown 0644 $file.$p done # braces as well run_prog | sort -u | { echo Header while read a b d do echo $a/$b/$c done echo Footer } # Any constructions can be nested: echo "A long string with $( if [ $count -gt 100 ] ; then echo "much" else echo "not much" fi ) substitutions." ; # Even the case construct is correctly folded: test -f blaat && ( do_something case $p in *bak) do_bak $p ;; *) dont_bak $p ;; esac ) # despite the extra parentheses in the case construction. # variable assignments: DIR=/dev p=`ls` LC_ALL="nl" dcop 'kate*' _VAR=val ARR=(this is an array) ARR2=([this]=too [and]="this too") usage="$0 -- version $VERSION Multiple lines of output can be possible." ANSWER=yes # here 'yes' isn't highlighed as command # Some commands expect variable names, these are colored correctly: export PATH=/my/bin:$PATH BLAAT export A B D local p=3 x y='\' read x y z <<< $hallo unset B declare -a VAR1 VAR2 && exit declare less a && b # options are recoqnized: zip -f=file.zip ./configure --destdir=/usr make destdir=/usr/ # [[ and [ correctly need spaces to be regarded as structure, # otherwise they are patterns (currently treated as normal text) if [ "$p" == "" ] ; then ls /usr/bin/[a-z]* elif [[ $p == 0 ]] ; then ls /usr/share/$p fi # Fixed: ls a[ab]* # dont try to interprete as assignment with subscript (fixed) a[ab] a[ab]=sa # Here documents are difficult to catch: cat > myfile << __EOF__ You're right, this is definitely no bash code But ls more $parameters should be expanded. __EOF__ # quoted: cat << "EOF" | egrep "this" >&4 # the rest of the line is still considered bash source You're right, this is definitely no bash code But ls more $parameters should be expanded. :-> EOF # indented: if true then cat <<- EOF Indented text with a $dollar or \$two EOF elif [ -d $file ]; then cat <<- "EOF" Indented text without a $dollar EOF fi case 1 in 2) echo xxx; ;; 1) echo yyy; esac ls #should be outside of case 1 folding block diff --git a/autotests/html/highlight.sh.html b/autotests/html/highlight.sh.html index b661a14..ae2aad0 100644 --- a/autotests/html/highlight.sh.html +++ b/autotests/html/highlight.sh.html @@ -1,214 +1,217 @@ highlight.sh
 #! /bin/sh
 # This is a test script for the Katepart Bash Syntax Highlighting by
 #	Wilbert Berendsen.  This is not runnable !!!
 
 
 # The highlighting recognizes basic types of input, and has a few special cases that
 # are all in FindCommands.  The main objective is to create really proper nesting of
 # (multiline) strings, variables, expressions, etc.
 
 
 
 # ============== Tests: ===============
 
 # basic types:
 echo 'single quoted string'
 echo "double quoted string"
 echo $'string with esc\apes\x0din it'
 echo $"string meant to be translated"
 
 
 # comments:
 # this is a comment
 #this too
 echo this is#nt a comment
 dcop kate EditInterface#1 #this is
-
+grep -e "^default/linux/amd64/" |\ #this is a comment
+mkdir this\ isnt\ #a\ comment
+mkdir this\ isnt\\\;#a\ comment
+mkdir this\\ #is a comment
 
 # brace expansion
 mv my_file.{JPG,jpg}
 
 
 # special characters are escaped:
 echo \(output\) \&\| \> \< \" \' \*
 
 
 # variable substitution:
 echo $filename.ext
 echo $filename_ext
 echo ${filename}_ext
 echo text${array[$subscript]}.text
 echo text${array["string"]}.text
 echo ${!prefix*}
 echo ${!redir}
 echo short are $_, $$, $?, ${@}, etc.
 echo ${variable/a/d}
 echo ${1:-default}
 
 
 # expression subst:
 echo $(( cd << ed + 1 ))
 
 
 # command subst:
 echo $(ls -l)
 echo `cat myfile`
 
 
 # file subst:
 echo $(<$filename)
 echo $(</path/to/myfile)
 
 # process subst:
 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 "Your homedir contains `ls $HOME |wc -l` files."
 
 
 # Escapes in strings:
 p="String \` with \$ escapes \" ";
 
 
 # keywords are black, builtins dark purple and common commands lighter purple
 set
 exit
 login
 
 
 # Other colorings:
 error() {
 	cat /usr/bin/lesspipe.sh
 	runscript >& redir.bak
 	exec 3>&4
 }
 
 
 # do - done make code blocks
 while [ $p -lt $q ] 
 do
 	chown 0644 $file.$p
 done
 
 
 # braces as well
 run_prog | sort -u |
 {
 	echo Header
 	while read a b d
 	do
 		echo $a/$b/$c
 	done
 	echo Footer
 }
 
 
 # Any constructions can be nested:
 echo "A long string with $(
 	if [ $count -gt 100 ] ; then
 		echo "much"
 	else
 		echo "not much"
 	fi ) substitutions." ;
 
 
 # Even the case construct is correctly folded:
 test -f blaat &&
 (	do_something
 	case $p in
 		*bak)
 			do_bak $p
 			;;
 		*)
 			dont_bak $p
 			;;
 	esac
 ) # despite the extra parentheses in the case construction.
 
 
 # variable assignments:
 DIR=/dev
 p=`ls`
 LC_ALL="nl" dcop 'kate*'
 _VAR=val
 ARR=(this is an array)
 ARR2=([this]=too [and]="this too")
 usage="$0 -- version $VERSION
 Multiple lines of output
 can be possible."
 ANSWER=yes	# here 'yes' isn't highlighed as command
 
 
 # Some commands expect variable names, these are colored correctly:
 export PATH=/my/bin:$PATH BLAAT
 export A B D
 local p=3  x  y='\'
 read x y z <<< $hallo
 unset B
 declare -a VAR1 VAR2 && exit
 declare less a && b 
 
 # options are recoqnized:
 zip -f=file.zip
 ./configure  --destdir=/usr
 make  destdir=/usr/
 
 
 # [[ and [ correctly need spaces to be regarded as structure,
 # otherwise they are patterns (currently treated as normal text)
 if [ "$p" == "" ] ; then
 	ls /usr/bin/[a-z]*
 elif [[ $p == 0 ]] ; then
 	ls /usr/share/$p
 fi
 
 # Fixed:
 ls a[ab]*		# dont try to interprete as assignment with subscript (fixed)
 a[ab]
 a[ab]=sa
 
 
 # Here documents are difficult to catch:
 cat > myfile << __EOF__
 You're right, this is definitely no bash code
 But ls more $parameters should be expanded.
 __EOF__
 
 
 # quoted:
 cat << "EOF" | egrep "this" >&4   # the rest of the line is still considered bash source
 You're right, this is definitely no bash code
 But ls more $parameters should be expanded. :->
 EOF
 
 
 # indented:
 if true
 then
 	cat <<- EOF
 		Indented text with a $dollar or \$two
 	EOF
 elif [ -d $file ]; then
 	cat <<- "EOF"
 		Indented text without a $dollar
 	EOF
 fi
 
 
 case 1 in 
 2) echo xxx;
 ;;
 1) echo yyy;
 esac
 
 ls #should be outside of case 1 folding block
 
diff --git a/autotests/input/highlight.sh b/autotests/input/highlight.sh index a354757..1ac3bd7 100644 --- a/autotests/input/highlight.sh +++ b/autotests/input/highlight.sh @@ -1,207 +1,210 @@ #! /bin/sh # This is a test script for the Katepart Bash Syntax Highlighting by # Wilbert Berendsen. This is not runnable !!! # The highlighting recognizes basic types of input, and has a few special cases that # are all in FindCommands. The main objective is to create really proper nesting of # (multiline) strings, variables, expressions, etc. # ============== Tests: =============== # basic types: echo 'single quoted string' echo "double quoted string" echo $'string with esc\apes\x0din it' echo $"string meant to be translated" # comments: # this is a comment #this too echo this is#nt a comment dcop kate EditInterface#1 #this is - +grep -e "^default/linux/amd64/" |\ #this is a comment +mkdir this\ isnt\ #a\ comment +mkdir this\ isnt\\\;#a\ comment +mkdir this\\ #is a comment # brace expansion mv my_file.{JPG,jpg} # special characters are escaped: echo \(output\) \&\| \> \< \" \' \* # variable substitution: echo $filename.ext echo $filename_ext echo ${filename}_ext echo text${array[$subscript]}.text echo text${array["string"]}.text echo ${!prefix*} echo ${!redir} echo short are $_, $$, $?, ${@}, etc. echo ${variable/a/d} echo ${1:-default} # expression subst: echo $(( cd << ed + 1 )) # command subst: echo $(ls -l) echo `cat myfile` # file subst: echo $(<$filename) echo $( 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 "Your homedir contains `ls $HOME |wc -l` files." # Escapes in strings: p="String \` with \$ escapes \" "; # keywords are black, builtins dark purple and common commands lighter purple set exit login # Other colorings: error() { cat /usr/bin/lesspipe.sh runscript >& redir.bak exec 3>&4 } # do - done make code blocks while [ $p -lt $q ] do chown 0644 $file.$p done # braces as well run_prog | sort -u | { echo Header while read a b d do echo $a/$b/$c done echo Footer } # Any constructions can be nested: echo "A long string with $( if [ $count -gt 100 ] ; then echo "much" else echo "not much" fi ) substitutions." ; # Even the case construct is correctly folded: test -f blaat && ( do_something case $p in *bak) do_bak $p ;; *) dont_bak $p ;; esac ) # despite the extra parentheses in the case construction. # variable assignments: DIR=/dev p=`ls` LC_ALL="nl" dcop 'kate*' _VAR=val ARR=(this is an array) ARR2=([this]=too [and]="this too") usage="$0 -- version $VERSION Multiple lines of output can be possible." ANSWER=yes # here 'yes' isn't highlighed as command # Some commands expect variable names, these are colored correctly: export PATH=/my/bin:$PATH BLAAT export A B D local p=3 x y='\' read x y z <<< $hallo unset B declare -a VAR1 VAR2 && exit declare less a && b # options are recoqnized: zip -f=file.zip ./configure --destdir=/usr make destdir=/usr/ # [[ and [ correctly need spaces to be regarded as structure, # otherwise they are patterns (currently treated as normal text) if [ "$p" == "" ] ; then ls /usr/bin/[a-z]* elif [[ $p == 0 ]] ; then ls /usr/share/$p fi # Fixed: ls a[ab]* # dont try to interprete as assignment with subscript (fixed) a[ab] a[ab]=sa # Here documents are difficult to catch: cat > myfile << __EOF__ You're right, this is definitely no bash code But ls more $parameters should be expanded. __EOF__ # quoted: cat << "EOF" | egrep "this" >&4 # the rest of the line is still considered bash source You're right, this is definitely no bash code But ls more $parameters should be expanded. :-> EOF # indented: if true then cat <<- EOF Indented text with a $dollar or \$two EOF elif [ -d $file ]; then cat <<- "EOF" Indented text without a $dollar EOF fi case 1 in 2) echo xxx; ;; 1) echo yyy; esac -ls #should be outside of case 1 folding block \ No newline at end of file +ls #should be outside of case 1 folding block diff --git a/autotests/reference/highlight.sh.ref b/autotests/reference/highlight.sh.ref index fbfba05..53b6ba1 100644 --- a/autotests/reference/highlight.sh.ref +++ b/autotests/reference/highlight.sh.ref @@ -1,207 +1,210 @@ #! /bin/sh
# This is a test script for the Katepart Bash Syntax Highlighting by
# Wilbert Berendsen. This is not runnable !!!


# The highlighting recognizes basic types of input, and has a few special cases that
# are all in FindCommands. The main objective is to create really proper nesting of
# (multiline) strings, variables, expressions, etc.



# ============== Tests: ===============

# basic types:
echo 'single quoted string'
echo "double quoted string"
echo $'string with esc\apes\x0din it'
echo $"string meant to be translated"


# comments:
# this is a comment
#this too
echo this is#nt a comment
dcop kate EditInterface#1 #this is
-
+grep "^default/linux/amd64/" |\ #this is a comment
+mkdir this\ isnt\ #a\ comment
+mkdir this\ isnt\\\;#a\ comment
+mkdir this\\ #is a comment

# brace expansion
mv my_file.{JPG,jpg}


# special characters are escaped:
echo \(output\) \&\| \> \< \" \' \*


# variable substitution:
echo $filename.ext
echo $filename_ext
echo ${filename}_ext
echo text${array[$subscript]}.text
echo text${array["string"]}.text
echo ${!prefix*}
echo ${!redir}
echo short are $_, $$, $?, ${@}, etc.
echo ${variable/a/d}
echo ${1:-default}


# expression subst:
echo $(( cd << ed + 1 ))


# command subst:
echo $(ls )
echo `cat myfile`


# file subst:
echo $(<$filename)
echo $(</path/to/myfile)

# process subst:
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 "Your homedir contains `ls $HOME |wc ` files."


# Escapes in strings:
p="String \` with \$ escapes \" ";


# keywords are black, builtins dark purple and common commands lighter purple
set
exit
login


# Other colorings:
error() {
cat /usr/bin/lesspipe.sh
runscript >& redir.bak
exec 3>&4
}


# do - done make code blocks
while [ $p -lt $q ]
do
chown 0644 $file.$p
done


# braces as well
run_prog | sort |
{
echo Header
while read a b d
do
echo $a/$b/$c
done
echo Footer
}


# Any constructions can be nested:
echo "A long string with $(
if [ $count -gt 100 ] ; then
echo "much"
else
echo "not much"
fi ) substitutions." ;


# Even the case construct is correctly folded:
test blaat &&
( do_something
case $p in
*bak)
do_bak $p
;;
*)
dont_bak $p
;;
esac
) # despite the extra parentheses in the case construction.


# variable assignments:
DIR=/dev
p=`ls`
LC_ALL="nl" dcop 'kate*'
_VAR=val
ARR=(this is an array)
ARR2=([this]=too [and]="this too")
usage="$0 -- version $VERSION
Multiple lines of output
can be possible."
ANSWER=yes # here 'yes' isn't highlighed as command


# Some commands expect variable names, these are colored correctly:
export PATH=/my/bin:$PATH BLAAT
export A B D
local p=3 x y='\'
read x y z <<< $hallo
unset B
declare VAR1 VAR2 && exit
declare less a && b

# options are recoqnized:
zip =file.zip
./configure =/usr
make destdir=/usr/


# [[ and [ correctly need spaces to be regarded as structure,
# otherwise they are patterns (currently treated as normal text)
if [ "$p" == "" ] ; then
ls /usr/bin/[a-z]*
elif [[ $p == 0 ]] ; then
ls /usr/share/$p
fi

# Fixed:
ls a[ab]* # dont try to interprete as assignment with subscript (fixed)
a[ab]
a[ab]=sa


# Here documents are difficult to catch:
cat > myfile << __EOF__
You're right, this is definitely no bash code
But ls more $parameters should be expanded.
__EOF__


# quoted:
cat << "EOF" | egrep "this" >&4 # the rest of the line is still considered bash source
You're right, this is definitely no bash code
But ls more $parameters should be expanded. :->
EOF


# indented:
if true
then
cat <<- EOF
Indented text with a $dollar or \$two
EOF
elif [ -d $file ]; then
cat <<- "EOF"
Indented text without a $dollar
EOF
fi


case 1 in
2) echo xxx;
;;
1) echo yyy;
esac

ls #should be outside of case 1 folding block
diff --git a/autotests/reference/test.bb.ref b/autotests/reference/test.bb.ref index cb5b655..c508a2d 100644 --- a/autotests/reference/test.bb.ref +++ b/autotests/reference/test.bb.ref @@ -1,44 +1,44 @@ # syntax test file for Bitbake receipes

SUMMARY = "GammaRay Qt introspection probe"
HOMEPAGE = "http://www.kdab.com/gammaray"

LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://LICENSE.GPL.txt;md5=2abfe5daa817fd4346b6d55293941415"

inherit cmake_qt5

SRC_URI = "git://github.com/KDAB/GammaRay;branch=master"

SRCREV = "139e003174f48b0c883fc6c200ef2efb7467bff1"
PV = "2.4.0+git${SRCPV}"

DEPENDS = "qtdeclarative"

S = "${WORKDIR}/git"

EXTRA_OECMAKE += " -DGAMMARAY_BUILD_UI=OFF"

FILES_${PN}-dev += " \
/usr/lib/cmake/* \
/usr/mkspecs/modules/* \
"
FILES_${PN}-dbg += " \
/usr/lib/.debug/* \
/usr/lib/gammaray/*/*/.debug \
/usr/lib/gammaray/*/*/styles/.debug \
"

do_install_append() {
- # multiline string ok here
+ # multiline string ok here
AVAR="this is
right"
}

def python_function():
# some python code
pass

# error: unterinated string
VAR *= "abc
this is wrong
diff --git a/data/syntax/bash.xml b/data/syntax/bash.xml index cdfdf95..26a76d5 100644 --- a/data/syntax/bash.xml +++ b/data/syntax/bash.xml @@ -1,980 +1,1004 @@ + ]> - + else for function in select until while elif then set : source alias bg bind break builtin cd caller command compgen complete continue dirs disown echo enable eval exec exit fc fg getopts hash help history jobs kill let logout popd printf pushd pwd return set shift shopt suspend test time times trap type ulimit umask unalias wait export unset declare typeset local read readonly arch awk bash bunzip2 bzcat bzcmp bzdiff bzegrep bzfgrep bzgrep bzip2 bzip2recover bzless bzmore cat chattr chgrp chmod chown chvt cp date dd deallocvt df dir dircolors dmesg dnsdomainname domainname du dumpkeys echo ed egrep false fgconsole fgrep fuser gawk getkeycodes gocr grep groff groups gunzip gzexe gzip hostname igawk install kbd_mode kbdrate killall last lastb link ln loadkeys loadunimap login ls lsattr lsmod lsmod.old lzcat lzcmp lzdiff lzegrep lzfgrep lzgrep lzless lzcat lzma lzmainfo lzmore mapscrn mesg mkdir mkfifo mknod mktemp more mount mv nano netstat nisdomainname nroff openvt pgawk pidof ping ps pstree pwd rbash readlink red resizecons rm rmdir run-parts sash sed setfont setkeycodes setleds setmetamode setserial sh showkey shred sleep ssed stat stty su sync tar tempfile touch troff true umount uname unicode_start unicode_stop unlink unlzma unxz utmpdump uuidgen vdir wall wc xz xzcat ypdomainname zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew zsh aclocal aconnect aplay apm apmsleep apropos ar arecord as as86 autoconf autoheader automake awk basename bc bison c++ cal cat cc cdda2wav cdparanoia cdrdao cd-read cdrecord chfn chgrp chmod chown chroot chsh clear cmp co col comm cp cpio cpp cut dc dd df diff diff3 dir dircolors directomatic dirname du env expr fbset file find flex flex++ fmt free ftp funzip fuser g++ gawk gc gcc clang valgrind xdg-open cmake qmake svn git rsync gdb getent getopt gettext gettextize gimp gimp-remote gimptool gmake gs head hexdump id install join kill killall ld ld86 ldd less lex ln locate lockfile logname lp lpr ls lynx m4 make man mkdir mknod msgfmt mv namei nasm nawk nice nl nm nm86 nmap nohup nop od passwd patch pcregrep pcretest perl perror pidof pr printf procmail prune ps2ascii ps2epsi ps2frag ps2pdf ps2ps psbook psmerge psnup psresize psselect pstops rcs rev rm scp sed seq setterm shred size size86 skill slogin snice sort sox split ssh ssh-add ssh-agent ssh-keygen ssh-keyscan stat strings strip sudo suidperl sum tac tail tee test tr uniq unlink unzip updatedb updmap uptime users vmstat w wc wget whatis whereis which who whoami write xargs yacc yes zip zsoelim dcop kdialog kfile xhost xmodmap xset + + + - + + + + + + - + - + - + - + + + + + + + + + + + + + + - +