summaryrefslogtreecommitdiffstats
path: root/kate/tests
diff options
context:
space:
mode:
Diffstat (limited to 'kate/tests')
-rw-r--r--kate/tests/ejp1.asm285
-rw-r--r--kate/tests/highlight.abc8
-rw-r--r--kate/tests/highlight.ahdl43
-rw-r--r--kate/tests/highlight.asm-avr75
-rw-r--r--kate/tests/highlight.asm-nasm27
-rw-r--r--kate/tests/highlight.asp58
-rw-r--r--kate/tests/highlight.awk28
-rw-r--r--kate/tests/highlight.bib31
-rw-r--r--kate/tests/highlight.cmake48
-rw-r--r--kate/tests/highlight.css49
-rw-r--r--kate/tests/highlight.do89
-rw-r--r--kate/tests/highlight.dox227
-rw-r--r--kate/tests/highlight.e90
-rw-r--r--kate/tests/highlight.exu97
-rw-r--r--kate/tests/highlight.f90181
-rw-r--r--kate/tests/highlight.glsl62
-rw-r--r--kate/tests/highlight.hs124
-rw-r--r--kate/tests/highlight.jsp170
-rw-r--r--kate/tests/highlight.lex82
-rw-r--r--kate/tests/highlight.lhs124
-rw-r--r--kate/tests/highlight.lisp36
-rw-r--r--kate/tests/highlight.ly114
-rw-r--r--kate/tests/highlight.m61
-rw-r--r--kate/tests/highlight.mup103
-rw-r--r--kate/tests/highlight.pb87
-rw-r--r--kate/tests/highlight.php23
-rw-r--r--kate/tests/highlight.pike24
-rw-r--r--kate/tests/highlight.pl44
-rw-r--r--kate/tests/highlight.pov76
-rw-r--r--kate/tests/highlight.prg71
-rw-r--r--kate/tests/highlight.rb480
-rw-r--r--kate/tests/highlight.rib68
-rw-r--r--kate/tests/highlight.scheme186
-rw-r--r--kate/tests/highlight.sh198
-rw-r--r--kate/tests/highlight.sp32
-rw-r--r--kate/tests/highlight.tcl50
-rw-r--r--kate/tests/highlight.tex73
-rw-r--r--kate/tests/highlight.wrl41
-rw-r--r--kate/tests/highlight.xml67
-rw-r--r--kate/tests/highlight.xsl109
-rw-r--r--kate/tests/highlight.y54
-rw-r--r--kate/tests/highlight_lpc.c64
-rw-r--r--kate/tests/highlight_ocaml.ml105
-rw-r--r--kate/tests/highlight_octave.m74
-rw-r--r--kate/tests/test.js134
-rw-r--r--kate/tests/test.uc266
46 files changed, 4538 insertions, 0 deletions
diff --git a/kate/tests/ejp1.asm b/kate/tests/ejp1.asm
new file mode 100644
index 000000000..d94dc4ca0
--- /dev/null
+++ b/kate/tests/ejp1.asm
@@ -0,0 +1,285 @@
+;
+; Decodeur de trame pulsadis EJP et préavis EJP
+; (pic 12C508 ou 509)
+; Alain Gibaud, 20-2-2001
+;
+; ========================================================
+ list r=hex,p=p12c508
+
+ include "p12c508.inc"
+GP0 equ 0
+GP1 equ 1
+GP2 equ 2
+GP3 equ 3
+GP4 equ 4
+GP5 equ 5
+TO equ 4
+; masques pour acceder aux pattes
+GP0bit equ 1 << GP0
+GP1bit equ 1 << GP1
+GP2bit equ 1 << GP2
+GP3bit equ 1 << GP3
+GP4bit equ 1 << GP4
+GP5bit equ 1 << GP5
+; ========================================================
+; affectation des pattes
+;
+
+; sorties: (actives niv bas)
+NORMAL equ GP0 ; LED verte
+ALERTE equ GP1 ; LED orange
+EJP equ GP2 ; LED rouge
+; entrees:( actives niv bas)
+SIGNAL equ GP3 ; avec pull-up, en provenance filtre 175 Hz
+; GP4-5 sont utilisees par l'horloge
+; ========================================================
+; variables:
+TICKS equ 0x7 ; compteur de ticks (1 tick = 2/100 s)
+SLOT equ 0x8 ; numero slot dans la trame
+; =======================================================
+; Macros pour alleger le code ...
+;
+; Teste si min <= (var) < max
+; branche en "in" si oui, en "out" si non.
+;
+Lminmax macro var,min,max,outm,in,outp
+ movlw min
+ subwf var,W ; (var) - min
+ btfss STATUS,C
+ goto outm ; C=0 => resutat < 0 => var < min
+
+ movlw max
+ subwf var,W ; (var) - max
+ btfss STATUS,C
+ goto in
+ goto outp ; C=1 => resutat >= 0 => var >= min
+ endm
+;
+; Attend que le bit "bit" du registre "reg" soit a 1
+;
+Waitbit1 macro reg,bit
+ local Wait1
+Wait1 btfss reg,bit
+ goto Wait1
+ endm
+;
+; Attend que le bit "bit" du registre "reg" soit a 0
+;
+Waitbit0 macro reg,bit
+ local Wait0
+Wait0 btfsc reg,bit
+ goto Wait0
+ endm
+;
+; Branche en "label" si (reg) == num, sinon continue
+;
+Beq macro label,reg,num
+ movlw num
+ subwf reg,W
+ btfsc STATUS,Z
+ goto label
+ endm
+;
+; Branche en "label" si (reg) != num, sinon continue
+;
+Bne macro label,reg,num
+ movlw num
+ subwf reg,W
+ btfss STATUS,Z
+ goto label
+ endm
+
+;
+; Branche en "label" si (reg) < num, sinon continue
+;
+Blt macro label,reg,num
+ movlw num
+ subwf reg,W ; reg - W
+ btfss STATUS,C
+ goto label ; C=0 => reg - W < 0
+ endm
+
+;
+; Branche en "label" si (reg) >= num, sinon continue
+;
+Bge macro label,reg,num
+ movlw num
+ subwf reg,W ; reg - W
+ btfsc STATUS,C
+ goto label ; C=1 => reg - W >= 0
+ endm
+; ========================================================
+ ; CONFIG word ( en FFF )
+ ; bits 11:5 don't care
+ ; bit 4 : MCLRE enabled = 1, tied to Vdd = 0
+ ; bit 3 : code protection off = 1, on = 0
+ ; bit 2 : no watchdog = 0, watchdog = 1
+ ; bit 1-0 ; EXTRC = 00, INTRC = 10, XT = 01, LP = 00
+
+ __CONFIG B'000000001101' ; (horloge a quartz, avec watchdog)
+; ========================================================
+ org 0
+ goto debut
+;=========================================================
+; sous-programmes
+; ========================================================
+; regarde si le timer est passe a 0
+; si oui, le compteur de ticks est incremente
+; et on attend le repassage a 1
+; Cette routine DOIT etre appelee tout les 2/100 s ou plus souvent
+tickcount
+ clrwdt
+ movf TMR0,W
+ btfss STATUS,Z
+ retlw 0
+
+ incf TICKS,F
+; attendre que le timer ait depasse 0
+waitnoZ
+ clrwdt
+ movf TMR0,W
+ btfsc STATUS,Z
+ goto waitnoZ
+ retlw 0
+;
+; les 2 fct qui suivent maintiennent, le compteur de ticks
+; (en plus de scruter une patte)
+; attente d'un signal (logique negative)
+waitsignal
+ call tickcount
+ btfsc GPIO,SIGNAL
+ goto waitsignal
+ retlw 0
+; attente fin signal
+waitnosignal
+ call tickcount
+ btfss GPIO,SIGNAL
+ goto waitnosignal
+ retlw 0
+; remet a zero le compteur de ticks et le timer et le watchdog
+clearticks
+ clrwdt
+ clrw
+ movwf TICKS
+ movwf TMR0
+ ; pour eviter un timeout immediat, le timer est charge
+ ; a 1, et le 1er tick ne fait que 0.019922s au lieu de 0.2s
+ ; (ce n'est pas grave dans la mesure ou de toute facon,
+ ; le temps de traitement entre les different declenchements
+ ; de chrono n'est pas nul)
+ incf TMR0,F
+ retlw 0
+
+;
+; ==========================================================
+;
+debut
+ ; reset par Watchdog ?
+ btfsc STATUS,TO
+ goto notimeout
+ ; TO == 0 : OUI
+ clrwdt
+ goto 0x1FF ; recalibrage, 0x3FF sur 12C509
+
+ ; TO == 1 : NON
+notimeout
+ movwf OSCCAL ; recalibrer l'horloge
+ clrf TMR0 ; RAZ timer
+ ; GPWU=1 : disable wake up on pin change
+ ; GPPU=0 : enable pullups (a voir avec le hard ..)
+ ; T0CS=0 : timer connected to F/4
+ ; T0SE=x : dont't care
+ ; PSA=0 : prescaler assigned to timer
+ ; PS2-0= : timer prescaler 111= 1/256, 101 = 1/64, 011 = 1/16
+ movlw B'10010101'
+ option
+
+ ; config des pattes
+ movlw B'00001000' ; GP0-2 en sortie, GP3 entree
+ tris GPIO
+
+ ; se mettre en mode normal
+ bcf GPIO,NORMAL
+ bsf GPIO,ALERTE
+ bsf GPIO,EJP
+
+
+attendre_trame
+ call waitnosignal ; attendre ...
+ call waitsignal ; ... front montant
+ call clearticks
+ call waitnosignal
+ ; 45 tk = 0.9s, 55 tk = 1.1s
+ Lminmax TICKS,D'45',D'55',attendre_trame,pulse1s,attendre_trame
+pulse1s
+
+ ; attendre 162,5 tk = 2.75 s + 0.5 s = 3.25 s
+ call clearticks
+again325
+ call tickcount
+ Lminmax TICKS,D'162',D'162',again325,again325,end325
+end325
+
+ ; on est maintenant au centre du 1er bit
+ ; il suffit d'echantillonner toutes les 2.5s
+ movlw 1
+ movwf SLOT
+
+sample btfsc GPIO,SIGNAL ; logique negative
+ goto slot40
+
+ ; signal detecte !!
+ Bne not5,SLOT,D'5' ; slot == 5 ?
+ ; oui - 5 = passage en alerte
+ bsf GPIO,NORMAL ; bit a 1 = LED eteinte
+ bsf GPIO,EJP ; bit a 1 = LED eteinte
+ bcf GPIO,ALERTE ; bit a 0 = LED allumee
+ goto nextslot
+not5
+ Bne not15,SLOT,D'15' ; slot == 15 ?
+ ; oui
+ btfsc GPIO,ALERTE ; deja en alerte ?
+ goto endejp
+ ; oui - 5 & 15 = debut ejp
+ bsf GPIO,NORMAL ; bit a 1 = LED eteinte
+ bsf GPIO,ALERTE ; bit a 1 = LED eteinte
+ bcf GPIO,EJP ; bit a 0 = LED allumee
+ goto nextslot
+endejp
+ ; non - 15 seul = fin ejp
+ bsf GPIO,EJP ; bit a 1 = LED eteinte
+ bsf GPIO,ALERTE ; bit a 1 = LED eteinte
+ bcf GPIO,NORMAL ; bit a 0 = LED allumee
+ goto nextslot
+
+not15
+slot40
+ ; slot 40 ?
+ Bne nextslot,SLOT,D'40' ; slot == 40 ?
+ ; et attendre une nouvelle trame
+
+ goto attendre_trame
+nextslot
+ incf SLOT,F
+
+ ; si le signal est a 1, on en profite pour se resynchroniser
+ ; sur son front descendant, au cas ou l'emetteur ne soit pas
+ ; bien conforme au protocole.
+ btfss GPIO,SIGNAL
+ goto resynchro
+ ; attendre 125 ticks = 2.5s
+ call clearticks
+again125
+ call tickcount
+ Lminmax TICKS,D'125',D'126',again125,sample,again125
+
+resynchro
+ call waitnosignal
+ call clearticks
+again100 ; attente 2 s (100 ticks)
+ call tickcount
+ Lminmax TICKS,D'100',D'101',again100,sample,again100
+
+ end
+
+
diff --git a/kate/tests/highlight.abc b/kate/tests/highlight.abc
new file mode 100644
index 000000000..a7e45f751
--- /dev/null
+++ b/kate/tests/highlight.abc
@@ -0,0 +1,8 @@
+% Taken from http://www.gre.ac.uk/~c.walshaw/abc/#examples
+T:Paddy O'Rafferty
+C:Trad.
+M:6/8
+K:D
+dff cee|def gfe|dff cee|dfe dBA|dff cee|def gfe|faf gfe|1 dfe dBA:|2 dfe dcB||
+~A3 B3|gfe fdB|AFA B2c|dfe dcB|~A3 ~B3|efe efg|faf gfe|1 dfe dcB:|2 dfe dBA||
+fAA eAA|def gfe|fAA eAA|dfe dBA|fAA eAA|def gfe|faf gfe|dfe dBA:|
diff --git a/kate/tests/highlight.ahdl b/kate/tests/highlight.ahdl
new file mode 100644
index 000000000..e059aa804
--- /dev/null
+++ b/kate/tests/highlight.ahdl
@@ -0,0 +1,43 @@
+-- Test file for kate's syntax highlighting
+Title "Test file";
+
+-- BEGIN region (a region marker region) :)
+
+% multiline comment
+goes on here %
+
+-- END
+
+FUNCTION FCT (Clk, Key) RETURNS (pulse);
+
+SUBDESIGN CDCLOCK2
+(
+in : INPUT; -- go in
+out[3..0] : OUTPUT; -- come out
+)
+
+VARIABLE
+start : soft;
+usec[3..0] : node;
+
+BEGIN
+
+in = FCT(clock, some_key); -- senseless code
+
+-- comment
+blubb = (blobb[] == H"3ff");
+
+IF in THEN asdf
+-- folde me
+END IF;
+
+TABLE
+-- missing code
+END TABLE
+
+
+END;
+
+-- hex, octal, binary
+H"0" => B"1000000";
+O"01234567"; \ No newline at end of file
diff --git a/kate/tests/highlight.asm-avr b/kate/tests/highlight.asm-avr
new file mode 100644
index 000000000..dcffc153d
--- /dev/null
+++ b/kate/tests/highlight.asm-avr
@@ -0,0 +1,75 @@
+;********************************************************************
+;* LED flasher: LED will flash with a X on/off ratio at PD6
+;*
+;* NOTE: delay depends in the value of X, 1 is fast, 255 is slow
+;*
+;* No copyright ©1998 RES® * FREEWARE *
+;*
+;* NOTE: Connect a low current LED with a 1k resistor in serie from
+;* Vdd to pin 11 of the MCU. (Or a normal LED with a 330ohm)
+;*
+;* RES® can be reached by email: digitalaudio@mail.com
+;* or visit the website: http://home.wanadoo.nl/electro1/avr
+;*
+;* Version :1.0
+;* Date :12/26/98
+;* Author :Rob's ElectroSoft®
+;* Target MCU :AT90S1200-12PI@4MHz
+;********************************************************************
+
+.include "1200def.inc"
+
+ rjmp RESET ;reset handle
+
+
+;* Long delay
+
+;* Register variables
+
+ .def T1 = r1
+ .def T2 = r2
+ .def temp = r19
+
+;* Code
+
+longDelay:
+ clr T1 ;T1 used as delay 2nd count
+ clr T2 ;T2 used as delay 3d count
+delay_1:
+ dec T2
+ brne delay_1
+ dec T1
+ brne delay_1
+ dec temp ;temp must be preset as
+ brne delay_1 ; delay master count
+ ret
+
+
+;* Resets the data direction register D
+
+;* Defines
+
+ .equ led = 6 ;LED at PD6
+
+;* Code
+
+RESET:
+ sbi DDRD, led ;connect LED to PORTD pin 6
+
+
+;* Main program
+
+;* This part will let the LED go on and off by X
+
+;* Register variables
+
+ .equ X = 10 ;enter delaytime X
+
+flash:
+ sbi PORTD, led ;LED on
+ ldi temp, X ;X sec delay
+ rcall longDelay
+ cbi PORTD, led ;LED off
+ ldi temp, X ;X sec delay
+ rcall longDelay
+ rjmp flash ;another run \ No newline at end of file
diff --git a/kate/tests/highlight.asm-nasm b/kate/tests/highlight.asm-nasm
new file mode 100644
index 000000000..a5da4d1e8
--- /dev/null
+++ b/kate/tests/highlight.asm-nasm
@@ -0,0 +1,27 @@
+; Example file for nasm.xml kate syntax file
+; compile with `nasm example.asm -f elf -o example.o`
+; and link with 'gcc example.o -o example`
+; Public domain
+; kate: hl Intel x86 (NASM);
+
+section .data
+
+hello dd 'Hello World', 0x0A, 0h
+printf_param dd '%s', 0q
+
+section .text
+
+extern printf
+
+global main
+main:
+ push ebp
+ mov ebp, esp
+
+ push hello
+ push printf_param
+ call printf
+
+ mov eax, 0b
+ leave
+ ret
diff --git a/kate/tests/highlight.asp b/kate/tests/highlight.asp
new file mode 100644
index 000000000..07a8619e1
--- /dev/null
+++ b/kate/tests/highlight.asp
@@ -0,0 +1,58 @@
+<% 'kate: hl ASP;
+if ( instr(request.servervariables("PATH_INFO"),"login.asp") <= 0 and instr(request.servervariables("PATH_INFO"),"inset") <= 0 and instr(request.servervariables("PATH_INFO"),"Data") <= 0 and instr(request.servervariables("PATH_INFO"),"dropDown") <= 0 ) then
+ Session("originalRequestedPage") = Request.ServerVariables("PATH_INFO") & "?" & Request.ServerVariables("QUERY_STRING")
+end if
+
+function countRecords( rsToCount )
+ numRecs = 0
+
+ do until rsToCount.eof
+ numRecs = numRecs + 1
+
+ rsToCount.movenext
+ loop
+
+ rsToCount.close ' just to make sure nobody
+ ' tries to operate on the recordset,
+ ' which has already reached eof
+
+ countRecords = numRecs
+end function
+
+function unique( rs, sortColumn ) ' return unique instances of text in sortColumn within rs
+ dim sorted()
+
+ redim sorted(1)
+ dim i
+ i = 0
+ do until rs.eof
+ if (not find( rs(sortColumn), sorted )) then
+ redim preserve sorted(i+1)
+ sorted(i) = rs(sortColumn)
+ i = i + 1
+ end if
+ rs.MoveNext
+ loop
+
+ redim preserve sorted(i-1) ' the function will add an extra blank entry to the array
+
+ rs.Close ' close the recordset - we'll be using it again - and reset i - well be using it again, too
+
+ unique = sorted
+end function
+
+sub testSub( variable ) ' do nothing impressive...
+ dim newVar
+
+ newVar = variable
+
+ if ( variable = true )
+ response.end
+ else %>
+
+<p>We are writing text.</p>
+<p class="stuff"><%=newVar%></p>
+<p>We have written text and outputted a variable.</p>
+
+<% end if
+end sub %> \ No newline at end of file
diff --git a/kate/tests/highlight.awk b/kate/tests/highlight.awk
new file mode 100644
index 000000000..47f10cfcb
--- /dev/null
+++ b/kate/tests/highlight.awk
@@ -0,0 +1,28 @@
+#!/usr
+# AWK hl test
+
+# BEGIN and END are also matched as patterns
+BEGIN {
+ p = 0;
+}
+
+/some pattern/ {
+ p++;
+}
+
+# / inside brackets is not considered end of expression
+# a loose division operator (/) is not mismatched as a pattern.
+$1 =~ /[^abc/]def/ || b == 3 / 5 {
+
+ gsub ( FILENAME );
+
+}
+
+# TODO and FIXME also work in comments in Awk.
+
+# Also backslash in patterns works.
+/\/usr\/bin\/awk/ { print "This is me"; }
+
+END {
+ print p;
+}
diff --git a/kate/tests/highlight.bib b/kate/tests/highlight.bib
new file mode 100644
index 000000000..0ae404c2c
--- /dev/null
+++ b/kate/tests/highlight.bib
@@ -0,0 +1,31 @@
+% test file for kate's bibtex syntax highlighting
+
+@Article{artikel,
+author = {Me},
+title = {Something},
+journal = {JHEP},
+year = {2003},
+}
+
+@Book
+
+{
+
+boek,
+author = "Someone",
+title = "Something",
+journal = "Nucl. Phys. B",
+year = "2003",
+}
+
+This is ignored by BibTeX, no special highlighting
+%This is not a comment, it is just ignored (thanks to the people in #latex) :)
+
+@string{test="lange string die ik niet vaak opnieuw wil intikken"}
+
+@PhdThesis{thesis,
+author = {Me},
+title = {Dunno},
+school = {ITFA},
+year = {2005, hopefully},
+}
diff --git a/kate/tests/highlight.cmake b/kate/tests/highlight.cmake
new file mode 100644
index 000000000..cb8eaaa51
--- /dev/null
+++ b/kate/tests/highlight.cmake
@@ -0,0 +1,48 @@
+#this CMakeLists.txt doesn't do anything useful, but it shoudl demonstrate the cmake syntax highlighting
+#Alexander Neundorf <neundorf@kde.org>
+
+#ok this is a comment
+#and another line
+#a built-in command, it's bold black
+ADD_DEFINITIONS(-Wall -Wctor-dtor-privacy -Woverloaded-virtual -Wno-long-long -pipe -fno-builtin -fno-exceptions)
+
+#and another function
+INCLUDE_DIRECTORIES(
+#comments are also highlighted inside function parameters
+#variables are blue
+${CMAKE_CURRENT_SOURCE_DIR}/../../lib/qt4/include/Qt
+)
+
+# BEGIN defining a macro
+MACRO(ECOS_ADD_EXECUTABLE _exe_NAME )
+
+#special parameters are italic, see the STATIC in the next line
+ADD_LIBRARY(${_exe_NAME} STATIC ${ARGN})
+#but not in the following line ?
+ ADD_LIBRARY(${_exe_NAME} STATIC ${ARGN})
+
+
+#another command with a bunch of variables and special parameters
+ ADD_CUSTOM_COMMAND(
+ TARGET ${_exe_NAME}
+ PRE_LINK
+ COMMAND ${CMAKE_C_COMPILER}
+ ARGS -o ${_exe_NAME}
+$\(${_exe_NAME}_SRC_OBJS\) -nostdlib -nostartfiles -Lecos/install/lib -Ttarget.ld
+ )
+
+#add the created files to the make_clean_files
+ SET(ECOS_ADD_MAKE_CLEAN_FILES ${ECOS_ADD_MAKE_CLEAN_FILES};${_exe_NAME};)
+#and another command...
+ SET_DIRECTORY_PROPERTIES(
+ PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES "${ECOS_ADD_MAKE_CLEAN_FILES}"
+ )
+ENDMACRO(ECOS_ADD_EXECUTABLE)
+# END of macro
+
+#calling a self-defined function, variables are also blue here
+ECOS_ADD_EXECUTABLE(${PROJECT_NAME} ${the_sources} ${qt4_moc_SRCS})
+
+
+
diff --git a/kate/tests/highlight.css b/kate/tests/highlight.css
new file mode 100644
index 000000000..126fa4d02
--- /dev/null
+++ b/kate/tests/highlight.css
@@ -0,0 +1,49 @@
+/**
+ * This is a pseudo CSS file to test Kate's CSS syntax highlighting.
+ */
+
+@import url("othersheet.css") screen, tv;
+
+body {
+ font-size: 15pt;
+ font-family: Verdana, Helvetica, "Bitstream Vera Sans", sans-serif;
+ margin-top: 0px; /* yet another comment */
+ margin-bottom: 0px;
+ // this is no comment, it's just broken!
+ margin-left: 0px;
+ margin-right: 0px;
+}
+
+.something
+{
+ margin-right: 0px;
+ color: #cdd;
+ color: #AAFE04;
+ color: rgb(10%,30%,43%);
+ background: maroon;
+}
+
+a:hover {
+}
+
+#header,
+p.intro:first-letter,
+p:lang(nl),
+img[align="right"]
+{
+ border: 1px solid red !important;
+ -moz-border-radius: 15px; /* unknown properties render italic */
+}
+
+@media print {
+
+ #header
+ {
+ display: none;
+ }
+
+}
+
+/*
+TODO: add more tests, e.g. media
+*/
diff --git a/kate/tests/highlight.do b/kate/tests/highlight.do
new file mode 100644
index 000000000..0b90b16b6
--- /dev/null
+++ b/kate/tests/highlight.do
@@ -0,0 +1,89 @@
+/* Test file for kate's stata syntax highlighting
+*/
+*! version 1.2.0 2mar2003 E. Leuven
+program define spellsplit
+ version 7
+ syntax [anything], spell(varlist min=2 max=2) [ by(varlist)]
+ tokenize `spell'
+ local date0 `1'
+ local date1 `2'
+ local f0 : format `date0'
+ local f1 : format `date1'
+
+ /* set default statistic */
+ local current "mean"
+
+ gettoken left anything : anything, match(prns)
+ while "`left'"!="" {
+ if "`prns'"!="" {
+ if !inlist("`left'","mean","sum") {
+ di as error "Statistic `left' not supported"
+ exit 198
+ }
+ local current "`left'"
+ }
+ else {
+ local `current'vars ``current'vars' `left'
+ }
+ gettoken left anything : anything, match(prns)
+ }
+ if ("`meanvars'"!="") {
+ confirm var `meanvars'
+ unab meanvars : `meanvars'
+ }
+ if ("`sumvars'"!="") {
+ confirm var `sumvars'
+ unab sumvars : `sumvars'
+ }
+
+ quietly {
+ g _count = 1
+ local xvars `meanvars' `sumvars' _count
+
+ /* create dummy by-var if no by option is specified */
+ if "`by'"=="" {
+ tempvar by
+ g byte `by' = 1
+ }
+ tempvar `xvars' `by'
+
+ /* create negative for subtraction when spell ends */
+ cap foreach v of varlist `xvars' {
+ g double ``v'' = -`v'
+ local txvars `txvars' ``v''
+ }
+ cap foreach v of varlist `by' {
+ g double ``v'' = `v'
+ local txvars `txvars' ``v''
+ }
+
+ stack `date0' `xvars' `by' `date1' `txvars', into(`date0' `xvars' `by') clear
+
+ /* calculate totals per date */
+ cap foreach v of varlist `xvars' {
+ egen double ``v'' = sum(`v'), by(`by' `date0')
+ }
+
+ /* unique dates only */
+ by `by' `date0', sort: keep if _n==1
+
+ /* calculate totals (+ when spell starts - when ends) */
+ sort `by'
+ cap foreach v of varlist `xvars' {
+ by `by': replace `v' = sum(``v'')
+ }
+ by `by': g `date1' = `date0'[_n + 1]
+
+ drop if `date0'>`date1'
+ drop _stack
+ drop if _count==0
+ order `by' `date0' `date1' `xvars'
+ format `date0' `f0'
+ format `date1' `f1'
+
+ cap for var `meanvars': replace X = X/_count
+
+ compress
+ }
+
+end \ No newline at end of file
diff --git a/kate/tests/highlight.dox b/kate/tests/highlight.dox
new file mode 100644
index 000000000..39b404fe2
--- /dev/null
+++ b/kate/tests/highlight.dox
@@ -0,0 +1,227 @@
+This is a pseudo doxygen file to test Kate's doxyge syntax highlighting.
+
+Normal text, no HL.
+===================
+a multiline comment may begin with a /*! */, too. That should work,
+because it is the same "entrance rule".
+
+popping tests:
+/** multiline */ end of doxygen HL mode
+/*! multiline */ end of doxygen HL mode
+//! singleline, where */ should be ignored! still doxygen HL mode
+/// singleline, where */ should be ignored! still doxygen HL mode
+///< singleline, where */ should be ignored! still doxygen HL mode
+begin and end immediately:
+/********/ actually no doxygen comment - used for "info boxes" :)
+/**/ <-- it really works --- end of doxygen HL mode
+/*!*/ end of doxygen HL mode
+
+<tag> <normal comment HL>
+/** \code rest of line is normal comment HL */ end of doxygen HL mode
+/** \code rest of line is normal comment HL
+ * comment HL mode
+ */ end of doxygen HL mode
+
+<tag> <word> <normal comment HL>
+/** \file aword rest of line is normal comment HL */ end of doxygen HL mode
+/** \file */aword <-- pop! no doxygen HL mode
+/** \file aword rest of line is normal comment HL
+ * comment HL mode
+ */ end of doxygen HL mode
+
+<tag> <rest of line is string>
+/** \brief A short description */ end of doxygen HL mode
+/** \brief */A <-- pop! end of doxygen HL mode
+/** \brief A short description
+ * comment HL mode
+ */ end of doxygen HL mode
+
+<tag> <word> <rest of line is string>
+/** \page aword rest of line is string */ end of doxygen HL mode
+/** \page */aword <-- pop! end of doxygen HL mode
+/** \page aword rest of line is string
+ * comment HL mode
+ */ end of doxygen HL mode
+
+<tag> <word> <word> <normal comment HL>
+/** \image aword aword rest of line is normal HL */ end of doxygen HL mode
+/** \image aword */aword <-- pop! end of doxygen HL mode
+/** \image */aword aword <-- pop! end of doxygen HL mode
+/** \image aword aword rest of line is normal HL
+ * comment HL mode
+ */ end of doxygen HL mode
+
+Tests for HTML tags in doxygen HL mode:
+=======================================
+/** <a href="blubb" href='blubb'> */ end of doxygen HL mode
+/** <a href="blubb" href='blubb'*/> end of doxygen HL mode
+/** <a href="blubb" href='blubb*/'> end of doxygen HL mode
+/** <a href="blubb" href='blub*/b'> end of doxygen HL mode
+/** <a href="blubb" href='b*/lubb'> end of doxygen HL mode
+/** <a href="blubb" href='*/blubb'> end of doxygen HL mode
+/** <a href="blubb" href=*/'blubb'> end of doxygen HL mode
+/** <a href="blubb" href*/='blubb'> end of doxygen HL mode
+/** <a href="blubb" hre*/f='blubb'> end of doxygen HL mode
+/** <a href="blubb" */href='blubb'> end of doxygen HL mode
+/** <a href="blubb"> */ end of doxygen HL mode
+/** <a href="blubb"*/> end of doxygen HL mode
+/** <a href="blubb*/"> end of doxygen HL mode
+/** <a href="blub*/b"> end of doxygen HL mode
+/** <a href="*/blubb"> end of doxygen HL mode
+/** <a href=*/"blubb"> end of doxygen HL mode
+/** <a href*/="blubb"> end of doxygen HL mode
+/** <a h*/ref="blubb"> end of doxygen HL mode
+/** <a */href="blubb"> end of doxygen HL mode
+/** <a*/ href="blubb"> end of doxygen HL mode
+/** <*/a href="blubb"> end of doxygen HL mode
+
+//! <a href="blubb" href='blubb'> */ stay in doygen HL mode
+//! <a href="blubb" href='blubb'*/> stay in doygen HL mode
+//! <a href="blubb" href='blubb*/'> stay in doygen HL mode
+//! <a href="blubb" href='blu*/bb'> stay in doygen HL mode
+//! <a href="blubb" href='*/blubb'> stay in doygen HL mode
+//! <a href="blubb" href=*/'blubb'> stay in doygen HL mode
+//! <a href="blubb"> */ stay in doygen HL mode
+//! <a href="blubb"*/> stay in doygen HL mode
+//! <a href="blubb*/"> stay in doygen HL mode
+//! <a href="blub*/b"> stay in doygen HL mode
+//! <a href="*/blubb"> stay in doygen HL mode
+//! <a href=*/"blubb"> stay in doygen HL mode
+//! <a href*/="blubb"> stay in doygen HL mode
+//! <a h*/ref="blubb"> stay in doygen HL mode
+//! <a */href="blubb"> stay in doygen HL mode
+//! <a*/ href="blubb"> stay in doygen HL mode
+//! <*/a href="blubb"> stay in doygen HL mode
+//! <a href="blubb"> stay in doygen HL <mode
+here should be normal HL mode (no doxygen!)
+
+Tests for HTML tags in doxygen HL mode with tags:
+=================================================
+<tag> <normal comment HL>
+/** \code rest <a href="blubb"> of </a href='blubb'> line is normal comment HL */ end of doxygen HL mode
+/** \code rest <a href="blubb"> of </a href='blubb'*/> end of doxygen HL mode
+/** \code rest <a href="blubb"> of </a href='blubb*/'> end of doxygen HL mode
+/** \code rest <a href="blubb"> of </a href='*/blubb'> end of doxygen HL mode
+/** \code rest <a href="blubb"> of </a href=*/'blubb'> end of doxygen HL mode
+/** \code rest <a href="blubb*/"> of </a href=*/'blubb'> end of doxygen HL mode
+/** \code rest <a href=*/"blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \code rest <a h*/ref="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \code rest <*/a href="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \code rest of line is normal comment HL
+ * comment HL mode <html> text </html>
+ */ end of doxygen HL mode
+
+<tag> <word> <normal comment HL>
+/** \file awo<html_should_be_ignored_here>rd rest of line is normal comment HL */ end of doxygen HL mode
+/** \file awo<html_should_be_ignored_here>*/rd end of doxygen HL mode
+/** \file awo<html_should_be_i*/gnored_here>rd end of doxygen HL mode
+/** \file awo<*/html_should_be_ignored_here>rd end of doxygen HL mode
+/** \file a*/wo<html_should_be_ignored_here>rd end of doxygen HL mode
+/** \file aword rest of line is normal co<code>mment HL
+ * comment HL mode
+ */ end of doxygen HL mode
+
+<tag> <rest of line is string>
+/** \brief A short <a href="blubb"> of </a href='blubb'> description */ end of doxygen HL mode
+/** \brief A short <a href="blubb"> of </a href='blubb'*/> end of doxygen HL mode
+/** \brief A short <a href="blubb"> of </a href='*/blubb'> end of doxygen HL mode
+/** \brief A short <a href="blubb"> of </a href=*/'blubb'> end of doxygen HL mode
+/** \brief A short <a href="blubb"> of </a href*/='blubb'> end of doxygen HL mode
+/** \brief A short <a href="blubb"> of </a */href='blubb'> end of doxygen HL mode
+/** \brief A short <a href="blubb"> of <*//a href='blubb'> end of doxygen HL mode
+/** \brief A short <a href="blubb"*/> of </a href='blubb'> end of doxygen HL mode
+/** \brief A short <a href="blubb*/"> of </a href='blubb'> end of doxygen HL mode
+/** \brief A short <a href="*/blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \brief A short <a href=*/"blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \brief A short <a href*/="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \brief A short <a h*/ref="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \brief A short <a href="blubb"> of </a href='blubb'> description
+ * comment HL mode
+ */ end of doxygen HL mode
+
+<tag> <word> <rest of line is string>
+/** \page aword A short <a href="blubb"> of </a href='blubb'> description */ end of doxygen HL mode
+/** \page aword A short <a href="blubb"> of </a href='blubb'*/> end of doxygen HL mode
+/** \page aword A short <a href="blubb"> of </a href='*/blubb'> end of doxygen HL mode
+/** \page aword A short <a href="blubb"> of </a href=*/'blubb'> end of doxygen HL mode
+/** \page aword A short <a href="blubb"> of </a href*/='blubb'> end of doxygen HL mode
+/** \page aword A short <a href="blubb"> of </a */href='blubb'> end of doxygen HL mode
+/** \page aword A short <a href="blubb"> of <*//a href='blubb'> end of doxygen HL mode
+/** \page aword A short <a href="blubb"*/> of </a href='blubb'> end of doxygen HL mode
+/** \page aword A short <a href="blubb*/"> of </a href='blubb'> end of doxygen HL mode
+/** \page aword A short <a href="*/blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \page aword A short <a href=*/"blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \page aword A short <a href*/="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \page aword A short <a h*/ref="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \page aword A short <*/a href="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \page aword A shor*/t <a href="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \page awor*/d A short <a href="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \page */aword A short <a href="blubb"> of </a href='blubb'> end of doxygen HL mode
+/** \page aword A short <a href="blubb"> of </a href='blubb'> description
+ * comment HL mode
+ */ end of doxygen HL mode
+
+<tag> <word> <word> <rest of line is string>
+/** \image aword aword rest of line is normal HL */ end of doxygen HL mode
+/** \image aword aword rest of line is*/ end of doxygen HL mode
+/** \image aword aword*/ end of doxygen HL mode
+/** \image aword aw*/ord end of doxygen HL mode
+/** \image aword */aword end of doxygen HL mode
+/** \image aword*/ end of doxygen HL mode
+/** \image awo*/rd end of doxygen HL mode
+/** \image */aword end of doxygen HL mode
+/** \ima*/ge end of doxygen HL mode
+/** \image aword aword rest of line is normal HL
+ * comment HL mode
+ */ end of doxygen HL mode
+
+Some further tests for singlelinecomments (* / should not pop!)
+===============================================================
+/// a singlelinecommment blubb blubb */. stay in doxygen HL mode
+/// \code a singlelinecommment blubb b*/lubb. stay in doxygen HL mode
+/// \code*/ a singlelinecommment blubb blubb. stay in doxygen HL mode
+/// \code a singlelinecommment blubb blubb
+/// \brief a descriptive text (string) stay in doxygen HL mode
+/// \brief a descriptive text (string)*/ description should go on here
+/// \brief a descriptive text */(string) description should go on here
+/// \brief */a descriptive text (string) description should go on here
+/// \ref aword a descriptive text (string) */ description should go on here
+/// \ref aword a descriptive text (str*/ing) description should go on here
+/// \ref aword a des*/criptive text (string) description should go on here
+/// \ref aword*/ a descriptive text (string) description should go on here
+/// \ref aw*/ord a descriptive text (string) description should go on here
+/// \ref */aword a descriptive text (string) description should go on here
+
+HTML comment tests:
+===================
+//! \ref word de<!--*/ -->scriptive text (string)
+normal HL mode.
+//! \ref w descriptive text (string)
+/** \ref word de<!--*/ -->scriptive text (string)
+normal HL mode.
+/** \ref w <!--
+ * HTML comments
+ * -->
+ * normal doxygen HL mode.
+ */
+
+
+And final tests for a word: a single char:
+===========================================
+<tag> <word> <rest of line as string>
+//! \ref word descriptive text (string)
+//! \ref w descriptive text (string)
+
+<tag> <word> <word> <rest is normal HL>
+//! \image word1 word2 b descriptive text (string)
+//! \image a word b descriptive text (string)
+
+<tag> <rest of line is string>
+//! \brief A b c d e description should go on here
+
+<tag> <word> <rest of line is normal doxygen HL mode>
+//! \file word rest of line is normal comment HL
+//! \file a word rest of line is normal comment HL
+
+no doxygen HL mode here.
+== END OF TESTFILE == \ No newline at end of file
diff --git a/kate/tests/highlight.e b/kate/tests/highlight.e
new file mode 100644
index 000000000..6f07c8385
--- /dev/null
+++ b/kate/tests/highlight.e
@@ -0,0 +1,90 @@
+<'
+
+extend TB_NAME_T : [ ETRC ];
+
+extend fifo {
+ keep soft testbench == ETRC;
+};
+
+extend ETRC fifo {
+
+ keep direction == POP;
+ keep soft type == CLASSIC;
+
+ keep PORT_DATAOUT == appendf("esa_data[%d]" , id);
+ keep PORT_POP_EMPTY == appendf("fifo_empty[%d]", id);
+ keep PORT_POP_ALMOST_EMPTY == appendf("ESA_PopAE[%d]" , id);
+ keep PORT_POP_ALMOST_FULL == appendf("ESA_PopAF[%d]" , id);
+ keep PORT_POP_FULL == "";
+ keep PORT_POP_ERROR == "";
+ keep PORT_POP_REQ == appendf("etrc_popreq_n[%d]" , id);
+ keep soft PORT_POP_CLK == "sysclk";
+ keep soft PORT_PUSH_CLK == "sysclk";
+
+// keep logger.verbosity == HIGH;
+
+
+ reset_sig() is {
+ injector.reset_sig();
+ '(PORT_DATAOUT)' = 0;
+ '(PORT_POP_EMPTY)' = 0;
+ '(PORT_POP_ALMOST_EMPTY)' = 0;
+ '(PORT_POP_ALMOST_FULL)' = 0;
+ '(PORT_POP_REQ)' = 0;
+ '(PORT_POP_CLK)' = 0;
+ '(PORT_POP_CLK)' = 1;
+ };
+
+ event clkSys is rise('sysclk');
+ event bug001 is true('pkdescnt[0]' == 1)@clkSys;
+
+ on bug001
+ {
+ dut_error("Bug 001 found ... crash!");
+ };
+
+};
+
+
+
+extend ETRC FIFO_INJECTOR {
+
+ pkt_desc_if : pkt_desc_if is instance;
+ keep pkt_desc_if.MAC_uid == id;
+
+ add_new_pkt_desc() is also {
+ pkt_desc_if.indicate_one_pck_desc_is_come_in_FIFO();
+ };
+
+ reset_sig() is {
+ pkt_desc_if.reset_sig();
+ };
+
+};
+
+extend ETRC CLASSIC fifo
+{
+
+ keep ae_seuil == 1;
+ keep af_seuil == 46;
+ keep fifo_size == 56;
+
+
+
+ setState() is also
+ {
+ if (fifo_plot &&(sys.time > 200000) && // avoid fifo plot before beginning of operation of RAMC
+ !((injector.generated_packet_nb == injector.max_generated_packets && injector.stream.size() == 0)
+ || injector.generated_packet_nb == 0))
+ {
+ if (fifo_use_logger) {
+ messagef(HIGH, "ETRC[%d] : %d\n", id, fifo.size());
+ }
+ else {
+ out("__fifo_plot: ", sys.time, " ", fifo.size() );
+ };
+ };
+ };
+};
+
+'>
diff --git a/kate/tests/highlight.exu b/kate/tests/highlight.exu
new file mode 100644
index 000000000..3651adf33
--- /dev/null
+++ b/kate/tests/highlight.exu
@@ -0,0 +1,97 @@
+-- Test file for Kate's Euphoria syntax highlighting/code folding.
+-- BEGIN region marker test
+
+-- code here
+
+-- END region marker test
+
+-- The N Queens Problem:
+-- Place N Queens on an NxN chess board
+-- such that they don't threaten each other.
+constant N = 8 -- try some other sizes
+constant ROW = 1, COLUMN = 2
+constant TRUE = 1, FALSE = 0
+type square(sequence x)
+-- a square on the board
+ return length(x) = 2
+end type
+type row(integer x)
+-- a row on the board
+ return x >= 1 and x <= N
+end type
+
+function threat(square q1, square q2)
+-- do two queens threaten each other?
+ if q1[COLUMN] = q2[COLUMN] then
+ return TRUE
+ elsif q1[ROW] - q1[COLUMN] = q2[ROW] - q2[COLUMN] then
+ return TRUE
+ elsif q1[ROW] + q1[COLUMN] = q2[ROW] + q2[COLUMN] then
+ return TRUE
+ elsif q1[ROW] = q2[ROW] then
+ return TRUE
+ else
+ return FALSE
+ end if
+end function
+
+function conflict(square q, sequence queens)
+-- Would square p cause a conflict with other queens on board so far?
+ for i = 1 to length(queens) do
+ if threat(q, queens[i]) then
+ return TRUE
+ end if
+ end for
+ return FALSE
+end function
+
+integer soln
+soln = 0 -- solution number
+
+procedure print_board(sequence queens)
+-- print a solution, showing the Queens on the board
+ integer k
+ position(1, 1)
+ printf(1, "Solution #%d\n\n ", soln)
+ for c = 'a' to 'a' + N - 1 do
+ printf(1, "%2s", c)
+ end for
+ puts(1, "\n")
+ for r = 1 to N do
+ printf(1, "%2d ", r)
+ for c = 1 to N do
+ if find({r,c}, queens) then
+ puts(1, "Q ")
+ else
+ puts(1, ". ")
+ end if
+ end for
+ puts(1, "\n")
+ end for
+ puts(1, "\nPress Enter. (q to quit) ")
+ while TRUE do
+ k = get_key()
+ if k = 'q' then
+ abort(0)
+ elsif k != -1 then
+ exit
+ end if
+ end while
+end procedure
+
+procedure place_queen(sequence queens)
+-- place queens on a NxN chess board
+-- (recursive procedure)
+ row r -- only need to consider one row for each queen
+ if length(queens) = N then
+ soln += 1
+ print_board(queens)
+ return
+ end if
+ r = length(queens)+1
+ for c = 1 to N do
+ if not conflict({r,c}, queens) then
+ place_queen(append(queens, {r,c}))
+ end if
+ end for
+end procedure
diff --git a/kate/tests/highlight.f90 b/kate/tests/highlight.f90
new file mode 100644
index 000000000..e2008c20a
--- /dev/null
+++ b/kate/tests/highlight.f90
@@ -0,0 +1,181 @@
+! This file is an example to test the syntax highlighting file F.xml
+! (for fortran 90 and F)
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! THIS IS AN EXAMPLE OF A MODULE !
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+module module_example
+
+ ! use 'implicit none' when you want all variables to be declared
+ implicit none
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! PUBLICS AND PRIVATES
+
+ ! In fortran 90 you can define your own operator
+ public :: operator(.norm.)
+ public :: operator(+) ! <-- you can also overload the usual operators
+ public :: factorial
+ public :: example_fn
+
+ private :: point3d_add
+ private :: point3d_norm
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! USER-DEFINED TYPES...
+
+ ! This is a definition to use in declarations of real variables,
+ ! parameters, etc.
+ integer, parameter, public :: kr = selected_real_kind(10)
+
+ ! This is a user-defined type
+ type, public :: point3d
+ real(kind=kr) :: x, y, z
+ end type point3d
+
+ ! This type is useless: it is only an example of type definition!
+ type, public :: example_type
+ complex(kind=kr) :: c ! <-- a complex number (two reals of kind kr)!
+ real, dimension(-10:10) :: & ! <-- this line does not end here!
+ r1, r2 ! <-- this is the final part of the previous line
+ real, pointer, dimension(:) :: pointer_to_array_of_real
+ real, dimension(:), pointer :: array_of_pointer_to_real
+ end type example_type
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! INTERFACES...
+
+ ! Interface for the norm of a 3-D vector
+ interface operator(.norm.)
+ module procedure point3d_norm
+ end interface
+
+ ! Interface for the operator '+'
+ interface operator(+)
+ module procedure point3d_add
+ end interface
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! SOME DECLARATIONS...
+
+ ! A real number can be declared with the following line:
+ real(kind=kr) :: real_var1
+ ! But if you are not interested on the precision of floating point numbers,
+ ! you can use simply:
+ real :: real_var2
+
+ ! An array can be declared in two ways:
+ real(kind=kr), dimension(1:10, -4:5), private :: a, b, c
+ real(kind=kr), private :: d(1:10, -4:5)
+
+ ! This is a string with fixed lenght
+ character(len=10) :: str_var
+
+ ! This is an allocatable array, which can be a target of a pointer
+ type(example_type), private, dimension(:), allocatable, target :: &
+ many_examples
+
+! Fortran 90 hasn't got its own preprocessor, it uses the C preprocessor!
+#ifdef XXX
+c <-- this is a comment in the old fortran 77 style (fixed form)
+c This is a free form file, so we shouldn't use this kind of comments!
+c But fortran 90 still understands fixed form, when parsing sources with
+c the *.f extension.
+ c ! <-- this 'c' shouldn't be highlighted as a comment!
+#endif
+
+contains
+
+
+ ! The sum of two points
+ pure function point3d_add(a, b) result(rs)
+ type(point3d) :: rs
+ type(point3d), intent(in) :: a, b
+ rs%x = a%x + b%x
+ rs%y = a%y + b%y
+ rs%z = a%z + b%z
+ end function point3d_add
+
+
+ ! The norm of a point
+ pure function point3d_norm(a) result(rs)
+ real(kind=kr) :: rs
+ type(point3d), intent(in) :: a
+ rs = sqrt(a%x * a%x + a%y * a%y + a%z * a%z)
+ end function point3d_norm
+
+
+ ! A simple recursive function
+ recursive function factorial(i) result (rs)
+ integer :: rs
+ integer, intent(in) :: i
+ if ( i <= 1 ) then
+ rs = 1
+ else
+ rs = i * factorial(i - 1)
+ end if
+ end function factorial
+
+
+ ! This is a useless function
+ subroutine example_fn(int_arg, real_arg, str_arg)
+ integer, intent(in) :: int_arg
+ real(kind=kr), intent(out) :: real_arg
+ character(len=*), intent(in) :: str_arg
+
+ type(example_type), pointer :: p
+ integer :: n, i, j
+ logical :: flag
+
+ flag = .true. ! .true. is not an operator!
+ if ( flag .and. flag ) then ! .and. is a pre-defined operator
+ print *, "blabla"
+ end if
+
+ ! Examples of inquiry functions: allocated, lbound, ubound.
+ if ( .not. allocated(many_examples) ) then
+ allocate( many_examples(10) )
+ end if
+ print *, "Lower bound = ", lbound(many_examples, 1)
+ print *, "Upper bound = ", ubound(many_examples, 1)
+
+ p => many_examples(5) ! <-- p is a pointer
+
+ ! A strange way to calculate i*i: add the first i odd numbers
+ i = 6
+ j = 0
+ do n = 1, i
+ j = j + (2*n - 1)
+ end do
+ print *, "i*i = ", i*i, j
+
+ real_arg = real(j) ! <-- here the highlighting is not very good:
+ ! it is unable to distinguish between this and a definition like:
+ ! real(kind=kr) :: a
+ deallocate( many_examples )
+ end subroutine example_fn
+
+end module module_example
+
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! THIS IS THE MAIN PROGRAM !
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+program example
+ use module_example
+
+ ! this is another example of use of the 'implicit' keyword
+ implicit double precision (a-h,o-z)
+
+ real(kind=kr) :: var_out
+
+ type(point3d) :: &
+ a = point3d(0.0_kr, 1.0_kr, 2.0_kr), &
+ b = point3d(4.0_kr, 5.0_kr, 6.0_kr)
+
+ print *, "a + b = ", .norm. (a + b)
+ print *, "factorial of 5 = ", factorial(5)
+
+ call example_fn(1, var_out, "hello!")
+
+end program example
diff --git a/kate/tests/highlight.glsl b/kate/tests/highlight.glsl
new file mode 100644
index 000000000..3495757b6
--- /dev/null
+++ b/kate/tests/highlight.glsl
@@ -0,0 +1,62 @@
+// This is a test file for the Katepart GLSL Syntax Highlighting.
+
+normal text
+// this is a single-line comment
+normal text
+/* this
+is a multi-line
+comment */
+normal text
+
+some_symbol.some_member;
+some_symbol.some_member_function();
+some_function();
+
+// this is a function
+void main()
+{
+ float f = 1.4e3; // decimal float literal
+ int i1 = 2884; // decimal int literal
+ int i2 = 0x44; // hex int literal
+ int i3 = 0456; // octal int literal
+}
+
+// this is a structure
+struct some_struct
+{
+ vec3 some_member_vector;
+};
+
+# this is
+#preprocessor code
+
+// all keywords
+break continue do for while
+if else
+true false
+discard return
+struct
+
+// all basic types
+float int void bool
+mat2 mat3 mat4
+vec2 vec3 vec4
+ivec2 ivec3 ivec4
+bvec2 bvec3 bvec4
+sampler1D sampler2D sampler3D
+samplerCube sampler1DShadow sampler1DShadow
+
+// all type qualifiers
+attribute const uniform varying
+in out inout
+
+// attensions:
+// FIXME
+// TODO
+// BUG
+
+// some of the std functions
+radians degrees sin cos tan asin acos atan
+
+// some of the std variables
+gl_Position gl_PointSize gl_ClipVertex
diff --git a/kate/tests/highlight.hs b/kate/tests/highlight.hs
new file mode 100644
index 000000000..057a3f3fc
--- /dev/null
+++ b/kate/tests/highlight.hs
@@ -0,0 +1,124 @@
+-- test file for Haskell syntax highlighting in KDE's Kate
+
+-- The test file for literate Haskell can be easily created like this:
+-- cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs
+-- You only have to manually edit the multi-line comment below.
+
+-- this is a single-line comment
+
+{- this is a multi-line comment
+
+Things like "a string" or a 'c' character shouldn't be highlighted in here.
+
+-- I could even start a new
+-- one-line comment.
+
+-}
+
+-- a data definition
+
+data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
+
+
+-- function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted
+
+funnyfunction::(Tree a)=>[a]->Integer->Int->Bool
+
+
+-- strings and chars
+-- first line of function definitions (type declaration) should be highlighted
+
+strangefunction::Int->String
+strangefunction 1 = "hello"
+strangefunction 2 = "what's up"
+strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
+strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
+strangefunction 5 = '\n':[]
+strangefunction 6 = '\invalidhaskell':[]
+
+-- function name including the single quote character
+-- and infix operator (`div`)
+
+justtesting'::Int->Int
+justtesting' 2 = 2+1
+justtesting' 9 = 7 `div` 2
+
+-- same definition as above, slightly different function name and a couple more whitespaces
+
+justtesting'' :: Int -> Int
+justtesting'' 2 = 3
+justtesting'' 9 = 3 + 9 - 9
+
+-- the following lines are copied out of Haskell's "Prelude.hs"
+
+infixl 7 *, /, `quot`, `rem`, `div`, `mod`, :%, %
+
+
+-- everything highlighted except the "a"
+
+class Bounded a where
+ minBound, maxBound :: a
+
+class (Num a, Ord a) => Real a where
+ toRational :: a -> Rational
+
+-- finally, some keyword lists
+
+-- keywords
+
+case, class, data, deriving, do, else, if, in, infixl, infixr, instance, let, module, of, primitive,
+then, type, where
+
+-- infix operators
+
+quot, rem, div, mod, elem, notElem, seq
+
+-- this stuff is not handled yet
+
+!!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
+
+-- functions
+
+FilePath, IOError, abs, acos, acosh, all, and, any, appendFile,
+approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun,
+break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh,
+curry, cycle, decodeFloat, denominator, digitToInt, div, divMod, drop,
+dropWhile, either, elem, encodeFloat, enumFrom, enumFromThen,
+enumFromThenTo, enumFromTo, error, even, exp, exponent, fail, filter, flip,
+floatDigits, floatRadix, floatRange, floor, fmap, foldl, foldl1, foldr,
+foldr1, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral,
+fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange,
+index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii,
+isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower,
+isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last,
+lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map,
+mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod,
+negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred,
+primExitWith, print, product, properFraction, putChar, putStr, putStrLn,
+quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat,
+readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen,
+readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate,
+return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq,
+sequence, sequence_, show, showChar, showInt, showList, showLitChar,
+showParen, showSigned, showString, shows, showsPrec, significand, signum,
+sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take,
+either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo,
+enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits,
+floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult,
+toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry,
+undefined, unlines, until, unwords, unzip, unzip3, userError, words,
+writeFile, zip, zip3, zipWith, zipWith3
+
+-- type constructors
+
+Bool, Char, Double, Either, Float, IO, Integer, Int, Maybe, Ordering, Rational, Ratio, ReadS,
+ShowS, String
+
+-- classes
+
+Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat,
+RealFrac, Real, Show
+
+-- data constructors
+
+EQ, False, GT, Just, LT, Left, Nothing, Right, True
diff --git a/kate/tests/highlight.jsp b/kate/tests/highlight.jsp
new file mode 100644
index 000000000..d912836bd
--- /dev/null
+++ b/kate/tests/highlight.jsp
@@ -0,0 +1,170 @@
+<%--
+ This page won't actually work, as it is simply designed to display jsp syntax highlighting.
+--%>
+<%@ page info="A Page to Test Kate Jsp Syntax Highlighting" language="java" errorPage="/test-error-page.jsp"%>
+<%@ include file="/include/myglobalvars.jsp"%> --%>
+<%@ page import="java.util.*,
+ java.io.*,
+ java.math.*" %>
+<%@ taglib uri="/WEB-INF/lib/si_taglib.tld" prefix="si"%>
+<jsp:useBean id="aPageBean" scope="page" class="my.package.MyPageBean"/>
+<jsp:useBean id="aRequestBean" scope="request" class="my.package.MyRequestBean"/>
+<%
+ // We can decipher our expected parameters here.
+ String parm1 = noNull(request.getParameter(PARAMETER_1)).trim();
+ String parm2 = noNull(request.getParameter(PARAMETER_2)).trim();
+ String parm3 = noNull(request.getParameter(PARAMETER_3)).trim();
+ String parm4 = noNull(request.getParameter(PARAMETER_4)).trim();
+ String parm5 = noNull(request.getParameter(PARAMETER_5)).trim();
+
+ // A sample collection of Integers to display some code folding.
+ List intList = getIntList(10);
+
+
+%>
+<html>
+ <title>A Sample Jsp</title>
+ <head>
+ <script language="javascript"><!--
+ function doAlert1() {
+ alert("This is the first javascript example.");
+ }
+
+ function doAlert2() {
+ alert("This is the second javascript example.");
+ }
+ //--></script>
+ </head>
+ <body>
+ <%-- The top label table. --%>
+ <table width="400" cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td><font size="3"><b>The following parameters were detected:</b></font></td>
+ </tr>
+ </table>
+
+ <%-- Display the parameters which might have been passed in. --%>
+ <table width="400" cellpadding="0" cellspacing="0" border="0">
+ <%-- Label; Actual Parameter String; Value Detected --%>
+ <tr>
+ <td><b>PARAMETER_1</b></td>
+ <td align="center"><%=PARAMETER_1%></td>
+ <td align="right">&quot;<%=parm1%>&quot;</td>
+ </tr>
+
+ <%-- Label; Actual Parameter String; Value Detected --%>
+ <tr>
+ <td><b>PARAMETER_2</b></td>
+ <td align="center"><%=PARAMETER_2%></td>
+ <td align="right">&quot;<%=parm2%>&quot;</td>
+ </tr>
+
+ <%-- Label; Actual Parameter String; Value Detected --%>
+ <tr>
+ <td><b>PARAMETER_3</b></td>
+ <td align="center"><%=PARAMETER_3%></td>
+ <td align="right">&quot;<%=parm3%>&quot;</td>
+ </tr>
+
+ <%-- Label; Actual Parameter String; Value Detected --%>
+ <tr>
+ <td><b>PARAMETER_4</b></td>
+ <td align="center"><%=PARAMETER_4%></td>
+ <td align="right">&quot;<%=parm4%>&quot;</td>
+ </tr>
+
+ <%-- Label; Actual Parameter String; Value Detected --%>
+ <tr>
+ <td><b>PARAMETER_5</b></td>
+ <td align="center"><%=PARAMETER_5%></td>
+ <td align="right">&quot;<%=parm5%>&quot;</td>
+ </tr>
+ </table>
+
+ <br><br>
+
+ <%-- Display our list of random Integers (shows code folding). --%>
+ <table width="400" cellpadding="0" cellspacing="0" border="0">
+<%
+ if (intList != null && intList.size() > 0) {
+%>
+ <tr><td><b>Here are the elements of intList...</b></td></tr>
+<%
+ Iterator intListIt = intList.iterator();
+ while (intListIt.hasNext()) {
+ Integer i = (Integer) intListIt.next();
+%>
+ <tr><td><%=i.toString()%></td></tr>
+<%
+ }
+ } else {
+%>
+ <tr><td><font color="blue"><b><i>Oooops, we forgot to initialize intList!</i></b></font></td></tr>
+<%
+ }
+%>
+ </table>
+
+ <br><br>
+
+ <%-- We can call javascript functions. --%>
+ <table width="400" cellpadding="0" cellspacing="0" border="0">
+ <tr><td colspan="2"><b>Test our javascript...</b></td></tr>
+ <tr>
+ <td><input type="button" name="button1" value="Alert 1" onmouseup="javascript:doAlert1()"></td>
+ <td><input type="button" name="button2" value="Alert 2" onmouseup="javascript:doAlert2()"></td>
+ </tr>
+ </table>
+
+ <br><br>
+ <%-- If we actually had defined a tag library. --%>
+ <table width="400" cellpadding="0" cellspacing="0" border="0">
+ <tr><td>
+ <my:SampleTag prop1="first" prop2="third">
+ <my:SampleTagChild nameProp="value1"/>
+ <my:SampleTagChild nameProp="value2"/>
+ </my:SampleTag>
+ </td></tr>
+ </table>
+
+ <br><br>
+ <%-- Expression language. --%>
+ <table width="400" cellpadding="0" cellspacing="0" border="0">
+ <c:if test="${!empty param.aParam}">
+ <c:set var="myParam" scope="session" value="${param.aParam}"/>
+ </c:if>
+
+ <tr><td>myParam's value: &quot;<c:out value="${myParam}" default=="Default"/>&quot;</td></tr>
+ </table>
+ </body>
+</html>
+<%!
+ /* A place for class variables and functions... */
+
+ // Define some sample parameter names that this page might understand.
+ private static final String PARAMETER_1 = "p1";
+ private static final String PARAMETER_2 = "p2";
+ private static final String PARAMETER_3 = "p3";
+ private static final String PARAMETER_4 = "p4";
+ private static final String PARAMETER_5 = "p5";
+
+ // Returns str trimmed, or an empty string if str is null.
+ private static String noNull(String str) {
+ String retStr;
+ if (str == null)
+ retStr = "";
+ else
+ retStr = str.trim();
+
+ return retStr;
+ }
+
+ // Returns a list of Integers with listSize elements.
+ private static List getIntList(int listSize) {
+ ArrayList retList = new ArrayList(listSize);
+ for (int i = 0; i < listSize; i++)
+ retList.add(new Integer( (int) (Math.random() * 100) ));
+
+ return retList;
+ }
+%> \ No newline at end of file
diff --git a/kate/tests/highlight.lex b/kate/tests/highlight.lex
new file mode 100644
index 000000000..33527bd22
--- /dev/null
+++ b/kate/tests/highlight.lex
@@ -0,0 +1,82 @@
+/* This test file tests kates Lex/Flex highlighting */
+
+%option c++
+%option yyclass="KateTester"
+%option yylineno
+
+ /* This is a C(++) comment */
+
+/* This one is a lex comment ! */
+
+%{
+#include <iostream>
+#include "realparser.hpp"
+using namespace std;
+%}
+
+/* Some definitions */
+DIGIT [0-9]
+LETTER [_a-zA-Z]
+
+%%
+
+ /* Comment *shall be indented here* */
+[ \t\n\r]+
+
+ /* Note: there is a bad } just here vvv */
+\/\*([^\*]|\*[^/])*\*\/ { foo(a, b, c); } }
+
+ /* A start condition scope... */
+<ESC>{
+ "a" {
+
+ /* C mode ! */
+ return 0;
+}
+
+ "b" %{
+
+ /* C mode, too ! */
+ return 0;
+%}
+
+ "c" return 0; // C++ comment
+}
+
+ /* Big rule */
+\"([^"\\]|\\.)*\" {
+
+ yylval.string_val = new char[strlen(yytext) + 1];
+ int j = 0, i = 1;
+
+ while (yytext[i] != '"')
+ if (yytext[i] != '\\')
+ yylval.string_val[j++] = yytext[i++];
+ else
+ switch (yytext[i + 1])
+ {
+ case 'n':
+ yylval.string_val[j++] = '\n'; i += 2;
+ break;
+ default:
+ yylval.string_val[j++] << yytext[i + 1], i += 2;
+ }
+
+ yylval.string_val[j] = 0;
+ return TOK_STRING;
+
+}
+
+ /* Dot (match all) */
+. {return yylval.int_val = yytext[0];}
+
+%%
+
+// Here is pure C(++)
+#include <iostream>
+
+int main(void)
+{
+ std::cout << "Hello, World\n";
+ return 0;
+}
diff --git a/kate/tests/highlight.lhs b/kate/tests/highlight.lhs
new file mode 100644
index 000000000..9dc52e570
--- /dev/null
+++ b/kate/tests/highlight.lhs
@@ -0,0 +1,124 @@
+test file for Haskell syntax highlighting in KDE's Kate
+
+The test file for literate Haskell can be easily created like this:
+ cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs
+You only have to manually edit the multi-line comment below.
+
+this is a single-line comment
+
+{- this is a multi-line comment
+
+Things like "a string" or a 'c' character shouldn't be highlighted in here.
+
+I could even start a new
+one-line comment.
+
+-}
+
+a data definition
+
+> data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
+
+
+function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted
+
+> funnyfunction::(Tree a)=>[a]->Integer->Int->Bool
+
+
+strings and chars
+first line of function definitions (type declaration) should be highlighted
+
+> strangefunction::Int->String
+> strangefunction 1 = "hello"
+> strangefunction 2 = "what's up"
+> strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
+> strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
+> strangefunction 5 = '\n':[]
+> strangefunction 6 = '\invalidhaskell':[]
+
+function name including the single quote character
+and infix operator (`div`)
+
+> justtesting'::Int->Int
+> justtesting' 2 = 2+1
+> justtesting' 9 = 7 `div` 2
+
+same definition as above, slightly different function name and a couple more whitespaces
+
+> justtesting'' :: Int -> Int
+> justtesting'' 2 = 3
+> justtesting'' 9 = 3 + 9 - 9
+
+the following lines are copied out of Haskell's "Prelude.hs"
+
+> infixl 7 *, /, `quot`, `rem`, `div`, `mod`, :%, %
+
+
+everything highlighted except the "a"
+
+> class Bounded a where
+> minBound, maxBound :: a
+
+> class (Num a, Ord a) => Real a where
+> toRational :: a -> Rational
+
+finally, some keyword lists
+
+keywords
+
+> case, class, data, deriving, do, else, if, in, infixl, infixr, instance, let, module, of, primitive,
+> then, type, where
+
+infix operators
+
+> quot, rem, div, mod, elem, notElem, seq
+
+this stuff is not handled yet
+
+> !!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
+
+functions
+
+> FilePath, IOError, abs, acos, acosh, all, and, any, appendFile,
+> approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun,
+> break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh,
+> curry, cycle, decodeFloat, denominator, digitToInt, div, divMod, drop,
+> dropWhile, either, elem, encodeFloat, enumFrom, enumFromThen,
+> enumFromThenTo, enumFromTo, error, even, exp, exponent, fail, filter, flip,
+> floatDigits, floatRadix, floatRange, floor, fmap, foldl, foldl1, foldr,
+> foldr1, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral,
+> fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange,
+> index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii,
+> isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower,
+> isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last,
+> lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map,
+> mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod,
+> negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred,
+> primExitWith, print, product, properFraction, putChar, putStr, putStrLn,
+> quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat,
+> readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen,
+> readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate,
+> return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq,
+> sequence, sequence_, show, showChar, showInt, showList, showLitChar,
+> showParen, showSigned, showString, shows, showsPrec, significand, signum,
+> sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take,
+> either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo,
+> enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits,
+> floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult,
+> toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry,
+> undefined, unlines, until, unwords, unzip, unzip3, userError, words,
+> writeFile, zip, zip3, zipWith, zipWith3
+
+type constructors
+
+> Bool, Char, Double, Either, Float, IO, Integer, Int, Maybe, Ordering, Rational, Ratio, ReadS,
+> ShowS, String
+
+classes
+
+> Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat,
+> RealFrac, Real, Show
+
+data constructors
+
+> EQ, False, GT, Just, LT, Left, Nothing, Right, True
diff --git a/kate/tests/highlight.lisp b/kate/tests/highlight.lisp
new file mode 100644
index 000000000..e86c85f15
--- /dev/null
+++ b/kate/tests/highlight.lisp
@@ -0,0 +1,36 @@
+;; This test file tests kates common lisp highlighting
+#|
+multilinecomment :)
+|#
+
+;BEGIN region marker
+
+;END end
+
+(defun bin-search (obj vec)
+ (let ((len (length vec)))
+ (and (not (zerop len))
+ (finder obj vec 0 (- len 1)))))
+
+(defun parse-date (str)
+ (let ((toks (tokens str #'constituent 0)))
+ (list (parse-integer (first toks))
+ (parse-month (second toks))
+ (parse-integer (third toks)))))
+
+(defconstant month-names
+ #("jan" "feb" "mar" "apr" "may" "jun"
+ "jul" "aug" "sep" "oct" "nov" "dec"))
+
+(defstruct buf
+ vec (start -1) (used -1) (new -1) (end -1))
+
+(defparameter *words* (make-hash-table :size 10000))
+
+(defmacro while (test &rest body)
+ `(do ()
+ ((not ,test))
+ ,@body))
+
+(define-modify-macro append1f (val)
+ (lambda (lst val) (append lst (list val))))
diff --git a/kate/tests/highlight.ly b/kate/tests/highlight.ly
new file mode 100644
index 000000000..29aa7a6ea
--- /dev/null
+++ b/kate/tests/highlight.ly
@@ -0,0 +1,114 @@
+% This is a file to test the Lilypond highlighting features of Katepart.
+% This is NOT a valid lilypond file, because it also shows the
+% highlighting of some invalid lilypond constructs!
+% This is a line comment.
+
+%{
+this is a block comment, that can occur inside a line, or across
+multiple lines.
+%}
+
+\header {
+ title = "Katepart Lilypond syntax highlighting test file"
+ composer = %{"Wilbert Berendsen"%} "Anonymus"
+ poet = "The KDE team"
+ opus = "1"
+ copyright = "Share and enjoy!"
+}
+
+\paper {
+ #(set-paper-size "a4") % a hash introduces scheme
+ indent = 0 % recognize variable names inside \paper, \layout etc.
+ between-system-space = 3\mm
+}
+
+\layout {
+ \context {
+ \Score
+ \remove Bar_number_engraver % recognize engraver names
+ \remove "Bar_number_engraver" % also when quoted!
+ }
+}
+
+% { and << block are folded
+\score {
+ \new StaffGroup <<
+ \new ChordNames \chordmode { c2sus4/f g2/d c1 }
+ \new Staff \new Voice ="mel" {
+ \key f \major
+ \time 4/4
+ \partial 4
+ \set Staff.instrumentName = "Bla."
+ \once \override Staff.NoteHead #'color = #red
+ % dynamics, articulations and markup
+ c8\p d\< e-. f-> g a\f c-5\markup {Hoi}
+ \notemode { c d e f }
+ \repeat volta 2 {
+ % complex durations are highlighted:
+ g4*2/3
+ }
+ \times 2/3 {e8 f g}
+ % there is some error checking:
+ % often made mistake to have octavemarks after the duration:
+ c2'
+ % invalid durations are caught:
+ g3
+ }
+ \context Lyrics \lyricsto "mel" {
+ \set fontSize = #1
+ this is a line of ly -- rics.
+ with4 dur -- a -- tions.2.
+ % errors like forgetting spaces are found:
+ space-- flight %{i.s.o.%} space -- flight
+ space at end for -- got -- ten as well.}
+
+ \new DrumStaff \drummode { hihat4 bassdrum8 }
+ \new FiguredBass \figuremode {
+ <5 4>8 <6->
+ }
+ >>
+ \midi {
+ \context {
+ \Score
+ tempoWholesPerMinute = #(ly:make-moment 60 2)
+ }
+ }
+}
+
+av = #(define-music-function (parser location voice)
+(string?)
+; scheme comments are recognized in scheme
+; Lilypond inside scheme works as well:
+#{
+ \set associatedVoice = $voice
+#})
+
+
+
+
+% inside scheme some elements are highlighted:
+#(define (naturalise-pitch p)
+ (let* ((o (ly:pitch-octave p))
+ (a (* 4 (ly:pitch-alteration p)))
+ (n (ly:pitch-notename p)))
+ (bla 'ArticulationEvent 'ChoirStaff)
+ (cond
+ ((> a 2) (set! a (- a 4)) (set! n (+ n 1)))
+ ((< a -2) (set! a (+ a 4)) (set! n (- n 1))))
+
+ (if (< n 0) (begin (set! o (- o 1)) (set! n (+ n 7))))
+ (if (> n 6) (begin (set! o (+ o 1)) (set! n (- n 7))))
+
+ (ly:make-pitch o n (/ a 4))))
+
+% markup is also highlighted
+\markup {
+ \line {
+ text test Voice Staff % note Lilypond keywords are not highlighted here
+ }
+ \score { \relative c' { <ceg>2( d) } }
+ \italic bla
+ \override #'(baseline-skip . 2) {
+ \underline blu
+ }
+}
diff --git a/kate/tests/highlight.m b/kate/tests/highlight.m
new file mode 100644
index 000000000..f24013853
--- /dev/null
+++ b/kate/tests/highlight.m
@@ -0,0 +1,61 @@
+%%=====================================================
+% MATLAB test code for Kate/Kwrite syntax highlighting
+% kate: hl Matlab
+%%=====================================================
+
+% Numbers _____________________________________________
+5, 5.5, .1, 0.1, 0.4e5, 1.2e-5, 5i, 5.3i, 6j, .345+3i
+5', 5.5', .1', 0.1', 0.4e5', 1.2e-5', 5i', 5.3i', 6j', .345+3i'
+
+% Operators ___________________________________________
+% relational operators
+'asdf'~=4, c<=4, d>=4, a<b, a>b, a==b, b||c, b&&c
+% elementwise arithmetic operators
+a.^b, a.*b a./b, 1:4:5
+% single-character binary arithmetic
+a+3, a-3, a*2, a^3, a/3, a\3, a|b, a&b
+% unary operators
+a = ~g; g = @sfdgdsf(sdfsd,345); g.' + 1i.' - ('asdf').'
+% separators and delimiter
+(asd),[sadf];{asdf},;;,;;;()
+% continuation
+a = 1+ ...
+ 2;
+
+% Strings and adjoint _________________________________
+% incomplete strings
+'string
+'str''
+'str''ing
+% complete strings
+'string' % simple string
+'''' % string containing '
+'str''ing' % one string containing '
+'string' 'string' % two strings
+'asdf' 'asdf''' variable % two strings and a variable
+'asdf''asdf'' fsgdfg' + (asdf)' - 'asdf'.' + []''''.';''
+'sadf'.' % string transpose
+% adjoint
+{'asdf'}' + 1
+('asdf')' + 1
+['asdf']' + 1
+'' var''' % empty string, var with >1 adjoints
+[5]'*{5}'*('asd')'.'+(5)'*6'*asdf'*asdf'.' % many adjoints
+A'*B + 1 % adjoint
+A.'*B + 1 % transpose
+A.'.'*B + 1 % double transpose
+A'.' + 1 % adjoint, then transpose
+A.'' % transpose, then adjoint
+
+% System command ______________________________________
+!hostname
+!cp * /tmp
+
+% Reserved keywords ___________________________________
+function, persistent, global
+switch, case, otherwise
+if, else, elseif
+try, catch
+for, while, break, continue
+end, return
+function, FUNCTION, Function % case sensitive! \ No newline at end of file
diff --git a/kate/tests/highlight.mup b/kate/tests/highlight.mup
new file mode 100644
index 000000000..ed5a03d99
--- /dev/null
+++ b/kate/tests/highlight.mup
@@ -0,0 +1,103 @@
+// This is a MUP highlighting test.
+// Mup is a shareware music publisher from www.arkkra.com
+
+// contexts
+score
+music
+staff 1
+voice 1 3
+
+top
+top2
+bottom
+bottom2
+grids
+
+headshapes
+
+
+header
+footer
+header2
+footer2
+
+// parameters and values
+score
+ units = cm;
+ key = 3#minor
+ key = 3# minor
+ rehstyle=circled
+
+
+
+
+mussym above all: 1 "ferm" ;
+
+define NAME
+// this is a macro definition, these are collapsable
+@
+
+ifdef NAME
+// this is conditionally "compiled"
+endif
+
+ifndef NAME
+// this is conditionally "compiled" when the macro has not been defined
+else
+// else clause
+endif
+
+
+// Various Tests
+
+// tablature
+1: e ^f; f; b ^c5; c#5;
+bar
+
+1: d+^e+ g^a; e+a; g ^/; c ^/ c+^/;
+bar
+
+// cross-staff stems
+1: 1e+g+c++;
+2: cc+; ee+; g with g+ above; with c+c++ above;
+bar
+
+1: 2+4ceg;4; // tie implied by added time values
+
+// slurs
+1: 2f<d> a<b> c+<d+>; dbd+;
+bar
+1: 2fac+ slur; dbd+;
+bar
+
+// alternation
+1: 2c alt 2; 2c+;2g;
+bar
+
+// bar to draw if repeatstart happens to be on new line
+(dblbar) repeatstart
+1: [up]8f bm with staff below;a;4s ebm;4s bm with staff below;8b;[len 11]d ebm;
+2: 4s bm with staff above;8a;b ebm;[down;len 14]b bm with staff above;d;4s ebm;
+bar
+
+// locations
+3: 2cf; [=h] egc+;
+1: [cue; with >; =_ch] fa;
+
+
+roll up 1 1 to 1 2: 2; 4;
+roll down 1 1 to 1 2: 2; 4;
+
+lyrics above 1,3 ; below 2,4 ; between 5&6 : "<1. >Hi, hi";
+
+title "page \% of \#"
+
+// shaped whole rests
+1: 4mr; // use a quarter rest symbol
+1: 1/4mr; // use a quadruple whole rest symbol
+2: 2.. mr; // use a double-dotted half rest
+
+// tuplets
+1: {4f; g;}3num,4.+2.
+bar
+
diff --git a/kate/tests/highlight.pb b/kate/tests/highlight.pb
new file mode 100644
index 000000000..556023334
--- /dev/null
+++ b/kate/tests/highlight.pb
@@ -0,0 +1,87 @@
+; This is a test file for kate's PureBasic highlighting.
+
+; BMP2x Converter by Sven Langenkamp
+
+UseJPEGImageEncoder()
+UsePNGImageEncoder()
+
+Declare Convert(JPEG)
+
+Enumeration 1
+ #JPEG
+ #PNG
+EndEnumeration
+
+; BEGIN section
+
+
+; END
+
+Global Count
+Global file.s
+Global filename.s
+Global fileext.s
+Global OutputFormat
+Global JPEGQuality
+
+Count = 0
+OutputFormat = 1
+JPEGQuality = -1
+
+; MAIN PROGRAM------------------------------------------------------------------
+
+;Request Options
+PrintN("Output Format")
+PrintN(" [1] JPEG")
+PrintN(" [2] PNG")
+Print ("> ")
+OutputFormat = Int(Input())
+
+Select OutputFormat
+ Case #JPEG:
+ fileext = ".jpg"
+ ;Request JPEG Quality
+ PrintN("")
+ PrintN("JPEG Quality")
+ PrintN(" [0-10]")
+ Print ("> ")
+ JPEGQuality = Int(Input())
+
+ Case #PNG:
+ fileext = ".png"
+EndSelect
+
+;Convert all BMP files in the current directory
+ExamineDirectory(0, "", "*.bmp")
+While NextDirectoryEntry()
+ file = DirectoryEntryName()
+ filename = GetFilePart(file)
+
+ If LoadImage(0, file)
+ Select OutputFormat
+ Case #JPEG:
+ Convert(JPEGQuality)
+
+ Case #PNG:
+ Convert(-1)
+ EndSelect
+ Count = Count +1
+ EndIf
+
+Wend
+
+PrintN(Str(Count) + " files converted")
+CloseConsole()
+
+; PROCUDURES--------------------------------------------------------------------
+
+Procedure Convert(JPEG)
+ Shared filename, fileext
+
+ If JPEG > -1
+ SaveImage(0, filename + fileext, #PB_ImagePlugin_JPEG, JPEG)
+ Else
+ SaveImage(0, filename + fileext, #PB_ImagePlugin_PNG)
+ EndIf
+ PrintN(file + " converted to " + filename + fileext)
+EndProcedure \ No newline at end of file
diff --git a/kate/tests/highlight.php b/kate/tests/highlight.php
new file mode 100644
index 000000000..d604e3689
--- /dev/null
+++ b/kate/tests/highlight.php
@@ -0,0 +1,23 @@
+<?
+/* This is a pseudo PHP file to test Kate's PHP syntax highlighting. */
+# TODO: this is incomplete, add more syntax examples!
+# this is also a comment.
+// Even this is a comment
+function test($varname) {
+ return "bla"; # this is also a comment
+}
+
+?>
+
+<?php echo("hello test"); ?>
+
+<html>
+ <? print "<title>test</title>"; ?>
+</html>
+
+<?php
+$var = <<<DOOH
+This is the $string inside the variable (which seems to be rendered as a string)
+It works well, I think.
+DOOH
+?> \ No newline at end of file
diff --git a/kate/tests/highlight.pike b/kate/tests/highlight.pike
new file mode 100644
index 000000000..2f63144f5
--- /dev/null
+++ b/kate/tests/highlight.pike
@@ -0,0 +1,24 @@
+#! /bin/env pike
+
+/* This file is a syntax highlight test for Kate.
+ * FIXME: Improve it to contain more (and more unusual) syntax examples.
+ */
+
+
+#define PIKE_ON_THE_WEB /* Is this address correct? */ "http://pike.ida.liu.se/"
+
+
+int main(int argc, array(string) args)
+{
+ // Write funny things with Pike :)
+ write(`+("Command line arguments (%d of them): ", @map(args, `+, " ")) + "\n", argc);
+
+ write("\nVisit Pike site at %s\n\n", PIKE_ON_THE_WEB);
+
+ for (int i = 1; i <= 3; i++)
+ write(":" + ")" * i + " ");
+
+ write("\n" + ({"Bye", "bye"}) * "-" + "!\n");
+
+ return 0;
+}
diff --git a/kate/tests/highlight.pl b/kate/tests/highlight.pl
new file mode 100644
index 000000000..991d1fea6
--- /dev/null
+++ b/kate/tests/highlight.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+# This is a pseudo Perl file to test Kate's Perl syntax highlighting.
+# TODO: this is incomplete, add more syntax examples!
+
+sub prg($)
+{
+ my $var = shift;
+
+ $var =~ s/bla/foo/igs;
+ $var =~ s!bla!foo!igs;
+ $var =~ s#bla#foo#igs;
+ $var =~ tr/a-z/A-Z/;
+ ($match) = ($var =~ m/(.*?)/igs);
+
+ $test = 2/453453.21;
+ $test /= 2;
+
+ print qq~d fsd fsdf sdfl sd~
+
+ $" = '/';
+
+ $foo = <<__EOF;
+d ahfdklf klsdfl sdf sd
+fsd sdf sdfsdlkf sd
+__EOF
+
+ $x = "dasds";
+
+ next if( $match eq "two" );
+ next if( $match =~ /go/i );
+
+ @array = (1,2,3); # a comment
+ @array = qw(apple foo bar);
+ push(@array, 4);
+ %hash = (red => 'rot',
+ blue => 'blau');
+ print keys(%hash);
+}
+
+sub blah {
+}
+
+&blah;
+prg("test");
diff --git a/kate/tests/highlight.pov b/kate/tests/highlight.pov
new file mode 100644
index 000000000..0bb307744
--- /dev/null
+++ b/kate/tests/highlight.pov
@@ -0,0 +1,76 @@
+//BEGIN TEST
+// test scene for POV-Ray syntax highlighting
+
+/* test comment */
+
+/* nested /* comments */ do not work */
+
+#version 3.5;
+//END
+global_settings { assumed_gamma 1.0 }
+
+// ----------------------------------------
+
+camera {
+ location <5.0, -12.0, 2.0>
+ up z sky z
+ look_at <0.0, 0.0, 0.5>
+ angle 40
+}
+
+sky_sphere {
+ pigment {
+ gradient z
+ color_map {
+ [0.0 rgb <0.6,0.7,1.0>]
+ [0.2 rgb <0.2,0.3,0.9>]
+ }
+ }
+}
+
+light_source {
+ <3, 1, 2>*1000
+ color rgb <2.2, 1.8, 1.5>
+}
+
+// ----------------------------------------
+
+#declare TEST=0;
+
+#ifdef (TEST)
+ plane {
+ z, 0
+ texture {
+ pigment {
+ checker
+ color rgb 1, color rgb 0
+ }
+ }
+ }
+#end
+
+#macro Sphere(Pos, Radius)
+ sphere {
+ <Pos.x, Pos.y, Radius*1.3>, Radius
+ texture {
+ pigment { color rgb 1 }
+ finish{
+ diffuse 0.3
+ ambient 0.0
+ specular 0.6
+ reflection 0.8
+ }
+ }
+ }
+#end
+
+#local Cnt=0;
+#local Seed=seed(0);
+
+#while (Cnt<10000)
+ Sphere(
+ -100+<rand(Seed), rand(Seed)>*200,
+ 0.3+pow(rand(Seed),2)*0.7
+ )
+ #local Cnt=Cnt+1;
+#end \ No newline at end of file
diff --git a/kate/tests/highlight.prg b/kate/tests/highlight.prg
new file mode 100644
index 000000000..713c60551
--- /dev/null
+++ b/kate/tests/highlight.prg
@@ -0,0 +1,71 @@
+// Test file to test kate's clipper highlighting
+// kate: hl Clipper;
+
+//BEGIN INCLUDES
+#include <clip-ui.ch>
+#include "logo.ch"
+
+#define PRGVERSION "0.0.1"
+//END
+
+//BEGIN CODE
+static ws, win
+static driver := getDriver()
+/* a multiline
+ comment
+*/
+
+function main( formName )
+ local form
+ local fileName
+
+ if empty(formName)
+ ?? "Usage: ./form_ui <form.xfl>&\n"
+ CANCEL
+ else
+ fileName := formName
+ endif
+ ws := UIWorkSpace()
+
+ form := UIForm( fileName )
+ win := form:parseFile()
+// ?? valtype(win),chr(10)
+ if win == NIL
+ CANCEL
+ endif
+ win:show()
+
+ ws:run()
+ ws:quit()
+return 0
+
+/* Setting dialog */
+function settingsDialog()
+ ?? "TODO: Settings dialog&\n"
+return
+
+/* About dialog */
+function aboutDialog()
+ local dlg := UIWindow("About", win, "aboutDlg", .F.)
+ local hl, lside, t, bb, bD
+
+ hl := UIHBox(,4,8)
+ lside := UIVBox()
+ lside:add(UIImage(eas_logo_mini,.T.))
+ hl:add(lside,.F.,.F.)
+ dlg:userSpace:add(hl,.T.,.T.)
+ t := UIVBox()
+ hl:add(t,.T.,.T.)
+
+ t:add(UILabel("License: GPL version 2 or later"))
+ bb := UIButtonBar()
+ t:add(bb)
+ bD := UIButton(win, "&Close", {|o,e| dlg:close() } )
+ bb:add( bD )
+
+ dlg:setFocus(bD)
+ dlg:setDefault(bD)
+ dlg:setPlacement( .T. )
+ dlg:show()
+return
+//END \ No newline at end of file
diff --git a/kate/tests/highlight.rb b/kate/tests/highlight.rb
new file mode 100644
index 000000000..96061c1d0
--- /dev/null
+++ b/kate/tests/highlight.rb
@@ -0,0 +1,480 @@
+# This file is a testcase for the highlighting of Ruby code
+# It's not executable code, but a collection of code snippets
+#
+
+require 'Config'
+require 'DO/Clients'
+require 'DO/DBClients'
+
+ def CGI::escapeElement(string, *elements)
+ elements = elements[0] if elements[0].kind_of?(Array)
+ unless elements.empty?
+ string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/ni) do
+ CGI::escapeHTML($&)
+ end
+ else
+ string
+ end
+ end
+
+case inputLine
+ when "debug"
+ dumpDebugInfo
+ dumpSymbols
+ when /p\s+(\w+)/
+ dumpVariable($1)
+ when "quit", "exit"
+ exit
+ else
+ print "Illegal command: #{inputLine}"
+end
+
+
+kind = case year #hi there
+ when 1850..1889 then "Blues"
+ when 1890..1909 then "Ragtime"
+ when 1910..1929 then "New Orleans Jazz"
+ when 1930..1939 then "Swing"
+ when 1940..1950 then "Bebop"
+ else "Jazz"
+ end
+
+ # URL-encode a string.
+ # url_encoded_string = CGI::escape("'Stop!' said Fred")
+ # # => "%27Stop%21%27+said+Fred"
+ def CGI::escape(string)
+ string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
+ '%' + $1.unpack('H2' * $1.size).join('%').upcase
+ end.tr(' ', '+')
+ end
+
+
+# Class ClientManager
+#
+# definition : Import, store and export the various data used by the application.
+# This class is the sole interface between the application and the underlying database.
+
+mon, day, year = $1, $2, $3 if /(\d\d)-(\d\d)-(\d\d)/
+puts "a = #{a}" if fDebug
+print total unless total == 0
+
+while gets
+ next if /^#/ # Skip comments
+ parseLine unless /^$/ # Don't parse empty lines
+end
+
+if artist == "John Coltrane" #hi there
+ artist = "'Trane" #hi there
+end unless nicknames == "no" #hi there
+
+handle = if aSong.artist == "Gillespie" then #hi there
+ "Dizzy"
+ elsif aSong.artist == "Parker" then
+ "Bird"
+ else #hi there
+ "unknown"
+ end
+
+if aSong.artist == "Gillespie" then handle = "Dizzy"
+elsif aSong.artist == "Parker" then handle = "Bird"
+else handle = "unknown"
+end #hi there
+
+if aSong.artist == "Gillespie" then
+ handle = "Dizzy"
+elsif aSong.artist == "Parker" then
+ handle = "Bird"
+else
+ handle = "unknown"
+end
+
+if aSong.artist == "Gillespie"
+ handle = "Dizzy"
+elsif aSong.artist == "Parker"
+ handle = "Bird"
+else
+ handle = "unknown"
+end
+
+ case line
+ when /title=(.*)/
+ puts "Title is #$1"
+ when /track=(.*)/
+ puts "Track is #$1"
+ when /artist=(.*)/
+ puts "Artist is #$1"
+end
+
+case shape
+ when Square, Rectangle
+ # ...
+ when Circle
+ # ...
+ when Triangle
+ # ...
+ else
+ # ...
+end
+
+
+until playList.duration > 60 #hi there
+ playList.add(songList.pop)
+end
+
+3.times do
+ print "Ho! "
+end
+
+loop {
+ # block ...
+}
+
+songList.each do |aSong|
+ aSong.play
+end
+
+for aSong in songList
+ aSong.play
+end
+
+for i in ['fee', 'fi', 'fo', 'fum']
+ print i, " "
+end
+for i in 1..3
+ print i, " "
+end
+for i in File.open("ordinal").find_all { |l| l =~ /d$/}
+ print i.chomp, " "
+end
+
+class Periods
+ def each
+ yield "Classical"
+ yield "Jazz"
+ yield "Rock"
+ end
+end
+
+
+periods = Periods.new
+for genre in periods
+ print genre, " "
+end
+
+while gets
+ next if /^\s*#/ # skip comments
+ break if /^END/ # stop at end
+ # substitute stuff in backticks and try again
+ redo if gsub!(/`(.*?)`/) { eval($1) }
+ # process line ...
+end
+
+i=0
+loop do
+ i += 1
+ next if i < 3
+ print i
+ break if i > 4
+end
+
+for i in 1..100
+ print "Now at #{i}. Restart? "
+ retry if gets =~ /^y/i
+end
+
+def doUntil(cond)
+ yield
+ retry unless cond
+end
+
+i = 0
+doUntil(i > 3) {
+ print i, " "
+ i += 1
+}
+
+def system_call
+ # ... code which throws SystemCallError
+rescue SystemCallError
+ $stderr.print "IO failed: " + $!
+ opFile.close
+ File.delete(opName)
+ raise
+end
+
+class ClientManager
+
+ # constructor
+ def initialize(dbase)
+ @dbClient = DBClient.new(dbase)
+ @clients = Clients.new
+ end
+
+ def prout(a, b, xy="jj") 24 end
+ ###############################################################
+ #
+ # CLIENTS SECTION
+ #
+ ###############################################################
+
+ # update the clients object by retrieving the related data from the database
+ # returns the number of clients
+ def refreshClients
+ @clients.clean
+ unless @sqlQuery.nil? then
+ @sqlQuery.selectClient.each do |row|
+ @clients.addClient(row[0],row[1],row[2],row[3],row[4],row[5], row[6], row[7], row[8])
+ end
+ else
+ puts "SqlQuery wasn't created : cannot read data from database"
+ end
+ return @clients.length
+ end
+
+ # insert a client in the database and refreshes the local clients object
+ # we assume that none of the arguments is null
+ # we assume that the client, identified by raison_sociale doesn't already exists
+ def addClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact)
+ id = "0"
+ unless @sqlQuery.nil? then
+ id = @sqlQuery.insertClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact,tel_contact)
+ else
+ puts "SqlQuery wasn't created : database update cannot be performed"
+ end
+ @clients.addClient(id, raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact) # synchronize local object with DB
+ end
+
+ # deletes a client from the database and updates the local Clients object accordingly
+ def delClient(nomclient_brut)
+ raison_sociale, div, dep = Clients.getIdentifiers(nomclient_brut)
+ listeContratsExp, listeContratsSup, listeContratsProd, listePropositionsExp, listePropositionsSup = []
+
+ listeContratsExp = @contratsExpertise.getContratsFromClient(nomclient_brut)
+ listeContratsSup = @contratsSupport.getContratsFromClient(nomclient_brut)
+ listeContratsProd = @contratsProduits.getContratsFromClient(nomclient_brut)
+ listePropositionsExp = @propositionsExpertise.getPropositionsFromClient(nomclient_brut)
+ listePropositionsSup = @propositionsSupport.getPropositionsFromClient(nomclient_brut)
+
+ unless @sqlQuery.nil? then
+ @sqlQuery.deleteClient(raison_sociale, div, dep)
+
+ @sqlQuery.deleteContracts(Config::EXPERTISE,listeContratsExp)
+ @sqlQuery.deleteContracts(Config::SUPPORT,listeContratsSup)
+ @sqlQuery.deleteContracts(Config::PRODUIT,listeContratsProd)
+ @sqlQuery.deletePropositions(Config::EXPERTISE,listePropositionsExp)
+ @sqlQuery.deletePropositions(Config::SUPPORT,listePropositionsSup)
+ else
+ puts "SqlQuery wasn't created : database update cannot be performed"
+ end
+ @clients.delClient(raison_sociale,div,dep)
+
+ @contratsExpertise.deleteContracts(listeContratsExp)
+ @contratsSupport.deleteContracts(listeContratsSup)
+ @contratsProduits.deleteContracts(listeContratsProd)
+ @propositionsExpertise.deletePropositions(listePropositionsExp)
+ @propositionsSupport.deletePropositions(listePropositionsSup)
+ end
+end
+
+ # Mixin module for HTML version 3 generation methods.
+ module Html3 # :nodoc:
+
+ # The DOCTYPE declaration for this version of HTML
+ def doctype
+ %|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">|
+ end
+
+ # Initialise the HTML generation methods for this version.
+ def element_init
+ extend TagMaker
+ methods = ""
+ # - -
+ for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG
+ DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP
+ APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE
+ STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE
+ CAPTION ]
+ methods += <<-BEGIN + nn_element_def(element) + <<-END
+ def #{element.downcase}(attributes = {})
+ BEGIN
+ end
+ END
+ end
+
+ # - O EMPTY
+ for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT
+ ISINDEX META ]
+ methods += <<-BEGIN + nOE_element_def(element) + <<-END
+ def #{element.downcase}(attributes = {})
+ BEGIN
+ end
+ END
+ end
+
+ # O O or - O
+ for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr
+ th td ]
+ methods += <<-BEGIN + nO_element_def(element) + <<-END
+ def #{element.downcase}(attributes = {})
+ BEGIN
+ end
+ END
+ end
+ eval(methods)
+ end
+
+ end
+
+# following snippet from Webrick's log.rb
+# notice the erronous handling of the query method is_a?
+def format(arg)
+ str = if arg.is_a?(Exception)
+ "#{arg.class}: #{arg.message}\n\t" <<
+ arg.backtrace.join("\n\t") << "\n"
+ elsif arg.respond_to?(:to_str)
+ arg.to_str
+ else
+ arg.inspect
+ end
+end
+
+# following snippet from Webrick's httputils.rb
+# Splitting regexps on several lines might be bad form,
+# but not illegal in Ruby.
+# This should probably be supported in the highlighting
+def split_header_value(str)
+ str.scan(/((?:"(?:\\.|[^"])+?"|[^",]+)+)
+ (?:,\s*|\Z)/xn).collect{|v| v[0] }
+end
+
+# snippet from Net::Telnet
+string.gsub(/#{IAC}(
+ [#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]|
+ [#{DO}#{DONT}#{WILL}#{WONT}]
+ [#{OPT_BINARY}-#{OPT_NEW_ENVIRON}#{OPT_EXOPL}]|
+ #{SB}[^#{IAC}]*#{IAC}#{SE}
+ )/xno)
+
+# following snippet from Webrick's httpresponse.rb
+# the HEREDOC is not recognized as such
+@body << <<-_end_of_html_
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+ <HEAD><TITLE>#{HTMLUtils::escape(@reason_phrase)}</TITLE></HEAD>
+ <BODY>
+ <H1>#{HTMLUtils::escape(@reason_phrase)}</H1>
+ #{HTMLUtils::escape(ex.message)}
+ <HR>
+_end_of_html_
+
+
+# snippet from Webrick's httpproxy.rb
+# here we should make sure that the symbol definition ':' doesn't override
+# the module operator '::'
+Net::HTTP::version_1_2 if RUBY_VERSION < "1.7"
+
+# snippet from Webrick's cookie.rb
+# the beginning of the regexp is erronously highlighted like an operator
+key, val = x.split(/=/,2)
+
+# the following are division operators
+# it's a bit tricky to keep the operator apart from the regexp
+# we currently require a space after the operator, but that is not quite right either
+result = 8 / 4
+result /= divisor
+
+# test cases for general delimited input
+# quoted strings
+%Q|this is a string|
+%Q{this is a string}
+%Q(this is a string)
+%Q<this is a string>
+%Q[this is a string]
+
+%|also a string|
+%{also a string}
+%(also a string)
+%<also a string>
+%[also a string]
+
+# apostrophed strings
+%q|apostrophed|
+%q{apostrophed}
+%q(apostrophed)
+%q<apostrophed>
+%q[apostrophed]
+
+# regular expressions
+%r{expression}
+%r(expression)
+%r<expression>
+%r[expression]
+%r|expression|
+
+# shell commands
+%x{ls -l}
+%x(ls -l)
+%x<ls -l>
+%x[ls -l]
+
+# sometimes it's useful to have the command on multiple lines
+%x{ls -l |
+grep test }
+
+# token array
+%w{one two three}
+%w(one two three)
+%w<one two three>
+%w[one two three]
+
+# snippet from Net::IMAP
+# I object to putting String, Integer and Array into kernel methods.
+# While these classes are builtin in Ruby, this is an implementation detail
+# that should not be exposed to the user.
+# If we want to handle all std-lib classes, fine. But then they should be in their
+# own std-lib keyword category.
+
+def send_data(data)
+ case data
+ when nil
+ put_string("NIL")
+ when String
+ send_string_data(data)
+ when Integer
+ send_number_data(data)
+ when Array
+ send_list_data(data)
+ when Time
+ send_time_data(data)
+ when Symbol
+ send_symbol_data(data)
+ else
+ data.send_data(self)
+ end
+end
+
+# snippet from Net::POP
+# class names can have numbers in them as long as they don't begin with numbers
+# Ruby doesn't internally really make much of a difference between a class name and a constant
+
+# class aliases
+ POP = POP3
+ POPSession = POP3
+ POP3Session = POP3
+
+# "member access"
+POP::Session.COUNT.attribute.calc_with(2){ |arg| puts arg }
+
+# snippet from Net::SMTP
+# This breaks the code folding. I think we would need to
+# handle the '\' that continues the statement to the next line
+# in some way to make these kind of things not break something.
+raise ArgumentError, 'both user and secret are required'\
+ unless user and secret
+
+# string escapes must detect escaping the escape char
+str = "\\"
+str = "\\\\"
+# this is not part of the string
+%x{echo \\\}\\} # prints \}\
+# this is not part of the command
diff --git a/kate/tests/highlight.rib b/kate/tests/highlight.rib
new file mode 100644
index 000000000..0ec827798
--- /dev/null
+++ b/kate/tests/highlight.rib
@@ -0,0 +1,68 @@
+# bulb.rib
+# Author: Scott Iverson <si@SpamSucks_sitexgraphics.com>
+# Date: 6/9/95
+#
+
+Display "bulb.tiff" "file" "rgb"
+
+Projection "perspective" "fov" 25
+Format 380 380 -1
+Rotate 0 0 0 1
+Rotate -0.570093918 1 0 0
+Rotate 5.71059326 0 1 0
+Translate -1 -2 10
+
+WorldBegin
+ LightSource "ambientlight" 1 "intensity" .4
+ LightSource "distantlight" 2 "intensity" .6 "from" [0 0 0] "to" [-.3 -.2 1]
+ AttributeBegin
+ Rotate -90 1 0 0
+
+ ShadingInterpolation "smooth"
+
+# base
+ Surface "metal"
+ Color 0 0 1
+ AttributeBegin
+ Orientation "rh"
+ Disk 0 .18 360
+ AttributeEnd
+
+ Cylinder .18 0 .1 360
+
+ Translate 0 0 .1
+
+ Surface "matte"
+ Color 1 1 0
+ Hyperboloid .18 0 0 .4 0 .15 360
+
+ Translate 0 0 .15
+
+ Surface "metal"
+ Color 1 .7 0
+
+ Translate 0 0 .05
+ Torus .4 .05 -90 90 360
+ Translate 0 0 0.10
+ Torus .4 .05 -90 90 360
+ Translate 0 0 0.10
+ Torus .4 .05 -90 90 360
+ Translate 0 0 0.10
+ Torus .4 .05 -90 90 360
+ Translate 0 0 0.10
+ Torus .4 .05 -90 90 360
+ Translate 0 0 0.10
+ Translate 0 0 -0.05
+
+# the glass part
+
+ Surface "plastic" "roughness" .4
+
+ Color 1 1 1
+
+ PatchMesh "bicubic" 13 "nowrap" 7 "nowrap" "P" [ 0.40 0.00 0 0.40 0.220913867 0 0.220913867 0.40 0 0.00 0.40 0 -0.220913867 0.40 0 -0.40 0.220913867 0 -0.40 0.00 0 -0.40 -0.220913867 0 -0.220913867 -0.40 0 0.00 -0.40 0 0.220913867 -0.40 0 0.40 -0.220913867 0 0.40 0.00 0 0.40 0.00 .9 0.40 0.220913867 .9 0.220913867 0.40 .9 0.00 0.40 .9 -0.220913867 0.40 .9 -0.40 0.220913867 .9 -0.40 0.00 .9 -0.40 -0.220913867 .9 -0.220913867 -0.40 .9 0.00 -0.40 .9 0.220913867 -0.40 .9 0.40 -0.220913867 .9 0.40 0.00 .9 1.0 0.0 1.34771533 1.0 0.552284667 1.34771533 0.552284667 1.0 1.34771533 0.0 1.0 1.34771533 -0.552284667 1.0 1.34771533 -1.0 0.552284667 1.34771533 -1.0 0.0 1.34771533 -1.0 -0.552284667 1.34771533 -0.552284667 -1.0 1.34771533 0.0 -1.0 1.34771533 0.552284667 -1.0 1.34771533 1.0 -0.552284667 1.34771533 1.0 0.0 1.34771533 1.0 0.0 1.9 1.0 0.552284667 1.9 0.552284667 1.0 1.9 0.0 1.0 1.9 -0.552284667 1.0 1.9 -1.0 0.552284667 1.9 -1.0 0.0 1.9 -1.0 -0.552284667 1.9 -0.552284667 -1.0 1.9 0.0 -1.0 1.9 0.552284667 -1.0 1.9 1.0 -0.552284667 1.9 1.0 0.0 1.9 1.0 0.0 2.45228467 1.0 0.552284667 2.45228467 0.552284667 1.0 2.45228467 0.0 1.0 2.45228467 -0.552284667 1.0 2.45228467 -1.0 0.552284667 2.45228467 -1.0 0.0 2.45228467 -1.0 -0.552284667 2.45228467 -0.552284667 -1.0 2.45228467 0.0 -1.0 2.45228467 0.552284667 -1.0 2.45228467 1.0 -0.552284667 2.45228467 1.0 0.0 2.45228467 0.552284667 0 2.9 0.552284667 0.305018353 2.9 0.305018353 0.552284667 2.9 0 0.552284667 2.9 -0.305018353 0.552284667 2.9 -0.552284667 0.305018353 2.9 -0.552284667 0 2.9 -0.552284667 -0.305018353 2.9 -0.305018353 -0.552284667 2.9 0.00000000 -0.552284667 2.9 0.305018353 -0.552284667 2.9 0.552284667 -0.305018353 2.9 0.552284667 0 2.9 0.001 0 2.9 0.0010 0.000552284667 2.9 0.000552284667 0.001 2.9 0 0.0010 2.9 -0.000552284667 0.0010 2.9 -0.0010 0.000552284667 2.9 -0.001 0 2.9 -0.0010 -0.000552284667 2.9 -0.000552284667 -0.0010 2.9 0.0000 -0.0010 2.9 0.000552284667 -0.0010 2.9 0.0010 -0.000552284667 2.9 0.0010 0.0000 2.9 ]
+
+AttributeEnd
+
+WorldEnd
+
diff --git a/kate/tests/highlight.scheme b/kate/tests/highlight.scheme
new file mode 100644
index 000000000..ee081d791
--- /dev/null
+++ b/kate/tests/highlight.scheme
@@ -0,0 +1,186 @@
+; This is a test file to test kates scheme highlighting
+; This is a comment
+
+;; Another comment, usually used.
+;BEGIN region marker
+;; a vektor
+#(1 2 3 4 5)
+;END region marker
+;; this represents integer 28 (FIXME: does not work perfectly atm!)
+28 028 #e28 #i28 ;; Normal, normal, exact, inexact
+#b11100 #o34 #d28 #x1c ;; Bin, okt, dec, hex
+#oe34 #eo34 ;; combined.
+
+;; char.
+(#\y #\space) ;; list: `y' space.
+(#\ #\\ #\)) ;; list of spaces, backslash and`)'.
+#\newline ;; a newline-char
+#\NewLine ;; another one :)
+
+"Hello, world" ;; a string
+
+"hoho, what do you
+want to do ;; this is NO comment
+with that?"
+
+;; R5RS definiert diese beiden.
+"Das ist \"in Anführungszeichen\" und mit \\ Backslash."
+
+(let ((x (+ 1 2)) (y "blah")) ;; `let' highlighting.
+ (and (number? x) ;; `and' highlighting.
+ (string? y)))
+
+(let* ((x 2) (y (+ x 1))) ;; `let*' too.
+ (or (negative? x) ;; `or' anyways.
+ (negative? y)))
+
+(do ((vec (make-vector 5)) ;; `do' you may guess!
+ (i 0 (+ i 1)))
+ ((= i 5) vec)
+ (vector-set! vec i i))
+
+(quasiquote ((+ 1 2) (unquote (+ 1 2))))
+;; same as: `((+ 1 2) ,(+ 1 2))
+
+;; see above.
+(quasiquote ((+ 1 2) (unquote-splicing (list 1 2 3))))
+;; same as: `((+ 1 2) ,@(+ 1 2))
+
+;; not necessary.
+(quote ())
+
+(cond ((string? x) (string->symbol x)) ;; `cond' highlighting.
+ ((symbol? x) => (lambda (x) x)) ;; `=>' highlighting.
+ (else ;; `else' highlighting.
+ (error "Blah")))
+
+(case x ;; `case' highlighting.
+ ((#t) 'true) ((#f) 'false)
+ ((()) 'null)
+ ((0) 'zero))
+
+;; highlight `let-syntax' and `syntax-rules' .
+(let-syntax ((when (syntax-rules ()
+ ((when test stmt1 stmt2 ...)
+ ;; hl `begin' .
+ (if test (begin stmt1 stmt2 ...))))))
+ (let ((if #t)) ;; here`if' is actually no keyword.
+ (when if (set! if 'now)) ;; nor here.
+ if))
+
+(letrec-syntax ...) ;; hl `letrec-syntax'.
+
+(define-syntax when
+ (syntax-rules ()
+ ((when test stmt1 stmt2 ...)
+ (if test (begin stmt1 stmt2 ...))))))
+
+;; variable definitions.
+(define natural-numbers ;; hl `define' and the var name
+ ;; endless stream of all natual numbers.
+ (letrec ((next-cell ;; hl `letrec'.
+ (lambda (x) ;; hl `lambda'.
+ ;; hl `delay' .
+ (cons x (delay (next-cell (+ x 1)))))))
+ (next-cell 0)))
+
+;; a procedure with unusual but allowed name.
+(define 1+
+ (lambda (x)
+ (+ x 1)))
+
+;; a predicate
+(define between?
+ (lambda (x y z)
+ (if (and (>= x y) (<= x z))
+ #t ;; True
+ #f))) ;; False.
+
+;; imperative procedure
+(define set-something!
+ (lambda (required-argument another-one . all-remaining-args)
+ (set-car! another-one (lambda all-args
+ (set-cdr! required-argument
+ (append all-remaining-args
+ all-args))))))
+
+(define compose
+ (lambda (f g)
+ (lambda (x)
+ (f (g x)))))
+
+;; syntactical sugar for procedure-definitions.
+(define (compose f g)
+ (lambda (x)
+ (f (g x))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; NOW: Guile extensions ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; procedure-generator.
+(define ((compose f g) x)
+ (f (g x)))
+
+;; scheme doesn't say, which chars may be in variables...
+;; At least: Guile accepts umlauts
+(define-private (timetr??? sprache) ;; hl `define-private'.
+ (list-dialekt? sprache))
+
+(define-public x #t) ;; hl `define-public'.
+(define-module (foo bar)) ;; hl `define-module'.
+(define-macro (neither . exprs) ;; hl `define-macro'.
+ `(and ,@(map (lambda (x) `(not ,x)) exprs)))
+
+(defmacro neither exprs ;; `defmacro' as well.
+ `(and ,@(map (lambda (x) `(not ,x)) exprs)))
+
+;; hl, but I really don't know what this is supposed to do :-)
+(define-syntax-macro ...)
+
+;; hl GOOPS-`defines'
+(define-method (foo bar (baz <vector>) qux) ...)
+(define-class <foo> ...)
+(define-generic foo)
+(define-accessor bar)
+
+;; Keywords!
+(blah #:foo 33 #:bar 44)
+
+;; another convention for symbols:
+#{foo}#
+
+#{a
+few
+lines}#
+
+#{4711}#
+
+;; more chars.
+#\nul #\nl #\esc #\bs #\bel #\syn #\ack #\sp ;; etc, utc, itc, oops (this is boring)
+
+#!
+ guile block-comment.
+!#
+
+;; now, a bit hairy:
+#! comment !#
+still comment!!!
+!#
+'now-no-comment-anymore
+
+;; more precise:
+#! comment !#
+still comment
+!# still comment!
+!#
+'now-no-comment-anymore
+
+(while (> foo 10) ;; Highlight `while'.
+ (set! foo (- foo 1))
+ (catch #t ;; Highlight `catch'.
+ (lambda () (display foo))
+ (lambda (key . args)
+ (if (eq? key 'system-error)
+ (break) ;; Highlight `break'.
+ (continue))))) ;; Highlight `continue'. \ No newline at end of file
diff --git a/kate/tests/highlight.sh b/kate/tests/highlight.sh
new file mode 100644
index 000000000..bdac6e4f2
--- /dev/null
+++ b/kate/tests/highlight.sh
@@ -0,0 +1,198 @@
+#! /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
+
+
+# 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
diff --git a/kate/tests/highlight.sp b/kate/tests/highlight.sp
new file mode 100644
index 000000000..046dfea70
--- /dev/null
+++ b/kate/tests/highlight.sp
@@ -0,0 +1,32 @@
+*current sink p-type inverter - dc sweep of voltage I/O
+*file:invcsp0.sp
+
+*parameters
+.PARAM ww=38.5 $ parameter for width which will be swept
+
+*circuit net list
+Vdd vdd GND dc 5.0
+Vbias bias GND dc 2.5
+Vin src GND dc 0.0
+Mn out bias GND GND nmosl1 W=16 L=8
+Mp out in vdd vdd pmosl1 W=ww L=8
+Cl out GND 0.01P
+Rs src in 10K
+
+*options & analysis
+.OPTIONS POST=2 SCALE=1U $ output results for plot; scale mosfet L & W dimensions
+.DC Vin 0 5 0.1 $sweep I/P voltage
+.MEASURE DC vin_bal WHEN V(out)=2.5
+
+*output
+.plot DC v(src) v(in) v(out)
+
+*mosfet models - level 1
+.INC 'l1typ.inc'
+
+$ a comment
+* another comment
+
+.END
+
+
diff --git a/kate/tests/highlight.tcl b/kate/tests/highlight.tcl
new file mode 100644
index 000000000..d6b7276de
--- /dev/null
+++ b/kate/tests/highlight.tcl
@@ -0,0 +1,50 @@
+# tcl syntax highlighting sample script for Kate
+#
+# author: JM. Philippe 15/03/04
+
+# escaped characters
+set String \{
+set String \{
+set String \"
+set String " \" "
+set String " \{ "
+
+#comments and not comments
+# is comments
+;#is comments
+ # is comments
+# <h1> is html comment </h1>
+puts ok; # is comments
+set String [string map {</a> {<span>&#187;is not comments</span></a>}} $String]
+set String \#not_a_comment
+
+# blocks
+proc test {arg1 {arg2 {}} {arg3 {fr fq r}}} {
+ if {1} {; #comments
+ set String \{; # not a block start
+ }
+}
+
+proc test args {
+ set String \}; # not a block end
+}
+
+# BEGIN - collapsable comments
+# blablabla
+# END
+
+# strings
+set String "feqr feqr $gqer gqe"
+set String "feqr
+feqr \" $gqer \
+gqe
+"
+set String {feqr
+feqr \{ $gqer \
+gqe
+}
+
+# variables
+set b+1 [incr b]
+set {incr-b} ${b+1}
+puts ${incr-b}
diff --git a/kate/tests/highlight.tex b/kate/tests/highlight.tex
new file mode 100644
index 000000000..b706f708b
--- /dev/null
+++ b/kate/tests/highlight.tex
@@ -0,0 +1,73 @@
+% LaTeX test file for kate's syntax highlighting and code folding
+
+\ordinaryLaTeXcommandwithoption[10pt,a4paper]{article}
+% BEGIN region
+%comment, this is all ok % $
+\%no comments please
+\\%comment
+% END of region
+
+\newcommand{\nohighlighting}
+
+\section{normal}
+
+\ref{blue}
+\pageref{blue}
+\cite{blue}
+
+\begin{environmentshavespecialcolors}
+normal
+\end{environmentshavespecialcolors}
+
+$equations are green, \commands somewhat darker$
+normal
+$$equations are green, \commands somewhat darker$$
+normal
+\(
+\frac{1}{2}
+\begin{test}
+\end{test}
+\)
+normal
+\[
+%comment
+displaymath
+\]
+normal
+\begin{equation}
+green\darkergreen
+\begin{test}
+\test
+\end{test}
+\end{equation}
+
+\begin{equation*}
+green\darkergreen
+%comment
+\begin{test}
+\test
+\end{test}
+\%no comment
+\end{equation*}
+
+\{ %this should be comment
+
+\verb%this shouldn't be%and this should be normal text
+
+\begin{verbatim}
+text inside a verbatim environment is also treated special $ %,
+you can even put a \begin{verbatim} inside
+\end{verbatim}
+
+normal
+
+\begin{Verbatim}
+&@@#^%&^#$
+\end{Verbatim}
+
+
+\begin{Verbatim*}
+@*&^#@*(^#(*@&
+\end{Verbatim*}
+
+normal \ No newline at end of file
diff --git a/kate/tests/highlight.wrl b/kate/tests/highlight.wrl
new file mode 100644
index 000000000..2fb4b41c6
--- /dev/null
+++ b/kate/tests/highlight.wrl
@@ -0,0 +1,41 @@
+#VRML V2.0 utf8
+#
+# VRML highlighting test for Kate's syntax highlighting
+#
+
+# Keywords
+DEF, EXTERNPROTO, FALSE, IS, NULL, PROTO, ROUTE, TO, TRUE, USE, eventIn,
+eventOut, exposedField, field
+
+# Data types
+MFColor, MFFloat, MFInt32, MFNode. MFRotation, MFString, MFTime, MFVec2f,
+MFVec3f, SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation,
+SFString, SFTime, SFVec2f, SFVec3f
+
+# Predefined nodes
+Anchor, Appearance, AudioClip, Background, Billboard, Box, Collision, Color,
+ColorInterpolator, Cone, Coordinate, CoordinateInterpolator, Cylinder,
+CylinderSensor, DirectionalLight, ElevationGrid, Extrusion, Fog, FontStyle,
+Group, ImageTexture, IndexedFaceSet, IndexedLineSet, Inline, LOD, Material,
+MovieTexture, NavigationInfo, Normal, NormalInterpolator, OrientationInterpolator,
+PixelTexture, PlaneSensor, PointLight, PointSet, PositionInterpolator,
+ProximitySensor, ScalarInterpolator, Script, Shape, Sound, Sphere, SphereSensor,
+SpotLight, Switch, Text, TextureCoordinate, TextureTransform, TimeSensor,
+TouchSensor, Transform, Viewpoint, VisibilitySensor, WorldInfo
+
+# Some real VRML constructs to see if highlighting of int, float etc. works
+NavigationInfo {
+ avatarSize [0.25, 1.6, 0.75]
+ headlight TRUE
+ speed 1
+ type ["WALK", "ANY"]
+ visibilityLimit 0.0
+}
+
+# some further testing for strings: linefeeds are allowed within strings
+Text {
+ string ["some special in-string characters: \" \\
+ some more text in the next line
+ and yet another line"]
+}
+
diff --git a/kate/tests/highlight.xml b/kate/tests/highlight.xml
new file mode 100644
index 000000000..007449c29
--- /dev/null
+++ b/kate/tests/highlight.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE language SYSTEM "language.dtd">
+<!-- we need this tags or this is no valid file -->
+
+
+This is a pseudo XML file to test Kate's XML syntax highlighting.
+
+Doctype:
+ <!DOCTYPE HTML PUBLIC "-//SOME_DOCTYPE 0.01//EN" SYSTEM "foobar.dtd">
+
+Processing instruction:
+ <?php processing instruction ?>
+
+Comments:
+ <!-- a comment -->
+ <!-- another comment,
+ using more than one line -->
+
+Comment inside element:
+ <element attr="foobar">content<!-- comment --></element>
+
+Markup inside comment:
+ <!--
+ This is a comment!
+ <element inside_comment />
+ -->
+
+Empty element:
+ <empty/>
+ <empty />
+
+Simple element plus content:
+ <element>some content</element>
+ <element attr="foobar">some
+ content</element>
+
+Namespace for elements and attributes:
+ <ns:element>content</ns:element>
+ <element ns:attr="content content">content</element>
+
+Elements containing allowed characters:
+ <element-dash foo="test"/>
+ <element.dot foo="test"/>
+
+Elements containing allowed start characters:
+ <:element foo="test"/>
+ <_element foo="test"/>
+
+Single quotes (the same as double quotes):
+ <element attr='content &nbsp; content'>content</element>
+
+Allowed Whitespace:
+ <element attr = "test" >
+ content</element>
+
+Entities:
+ &nbsp;
+ &#229;
+ &#xE5;
+ &#Xe5;
+ &#1048;
+ &#x6C34;
+ <element attr="foo &nbsp; &#229; &amp; bar"/>
+
+Illegal XML, should not be highlighted:
+ <0foobar> -- no digit as first character
+ <-foo> -- no dash as first character
diff --git a/kate/tests/highlight.xsl b/kate/tests/highlight.xsl
new file mode 100644
index 000000000..f6e0efb12
--- /dev/null
+++ b/kate/tests/highlight.xsl
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="iso-8859-15"?>
+
+<!--
+ This file is freely distributable, created by Wilbert Berendsen (wbsoft@xs4all.nl)
+
+ This is just a simple XSLT file that converts some HTML pages to a XBEL bookmarklist.
+ It is included here to test the new XSLT highlighting by Peter Lammich.
+
+ TODO: add better test file.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+xmlns:h="http://www.w3.org/1999/xhtml">
+<xsl:output method="xml" encoding="iso-8859-15" indent="yes"
+ doctype-public="+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML"
+ doctype-system="http://www.python.org/topics/xml/dtds/xbel-1.0.dtd"
+/>
+
+<!-- main -->
+<xsl:template match="/">
+<xbel><folder><title>Linux at Home Links</title>
+<xsl:for-each select="//*[@id='maincontents']//h:li">
+ <xsl:variable name="f" select="document(h:a/@href)/h:html"/>
+ <folder>
+ <title><xsl:value-of select="h:a/h:strong"/></title>
+ <desc><xsl:value-of select="normalize-space(h:a/text())"/></desc>
+ <xsl:for-each select="$f//h:div[@id='maincontents']">
+ <xsl:call-template name="getbookmarks"/>
+ </xsl:for-each>
+
+ </folder>
+</xsl:for-each>
+</folder></xbel>
+</xsl:template>
+<!-- end of main -->
+
+<!-- get bookmarks from a page -->
+<xsl:template name="getbookmarks">
+
+<xsl:choose>
+ <!-- harvest links from p or li elements -->
+ <xsl:when test="self::h:li or self::h:p">
+ <xsl:variable name="t" select="normalize-space()"/>
+ <xsl:for-each select=".//h:a[1]">
+ <xsl:call-template name="bookmark">
+ <xsl:with-param name="desc" select="$t"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ <xsl:for-each select=".//h:a[position()!=1]">
+ <xsl:call-template name="bookmark"/>
+ </xsl:for-each>
+ </xsl:when>
+
+
+ <xsl:otherwise>
+ <xsl:for-each select="*">
+ <xsl:call-template name="getbookmarks"/>
+ </xsl:for-each>
+ </xsl:otherwise>
+
+</xsl:choose>
+
+</xsl:template>
+
+
+<xsl:template name="bookmark">
+ <xsl:param name="href" select="@href"/>
+ <xsl:param name="desc" select="''"/>
+ <xsl:param name="title" select="normalize-space()"/>
+
+ <xsl:variable name="realdesc">
+ <xsl:choose>
+ <xsl:when test="starts-with($desc,$title)">
+ <xsl:choose>
+ <xsl:when test="starts-with(translate(substring-after($desc,$title),',.;','...'),'.')">
+ <xsl:value-of select="substring($desc,string-length($title) + 2)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-after($desc,$title)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$desc"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <bookmark>
+ <xsl:attribute name="href">
+ <xsl:choose>
+ <xsl:when test="starts-with($href,'http://') or starts-with($href,'ftp://') or starts-with($href,'mailto:')">
+ <xsl:value-of select="$href"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('http://www.xs4all.nl/~wbsoft/linux/links/',$href)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <title><xsl:value-of select="normalize-space($title)"/></title>
+ <xsl:if test="normalize-space($realdesc) != ''">
+ <desc><xsl:value-of select="normalize-space($realdesc)"/></desc>
+ </xsl:if>
+ </bookmark>
+</xsl:template>
+
+
+
+</xsl:stylesheet>
diff --git a/kate/tests/highlight.y b/kate/tests/highlight.y
new file mode 100644
index 000000000..f7715e6db
--- /dev/null
+++ b/kate/tests/highlight.y
@@ -0,0 +1,54 @@
+/* Yacc / Bison hl test file.
+ * It won't compile :-) Sure !
+ */
+
+%{
+
+#include <iostream>
+using namespace std;
+
+extern KateParser *parser;
+
+%}
+
+%locations
+
+%union {
+ int int_val;
+ double double_val;
+ bool bool_val;
+ char *string_val;
+ char *ident_val;
+ struct var *v;
+ void *ptr;
+}
+
+%token <int_val> TOK_NOT_EQUAL "!="
+%token <int_val> TOK_LESSER_E "<="
+%token <int_val> TOK_GREATER_E ">="
+%token <int_val> TOK_EQUAL_2 "=="
+
+%type <int_val> type type_proc
+
+%%
+
+prog: KW_PROGRAM ident { parser->start($2); } prog_beg_glob_decl instructions { parser->endproc(0); } dev_procedures KW_ENDP ;
+
+number: integer_number
+ | TOK_DOUBLE
+ {
+ $$ = new var;
+ $$->type = KW_REEL;
+ $$->cl = var::LITTERAL;
+ $$->real = $<int_val>1;
+ };
+
+%%
+
+#include <stdio.h>
+
+int main(void)
+{
+ puts("Hello, World!");
+ return 0;
+}
diff --git a/kate/tests/highlight_lpc.c b/kate/tests/highlight_lpc.c
new file mode 100644
index 000000000..fe5c62979
--- /dev/null
+++ b/kate/tests/highlight_lpc.c
@@ -0,0 +1,64 @@
+// NOTE: This is a test file for kate's LPC syntax highlighting.
+
+// This is a Single-Line Comment
+/* This is a Multi-
+ Line Comment */
+
+// This again is a Single-Line Comment which should end here /*
+
+// And this is an evil single line comment \
+ which should include this and the next line because of the \
+ Do not use this style at home, kids.
+// BEGIN region marker
+
+// END of region marker
+
+private void create()
+{
+// Some Preprocessor stuff:
+#define SOME_STUFF if(foo("bar")) \
+ { \
+ bar("foo"); \
+ } // Preprocessor, Keyword, Preprocessor-String, Multiline
+
+ // Some closures:
+ #'create;
+ #'?!;
+
+
+ /* Some other Data Types: */
+
+ int i = 1; // Integer.
+ float b = 2.34; // Float.
+ int c = 0b001; // Binary
+ int e = 0x019Beef; // Hexadecimal
+ int f = 0o2345; // Octal
+ string a = "Wheee"; // String
+ string x = "Wheee\
+ heee"; // Multi-Line String, again, don't use this.
+
+
+
+ /* Some keywords: */
+ if(1)
+ {
+ switch(2)
+ {
+ case 3:
+ 4;
+ break;
+ }
+ }
+
+ else
+ {
+ return 0;
+ }
+}
+
+/*
+WARNING: If the above function is part of a multi-line comment,
+ it's buggy. The WARNING: itself should be a comment-keyword.
+ That's not actually part of the language, but simply used
+ to highlight important stuff inside comments like TODO: etc.
+*/
diff --git a/kate/tests/highlight_ocaml.ml b/kate/tests/highlight_ocaml.ml
new file mode 100644
index 000000000..dc1717a82
--- /dev/null
+++ b/kate/tests/highlight_ocaml.ml
@@ -0,0 +1,105 @@
+(* ocaml test file -- a big stew of Objective Caml syntax to use to
+ test Kate's syntax highlighting. This will not run! :-) *)
+
+(* First a little piece of real OCaml that should look right: *)
+
+ #load "basic";;
+ (* Return a default value for a BASIC variable given its identifer. *)
+ let default_value (ident : string) : basic_value =
+ assert (String.length ident > 0);
+ match ident.[String.length ident - 1] with
+ | '$' -> Str ""
+ | '%' -> Int 0
+ | '!' -> Flt 0.0
+ | _ -> Flt 0.0
+ ;;
+
+(* Directives: *)
+#load "pa_o";;
+ #load "pa_o";;
+object # meth ;; (* not a directive - a method call *)
+object
+ # meth ;; (* not a directive - a method call *)
+
+(* OCaml keywords: *)
+and as assert asr (* etc. there so many... *)
+
+(* Additional OCaml Revised Syntax keywords: *)
+(* These are in a seperate category so they can be coloured to look
+ like identifiers when ordinary OCaml syntax is being used: *)
+declare where value
+
+(* There's no way to reliably highlight all OCaml type expressions,
+ (they can be very complex) so just the built-in type names are highlighted.*)
+exn lazy_t format unit int real char string ref array bool list option
+
+
+let integers : int list = [
+ 123456789; (* decimal *)
+ -0xabcedf0123456789; (* hexadecimal *)
+ 0xABCDEF0123456789; (* hexadecimal *)
+ -0o1234567; (* octal *)
+ 0b01001010101010; (* binary *)
+ -0Xabcedf0123456789; (* hexadecimal *)
+ 0XABCDEF0123456789; (* hexadecimal *)
+ -0O1234567; (* octal *)
+ 0B01001010101010; (* binary *)
+ -123_456_789; (* Underscores are allowed in numeric constants. *)
+ 0x_abce_df01_2345_6789;
+ -0o12_34_567;
+ 0b_0100_1010_1010_1101;
+];;
+
+let floats : real list = [
+ 12345.6789;
+ -1.23456789e4; (* All variations of the exponent form *)
+ 1.23456789e+4;
+ -1.23456789e-4;
+ 1.23456789E-4;
+ -1.23456789E+4;
+ 12_345.6789; (* Underscores are allowed in numeric constants. *)
+ -1.23_456_789e+4;
+ 12_345.6789;
+];;
+
+let characters : char list = [
+ 'a';
+ ' ';
+ 'ä';
+ '\n'; '\r'; '\t'; '\b'; (* Control characters. Only these four: not the full C-language range. *)
+ '\000'; '\128'; (* Decimal character codes. These are always 3 digits. *)
+ '\x02'; '\xff'; '\xFF'; (* Hexadecimal character codes. These are always 3 digits. *)
+ '\\'; '\''; '\"'; '"' (* Quote character escapes. *)
+];;
+
+(* Quotes used to mark constants in parsers should
+ not be confused with character constant quotes.
+ "Ticks" at the end of identifiers should
+ not be confused with character constant quotes. *)
+let basic_identifier =
+ parser
+ [< ''F'; ''N'; name = s >] -> ID (s, 'f')
+ | [< name = s' >] -> ID (s','i')
+;;
+
+let strings : string list = [
+ ""; (* Empty string *)
+ "a"; " "; "ä"; "ab";
+ "A\nB"; "A\rB"; "A\tB"; "A\bB"; (* Control characters. Only these four: not the full C-language range. *)
+ "A\000B"; "A\128B"; (* Decimal character codes. These are always 3 digits. *)
+ "A\x02B"; "A\xffB"; "A\xFFB"; (* Hexadecimal character codes. These are always 3 digits. *)
+ "A\\B"; "A\'B"; "A'B"; "A\"B"; (* Quote character escapes. *)
+ "A multiline\
+ string";
+];
+
+let camlp4_quotations = [
+ <<A Camlp4 source code quotation.>> ;
+ <:QUOTE<A labelled Camlp4 source code quotation.>> ;
+ <:QUÖTÈ<A labelled Camlp4 source code quotation. (Latin-1 identifier.)>> ;
+ << A quote with an escape: \>> (end-quote symbol) >> ;
+ << A quote with an escape: \<< (plain start quote-symbol) >> ;
+ << A quote with an escape: \<:Trouvé< (labelled start-quote symbol) >> ;
+];;
+
+(* end *)
diff --git a/kate/tests/highlight_octave.m b/kate/tests/highlight_octave.m
new file mode 100644
index 000000000..1f96036b8
--- /dev/null
+++ b/kate/tests/highlight_octave.m
@@ -0,0 +1,74 @@
+##=====================================================
+% Octave test code for Kate/Kwrite syntax highlighting
+% (shamelessly copied from Matlab's, since the two
+% are very similar)
+% kate: hl Octave;
+##=====================================================
+
+% Numbers _____________________________________________
+5, 5.5, .1, 0.1, 0.4e5, 1.2e-5, 5i, 5.3i, 6j, .345+3i
+5', 5.5', .1', 0.1', 0.4e5', 1.2e-5', 5i', 5.3i', 6j', .345+3i'
+
+% Operators ___________________________________________
+% relational operators
+'asdf'~=4, c<=4, d>=4, a<b, a>b, a==b, b||c, b&&c
+% elementwise arithmetic operators
+a.^b, a.*b a./b, 1:4:5
+% single-character binary arithmetic
+a+3, a-3, a*2, a^3, a/3, a\3, a|b, a&b
+% unary operators
+a = ~g; g = @sfdgdsf(sdfsd,345); g.' + 1i.' - ('asdf').'
+% separators and delimiter
+(asd),[sadf];{asdf},;;,;;;()
+% continuation
+a = 1+ ...
+ 2;
+
+% Strings and adjoint _________________________________
+% incomplete strings
+'string
+'str''
+'str''ing
+'str''\'
+% complete strings
+'string' % simple string
+'''' '\'' % strings containing '
+'str''ing' % one string containing '
+'string' 'string' % two strings
+'asdf' "asdf""" variable % two strings and a variable
+'asdf''asdf'' fsgdfg' + (asdf)' - 'asdf'.' + []''''.';''
+'sadf'.' % string transpose
+% adjoint
+{'asdf'}' + 1
+('asdf')' + 1
+['asdf']' + 1
+'' var''' % empty string, var with >1 adjoints
+[5]'*{5}'*('asd')'.'+(5)'*6'*asdf'*asdf'.' % many adjoints
+A'*B + 1 % adjoint
+A.'*B + 1 % transpose
+A.'.'*B + 1 % double transpose
+A'.' + 1 % adjoint, then transpose
+A.'' % transpose, then adjoint
+
+% System command ______________________________________
+!hostname
+!cp * /tmp
+
+% Reserved keywords ___________________________________
+function, persistent, global
+endfunction
+
+switch, case, otherwise
+endswitch
+
+if, else, elseif
+endif
+
+try, end_try_catch
+for, while, break, continue
+endfor
+
+endwhile
+return
+function, FUNCTION, Function % case sensitive!
+endfunction \ No newline at end of file
diff --git a/kate/tests/test.js b/kate/tests/test.js
new file mode 100644
index 000000000..2dfe86c5b
--- /dev/null
+++ b/kate/tests/test.js
@@ -0,0 +1,134 @@
+/* test.js - test for javascript.xml syntax file */
+// Note: this script will not, and is not supposed to, comile in any js engine.
+
+/*
+ NOTE: The words "todo", "fixme" and "note" should be rendered in a different style
+ within comments, match should be caseless (to test for regexp insensitive attribute).
+ The regex used for this rule is */
+ String = /\b(?:fixme|todo|note)\b/
+ /* Thus, for example "Notebook" is not caught by
+ this rule. (the "?:" in the subpattern is there to avoid the regex engine wasting time
+ saving a backref, which is not used for anything. I do not know if the overhead of parsing
+ that is greater than the time saved by not capturing the text...)
+ The rule for catching these words is placed in a context "Comment common", which is used
+ by both comment contexts (single line, multiline) using the new "IncludeRules" item.
+*/
+
+// test if regex support works - nice with new fallthrough prop in context:)
+somestring.replace( /dooh/ , "bah!");
+re=/foo/ig; // hehe
+
+somestring.search(
+ /^foo\w+\s\d{0,15}$/
+ );
+
+ re =
+ /dooh/;
+
+// This is supposedly legal:
+re = somebool ? /foo/ : /bar/;
+
+// NOTE - Special case: an empty regex, not a comment.
+// The rule uses a positive lookahead assertion to catch it: "//(?=;)".
+re = //;
+re = /a|b/;
+
+/*
+ Tests for the regex parser.
+ It will parse classes, quanitfiers, special characters and regex operaters,
+ as specified in the netscape documentation for javascript.
+ Regexps are only parsed in their clean form, as the RegExp(string) constructor
+ is using a quoted string.
+ TODO: Find out if more regex feats should be supported.
+ Consider using more itemDatas - assertion, quantifier are options.
+*/
+
+re = /^text\s+\d+\s*$/;
+re = /a pattern with caret \(^\) in it/;
+re = /(\d{0,4})\D/;
+re = /[a-zA-Z_]+/;
+re = /[^\d^]+/;
+re = /\s+?\w+\.$/;
+re = /\/\//;
+re = /a|b/;
+
+// a test if #pop back from a comment will work
+re = /*/foo/*/ /bar/;
+// ^ POP
+// ^ we got back after pop in comment, if there is regexp attribs here :-)
+
+/*
+ Some tests if the fallthrough works.
+ The fallthrough happens if a regexp is not found in a possible (!) position,
+ which is after "search(" or "replace(" or "=" or "?" or ":" in version 0.1 of the xml file
+*/
+
+var foo = 'bar';
+// ^ fallthrough!
+
+
+somestring.replace( new RegExp("\\b\\w+\\b"), "word: $1");
+// ^ fallthrough expected. ("new" whould be bold)
+
+
+something.method =
+ function ( a, b, c ) { /* ... */ }
+// ^ fallthrough ?!
+
+something.other =
+function ( d, e, f ) { /* ... */ }
+// fallthrough expected at col 0 ("function" should be bold)
+
+var ary = new Array(5);
+// ^ fallthrough ? (if keyword is correctly rendered)
+
+var b = a ? 1 : 0;
+// ^ ^ fallthroughs. numbers must be rendered correctly.
+
+var c = d ? true : false;
+
+var conditinalstring = b ?
+ "something" :
+ "something else";
+// guess...
+
+
+/*
+ Normal program flow...
+*/
+
+if (something)
+ dostuff();
+else
+ dont();
+
+ return;
+
+try { bla() } catch (e) { alert("ERROR! : " + e) }
+
+for (int i=0; i < j; i++)
+ document.write("i is" + i + "<br>");
+
+while (something)
+{
+ block();
+ picky:
+ if (!1)
+ break;
+ else
+ continue;
+}
+
+with (a) {
+ do {
+ stuff( b ); // a.b if it exists
+ } while (itmakessense);
+}
+
+switch (i) {
+ case 0:
+ f();
+ break;
+ default:
+ break;
+}
diff --git a/kate/tests/test.uc b/kate/tests/test.uc
new file mode 100644
index 000000000..be53bccee
--- /dev/null
+++ b/kate/tests/test.uc
@@ -0,0 +1,266 @@
+//=============================================================================
+// Shield Gun
+//=============================================================================
+class ShieldGun extends Weapon
+ config(user);
+
+#EXEC OBJ LOAD FILE=InterfaceContent.utx
+
+var Sound ShieldHitSound;
+var String ShieldHitForce;
+
+replication
+{
+ reliable if (Role == ROLE_Authority)
+ ClientTakeHit;
+}
+
+simulated function DoAutoSwitch()
+{
+}
+
+simulated event RenderOverlays( Canvas Canvas )
+{
+ local int m;
+
+ if ((Hand < -1.0) || (Hand > 1.0))
+ {
+ for (m = 0; m < NUM_FIRE_MODES; m++)
+ {
+ if (FireMode[m] != None)
+ {
+ FireMode[m].DrawMuzzleFlash(Canvas);
+ }
+ }
+ }
+ Super.RenderOverlays(Canvas);
+}
+
+// AI Interface
+function GiveTo(Pawn Other, optional Pickup Pickup)
+{
+ Super.GiveTo(Other, Pickup);
+
+ if ( Bot(Other.Controller) != None )
+ Bot(Other.Controller).bHasImpactHammer = true;
+}
+
+function bool CanAttack(Actor Other)
+{
+ return true;
+}
+
+simulated function Timer()
+{
+ local Bot B;
+
+ if (ClientState == WS_BringUp)
+ {
+ // check if owner is bot waiting to do impact jump
+ B = Bot(Instigator.Controller);
+ if ( (B != None) && B.bPreparingMove && (B.ImpactTarget != None) )
+ {
+ B.ImpactJump();
+ B = None;
+ }
+ }
+ Super.Timer();
+ if ( (B != None) && (B.Enemy != None) )
+ BotFire(false);
+}
+
+function FireHack(byte Mode)
+{
+ if ( Mode == 0 )
+ {
+ FireMode[0].PlayFiring();
+ FireMode[0].FlashMuzzleFlash();
+ FireMode[0].StartMuzzleSmoke();
+ IncrementFlashCount(0);
+ }
+}
+
+/* BestMode()
+choose between regular or alt-fire
+*/
+function byte BestMode()
+{
+ local float EnemyDist;
+ local bot B;
+
+ B = Bot(Instigator.Controller);
+ if ( (B == None) || (B.Enemy == None) )
+ return 1;
+
+ EnemyDist = VSize(B.Enemy.Location - Instigator.Location);
+ if ( EnemyDist > 2 * Instigator.GroundSpeed )
+ return 1;
+ if ( (B.MoveTarget != B.Enemy) && ((EnemyDist > 0.5 * Instigator.GroundSpeed)
+ || (((B.Enemy.Location - Instigator.Location) Dot vector(Instigator.Rotation)) <= 0)) )
+ return 1;
+ return 0;
+}
+
+// super desireable for bot waiting to impact jump
+function float GetAIRating()
+{
+ local Bot B;
+ local float EnemyDist;
+
+ B = Bot(Instigator.Controller);
+ if ( B == None )
+ return AIRating;
+
+ if ( B.bPreparingMove && (B.ImpactTarget != None) )
+ return 9;
+
+ if ( B.PlayerReplicationInfo.HasFlag != None )
+ {
+ if ( Instigator.Health < 50 )
+ return AIRating + 0.35;
+ return AIRating + 0.25;
+ }
+
+ if ( B.Enemy == None )
+ return AIRating;
+
+ EnemyDist = VSize(B.Enemy.Location - Instigator.Location);
+ if ( B.Stopped() && (EnemyDist > 100) )
+ return 0.1;
+
+ if ( (EnemyDist < 750) && (B.Skill <= 2) && !B.Enemy.IsA('Bot') && (ShieldGun(B.Enemy.Weapon) != None) )
+ return FClamp(300/(EnemyDist + 1), 0.6, 0.75);
+
+ if ( EnemyDist > 400 )
+ return 0.1;
+ if ( (Instigator.Weapon != self) && (EnemyDist < 120) )
+ return 0.25;
+
+ return ( FMin(0.6, 90/(EnemyDist + 1)) );
+}
+
+// End AI interface
+
+function AdjustPlayerDamage( out int Damage, Pawn InstigatedBy, Vector HitLocation,
+ out Vector Momentum, class<DamageType> DamageType)
+{
+ local int Drain;
+ local vector Reflect;
+ local vector HitNormal;
+ local float DamageMax;
+
+ DamageMax = 100.0;
+ if ( DamageType == class'Fell' )
+ DamageMax = 20.0;
+ else if( !DamageType.default.bArmorStops || (DamageType == class'DamTypeShieldImpact' && InstigatedBy == Instigator) )
+ return;
+
+ if ( CheckReflect(HitLocation, HitNormal, 0) )
+ {
+ Drain = Min( Ammo[1].AmmoAmount*2, Damage );
+ Drain = Min(Drain,DamageMax);
+ Reflect = MirrorVectorByNormal( Normal(Location - HitLocation), Vector(Instigator.Rotation) );
+ Damage -= Drain;
+ Momentum *= 1.25;
+ Ammo[1].UseAmmo(Drain/2);
+ DoReflectEffect(Drain/2);
+ }
+}
+
+function DoReflectEffect(int Drain)
+{
+ PlaySound(ShieldHitSound, SLOT_None);
+ ShieldAltFire(FireMode[1]).TakeHit(Drain);
+ ClientTakeHit(Drain);
+}
+
+simulated function ClientTakeHit(int Drain)
+{
+ ClientPlayForceFeedback(ShieldHitForce);
+ ShieldAltFire(FireMode[1]).TakeHit(Drain);
+}
+
+function bool CheckReflect( Vector HitLocation, out Vector RefNormal, int AmmoDrain )
+{
+ local Vector HitDir;
+ local Vector FaceDir;
+
+ if (!FireMode[1].bIsFiring || Ammo[0].AmmoAmount == 0) return false;
+
+ FaceDir = Vector(Instigator.Controller.Rotation);
+ HitDir = Normal(Instigator.Location - HitLocation + Vect(0,0,8));
+ //Log(self@"HitDir"@(FaceDir dot HitDir));
+
+ RefNormal = FaceDir;
+
+ if ( FaceDir dot HitDir < -0.37 ) // 68 degree protection arc
+ {
+ if (AmmoDrain > 0)
+ Ammo[0].UseAmmo(AmmoDrain);
+ return true;
+ }
+ return false;
+}
+
+function AnimEnd(int channel)
+{
+ if (FireMode[0].bIsFiring)
+ {
+ LoopAnim('Charged');
+ }
+ else if (!FireMode[1].bIsFiring)
+ {
+ Super.AnimEnd(channel);
+ }
+}
+
+function float SuggestAttackStyle()
+{
+ return 0.8;
+}
+
+function float SuggestDefenseStyle()
+{
+ return -0.8;
+}
+
+simulated function float ChargeBar()
+{
+ return FMin(1,FireMode[0].HoldTime/ShieldFire(FireMode[0]).FullyChargedTime);
+}
+
+defaultproperties
+{
+ ItemName="Shield Gun"
+ IconMaterial=Material'InterfaceContent.Hud.SkinA'
+ IconCoords=(X1=200,Y1=281,X2=321,Y2=371)
+
+ bShowChargingBar=true
+ bCanThrow=false
+ FireModeClass(0)=ShieldFire
+ FireModeClass(1)=ShieldAltFire
+ InventoryGroup=1
+ Mesh=mesh'Weapons.ShieldGun_1st'
+ BobDamping=2.2
+ PickupClass=class'ShieldGunPickup'
+ EffectOffset=(X=15.0,Y=6.7,Z=1.2)
+ bMeleeWeapon=true
+ ShieldHitSound=Sound'WeaponSounds.ShieldGun.ShieldReflection'
+ DrawScale=0.4
+ PutDownAnim=PutDown
+ DisplayFOV=60
+ PlayerViewOffset=(X=2,Y=-0.7,Z=-2.7)
+ PlayerViewPivot=(Pitch=500,Roll=0,Yaw=500)
+
+ UV2Texture=Material'XGameShaders.WeaponEnvShader'
+
+ AttachmentClass=class'ShieldAttachment'
+ SelectSound=Sound'WeaponSounds.ShieldGun_change'
+ SelectForce="ShieldGun_change"
+ ShieldHitForce="ShieldReflection"
+
+ AIRating=0.35
+ CurrentRating=0.35
+
+ DefaultPriority=2
+}