diff options
| author | Anteru <bitbucket@ca.sh13.net> | 2019-05-21 16:32:04 +0000 |
|---|---|---|
| committer | Anteru <bitbucket@ca.sh13.net> | 2019-05-21 16:32:04 +0000 |
| commit | fa473ff605f5192bfbff5ce87a8028c0e984fc99 (patch) | |
| tree | 67bf0052a79b808243723d89281f86225cf09c56 /tests/examplefiles | |
| parent | 9a4f6ef2b7f14e7f59de9bda37facfdcb1ad2e44 (diff) | |
| parent | 289920a1b11a9445830b4d64f6b5fcbe68966f23 (diff) | |
| download | pygments-git-fa473ff605f5192bfbff5ce87a8028c0e984fc99.tar.gz | |
Merged in lucatorella/pygments-main (pull request #813)
Add support for @import keyword in Objective-C
Diffstat (limited to 'tests/examplefiles')
| -rw-r--r-- | tests/examplefiles/apache2.conf | 5 | ||||
| -rw-r--r-- | tests/examplefiles/example.bbc | 156 | ||||
| -rw-r--r-- | tests/examplefiles/example.boa | 18 | ||||
| -rw-r--r-- | tests/examplefiles/example.pony | 18 | ||||
| -rw-r--r-- | tests/examplefiles/example.toml | 181 | ||||
| -rw-r--r-- | tests/examplefiles/freefem.edp | 94 | ||||
| -rw-r--r-- | tests/examplefiles/teraterm.ttl | 34 |
7 files changed, 506 insertions, 0 deletions
diff --git a/tests/examplefiles/apache2.conf b/tests/examplefiles/apache2.conf index d0e838e0..5db66b10 100644 --- a/tests/examplefiles/apache2.conf +++ b/tests/examplefiles/apache2.conf @@ -391,3 +391,8 @@ BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully # Include the virtual host configurations: Include /etc/apache2/sites-enabled/[^.#]* + +# From PR#766 +<IfVersion >= 2.4> +ErrorLogFormat "%{cu}t %M" +</IfVersion>
\ No newline at end of file diff --git a/tests/examplefiles/example.bbc b/tests/examplefiles/example.bbc new file mode 100644 index 00000000..ebdb8537 --- /dev/null +++ b/tests/examplefiles/example.bbc @@ -0,0 +1,156 @@ +10REM >EIRC +20REM The simplest IRC client you can write. Maybe. +30REM (C) Justin Fletcher, 1998 +40: +50END=PAGE+1024*16 +60REM Change these if you wish +70host$="irc.stealth.net" +80port=6667 +90nick$="eirc" +100ourchan$="#acorn" +110: +120REM Start connecting to a host +130SYS "ESocket_ConnectToHost",host$,port TO handle +140REPEAT +150 SYS "ESocket_CheckState",handle TO state +160 IF state<-1 THENSYS "ESocket_Forget",handle:SYS "ESocket_DecodeState",state TO a$:ERROR 1,"Failed ("+a$+")" +170UNTIL state=4 +180: +190REM We are now connected +200PRINT"Connected" +210: +220REM Log on to the server +230SYS "ESocket_SendLine",handle,"USER "+nick$+" x x :"+nick$ +240SYS "ESocket_SendLine",handle,"NICK "+nick$ +250SYS "ESocket_SendLine",handle,"JOIN "+ourchan$ +260REM Install a monitor so that we don't waste time +270SYS "ESocket_Monitor",0,handle TO monitor +280SYS "ESocket_ResetMonitor",monitor,0 TO polladdr% +290: +300REM If we crash, we should tidy up after ourselves +310ON ERROR SYS "XESocket_Forget",handle:SYS "XESocket_Forget",monitor:ERROR EXT ERR,REPORT$+" at line "+STR$ERL +320: +330REM Memory buffer for our data +340bufsize%=1024 +350DIM buf% bufsize% +360: +370input$="":REM The input line +380REPEAT +390 REM In a taskwindow we should yield until there is data +400 SYS "OS_UpCall",6,polladdr% +410 IF !polladdr%<>0 THEN +420 REM Reset the monitor for the time being +430 SYS "ESocket_ResetMonitor",monitor,0 TO polladdr% +440 REPEAT +450 REM Read lines from the connection until this buffer is empty +460 SYS "ESocket_ReadLine",handle,buf%,bufsize%,%100 TO ,str,len +470 IF str<>0 AND $str<>"" THEN +480 line$=$str +490 IF LEFT$(line$,4)="PING" THEN +500 REM Ping's must be replied to immediately +510 SYS "ESocket_SendLine",handle,"PONG "+MID$(line$,6) +520 ELSE +530 REM Extract source info +540 from$=MID$(LEFT$(line$,INSTR(line$+" "," ")-1),2) +550 line$=MID$(line$,INSTR(line$+" "," ")+1) +560 uid$=LEFT$(from$,INSTR(from$+"!","!")-1) +570 com$=LEFT$(line$,INSTR(line$+" "," ")-1) +580 line$=MID$(line$,INSTR(line$+" "," ")+1) +590 REM remove the input line +600 IF input$<>"" THENFORI=1TOLEN(input$):VDU127:NEXT +610 CASE FNupper(com$) OF +620 WHEN "PRIVMSG" +630 REM Extract the destination +640 chan$=LEFT$(line$,INSTR(line$+" "," ")-1) +650 line$=MID$(line$,INSTR(line$+" "," ")+2):REM Skip : +660 IF LEFT$(line$,1)=CHR$1 THEN +670 REM CTCP, so respond to it +680 line$=MID$(line$,2,LEN(line$)-2) +690 com$=LEFT$(line$,INSTR(line$+" "," ")-1) +700 line$=MID$(line$,INSTR(line$+" "," ")+1) +710 CASE FNupper(com$) OF +720 WHEN "PING" +730 REM Ping lag timing +740 line$="PONG "+line$ +750 PRINTuid$;" pinged us" +760 WHEN "VERSION" +770 REM Version checking +780 line$="VERSION EIRC 1.00 (c) Justin Fletcher" +790 PRINTuid$;" wanted our version" +800 WHEN "ACTION" +810 PRINT"* ";uid$;" ";line$ +820 line$="" +830 OTHERWISE +840 REM everything else is an error +850 line$="ERRMSG "+com$+" not understood" +860 PRINT"CTCP '";com$;"' from ";uid$;" (";line$;")" +870 ENDCASE +880 IF line$<>"" THEN +890 SYS "ESocket_SendLine",handle,"NOTICE "+uid$+" :"+CHR$1+line$+CHR$1 +900 ENDIF +910 ELSE +920 REM Somebody said something... +930 PRINT"<";uid$;"> ";FNsafe(line$) +940 ENDIF +950 WHEN "JOIN" +960 REM We (or someone else) has joined the channel +970 chan$=LEFT$(line$,INSTR(line$+" "," ")):REM Skip : +980 IF LEFT$(chan$,1)=":" THENchan$=MID$(chan$,2) +990 PRINTuid$;" has joined ";chan$ +1000 WHEN "PART" +1010 REM Someone else has left the channel +1020 chan$=LEFT$(line$,INSTR(line$+" "," ")-1) +1030 IF LEFT$(chan$,1)=":" THENchan$=MID$(chan$,2) +1040 PRINTuid$;" has left ";chan$ +1050 WHEN "QUIT" +1060 REM Someone else has quit IRC +1070 PRINTuid$;" quit IRC" +1080 OTHERWISE +1090 REM Some unknown command +1100 PRINTuid$;":";com$;":";FNsafe(line$) +1110 ENDCASE +1120 REM Re-display our input line +1130 PRINTinput$; +1140 ENDIF +1150 ENDIF +1160 UNTIL str=0 +1170 ENDIF +1180 b$=INKEY$(0) +1190 IF b$<>"" THEN +1200 CASE b$ OF +1210 WHEN CHR$13 +1220 SYS "ESocket_SendLine",handle,"PRIVMSG "+ourchan$+" :"+input$ +1230 REM Remove the line +1240 IF input$<>"" THENFORI=1TOLEN(input$):VDU127:NEXT +1250 REM We said it... +1260 PRINT"<"+nick$+"> ";input$ +1270 input$="" +1280 WHEN CHR$127,CHR$8 +1290 REM Backspace +1300 IF input$<>"" THENVDU127 +1310 input$=LEFT$(input$) +1320 OTHERWISE +1330 REM Ad to current input +1340 input$+=b$ +1350 PRINTb$; +1360 ENDCASE +1370 ENDIF +1380 REM Has the socket closed +1390 SYS "ESocket_Closed",handle,%0 TO closed +1400UNTIL closed +1410SYS "ESocket_Forget",handle +1420SYS "ESocket_Forget",monitor +1430END +1440: +1450DEFFNupper(a$):LOCAL c$,b$,I +1460FORI=1TOLEN(a$) +1470c$=MID$(a$,I,1):IF c$>="a"ANDc$<="z"THENc$=CHR$(ASC(c$)-32) +1480b$+=c$:NEXT:=b$ +1490 +1500REM Remove control codes +1510DEFFNsafe(line$) +1520LOCAL I +1530FORI=1TOLEN(line$) +1540 IF MID$(line$,I,1)<" " THENMID$(line$,I,1)="*" +1550NEXT +1560=line$ diff --git a/tests/examplefiles/example.boa b/tests/examplefiles/example.boa new file mode 100644 index 00000000..a18f1626 --- /dev/null +++ b/tests/examplefiles/example.boa @@ -0,0 +1,18 @@ +# Computes Number of Public Methods (NPM) for each project, per-type
+# Output is: NPM[ProjectID][TypeName] = NPM value
+p: Project = input;
+NPM: output sum[string][string] of int;
+
+visit(p, visitor {
+ # only look at the latest snapshot
+ before n: CodeRepository -> {
+ snapshot := getsnapshot(n);
+ foreach (i: int; def(snapshot[i]))
+ visit(snapshot[i]);
+ stop;
+ }
+ before node: Declaration ->
+ if (node.kind == TypeKind.CLASS)
+ foreach (i: int; has_modifier_public(node.methods[i]))
+ NPM[p.id][node.name] << 1;
+});
diff --git a/tests/examplefiles/example.pony b/tests/examplefiles/example.pony new file mode 100644 index 00000000..654f2376 --- /dev/null +++ b/tests/examplefiles/example.pony @@ -0,0 +1,18 @@ +use "somepkg" + +/* + /* Nested */ +*/ + +class trn Foo[A: Stringable ref] is Stringable + let _x = "\"" + + fun val dofoo() => + """ + DocString + """ + (U64(2), "foo")._2 + +actor Main + new create(env: Env) => + env.out.print("Hello world") diff --git a/tests/examplefiles/example.toml b/tests/examplefiles/example.toml new file mode 100644 index 00000000..9c60c79f --- /dev/null +++ b/tests/examplefiles/example.toml @@ -0,0 +1,181 @@ +# This is a TOML document comment + +title = "TOML example file" # This is an inline comment + +[examples] +# Examples taken from https://github.com/toml-lang/toml/blob/master/README.md +key = "value" +bare_key = "value" +bare-key = "value" +1234 = "value" +"127.0.0.1" = "value" +"character encoding" = "value" +"ʎǝʞ" = "value" +'key2' = "value" +'quoted "value"' = "value" +name = "Orange" +physical.color = "orange" +physical.shape = "round" +site."google.com" = true +a.b.c = 1 +a.d = 2 + +[strings] +str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." +str1 = """ +Roses are red +Violets are blue""" +str2 = "Roses are red\nViolets are blue" +str3 = "Roses are red\r\nViolets are blue" + + [strings.equivalents] + str1 = "The quick brown fox jumps over the lazy dog." + str2 = """ +The quick brown \ + + + fox jumps over \ + the lazy dog.""" + str3 = """\ + The quick brown \ + fox jumps over \ + the lazy dog.\ + """ + + [strings.literal] + winpath = 'C:\Users\nodejs\templates' + winpath2 = '\\ServerX\admin$\system32\' + quoted = 'Tom "Dubs" Preston-Werner' + regex = '<\i\c*\s*>' + + [strings.multiline] + regex2 = '''I [dw]on't need \d{2} apples''' + lines = ''' +The first newline is +trimmed in raw strings. + All other whitespace + is preserved. +''' + +[integers] +int1 = +99 +int2 = 42 +int3 = 0 +int4 = -17 +int5 = 1_000 +int6 = 5_349_221 +int7 = 1_2_3_4_5 # discouraged format +# hexadecimal with prefix `0x` +hex1 = 0xDEADBEEF +hex2 = 0xdeadbeef +hex3 = 0xdead_beef +# octal with prefix `0o` +oct1 = 0o01234567 +oct2 = 0o755 # useful for Unix file permissions +# binary with prefix `0b` +bin1 = 0b11010110 + +[floats] +# fractional +flt1 = +1.0 +flt2 = 3.1415 +flt3 = -0.01 +# exponent +flt4 = 5e+22 +flt5 = 1e6 +flt6 = -2E-2 +# both +flt7 = 6.626e-34 +# with underscores, for readability +flt8 = 224_617.445_991_228 +# infinity +sf1 = inf # positive infinity +sf2 = +inf # positive infinity +sf3 = -inf # negative infinity +# not a number +sf4 = nan # actual sNaN/qNaN encoding is implementation specific +sf5 = +nan # same as `nan` +sf6 = -nan # valid, actual encoding is implementation specific +# plus/minus zero +sf0_1 = +0.0 +sf0_2 = -0.0 + +[booleans] +bool1 = true +bool2 = false + +[datetime.offset] +odt1 = 1979-05-27T07:32:00Z +odt2 = 1979-05-27T00:32:00-07:00 +odt3 = 1979-05-27T00:32:00.999999-07:00 +odt4 = 1979-05-27 07:32:00Z + +[datetime.local] +ldt1 = 1979-05-27T07:32:00 +ldt2 = 1979-05-27T00:32:00.999999 + +[date.local] +ld1 = 1979-05-27 + +[time.local] +lt1 = 07:32:00 +lt2 = 00:32:00.999999 + +[arrays] +arr1 = [ 1, 2, 3 ] +arr2 = [ "red", "yellow", "green" ] +arr3 = [ [ 1, 2 ], [3, 4, 5] ] +arr4 = [ "all", 'strings', """are the same""", '''type'''] +arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] +arr6 = [ 1, 2.0 ] # INVALID +arr7 = [ + 1, 2, 3 +] +arr8 = [ + 1, + 2, # this is ok +] + +["inline tables"] +name = { first = "Tom", last = "Preston-Werner" } +point = { x = 1, y = 2 } +animal = { type.name = "pug" } + +["arrays of tables"] +points = [ { x = 1, y = 2, z = 3 }, + { x = 7, y = 8, z = 9 }, + { x = 2, y = 4, z = 8 } ] + + [products] + + [[products]] + name = "Hammer" + sku = 738594937 + + [[products]] + + [[products]] + name = "Nail" + sku = 284758393 + color = "gray" + + [fruits] + + [[fruit]] + name = "apple" + + [fruit.physical] + color = "red" + shape = "round" + + [[fruit.variety]] + name = "red delicious" + + [[fruit.variety]] + name = "granny smith" + + [[fruit]] + name = "banana" + + [[fruit.variety]] + name = "plantain" diff --git a/tests/examplefiles/freefem.edp b/tests/examplefiles/freefem.edp new file mode 100644 index 00000000..d4313338 --- /dev/null +++ b/tests/examplefiles/freefem.edp @@ -0,0 +1,94 @@ +// Example of problem solving in parallel + +// Usage: +// ff-mpirun -np 12 LaplacianParallel.edp (here 12 is the number of threads (command nproc to know that) +// Need FreeFem++ with PETSc + +// Parallel stuff +load "PETSc" +macro partitioner()metis// +macro dimension()2// +include "./macro_ddm.idp" + +macro def(i)[i]// +macro init(i)[i]// +//macro meshN()mesh// //these macro are defined in macro_ddm.idp +//macro intN()int2d// + +// Parameters +int nn = 500; +real L = 1.; +real H = 1.; + +func f = 1.; + +func Pk = P1; + +// Mesh +border b1(t=0, L){x=t; y=0; label=1;} +border b2(t=0, H){x=L; y=t; label=2;} +border b3(t=L, 0){x=t; y=H; label=3;} +border b4(t=H, 0){x=0; y=t; label=4;} + +meshN Th = buildmesh(b1(1) + b2(1) + b3(1) + b4(1)); //build a really coarse mesh (just to build the fespace later) +//meshN Th = square(1, 1, [L*x, H*y]); + +int[int] Wall = [1, 2, 3, 4]; + +// Fespace +fespace Uh(Th, Pk); + +// Mesh partition +int[int] ArrayIntersection; +int[int][int] RestrictionIntersection(0); +real[int] D; + +meshN ThBorder; +meshN ThGlobal = buildmesh(b1(nn*L) + b2(nn*H) + b3(nn*L) + b4(nn*H)); //build the mesh to partition +//meshN ThGlobal = square(nn*L, nn*H, [L*x, H*y]); +int InterfaceLabel = 10; +int Split = 1; +int Overlap = 1; +build(Th, ThBorder, ThGlobal, InterfaceLabel, Split, Overlap, D, ArrayIntersection, RestrictionIntersection, Uh, Pk, mpiCommWorld, false); //see macro_ddm.idp for detailed parameters + +// Macro +macro grad(u) [dx(u), dy(u)] // + +// Problem +varf vLaplacian (u, uh) //Problem in varf formulation mandatory + = intN(Th)( + grad(u)' * grad(uh) + ) + - intN(Th)( + f * uh + ) + + on(Wall, u=0) + ; + +matrix<real> Laplacian = vLaplacian(Uh, Uh); //build the sequential matrix +real[int] LaplacianBoundary = vLaplacian(0, Uh);// and right hand side + +//// In sequential, you normally do that: +//// Solve +//Uh def(u)=init(0); +//u[] = Laplacian^-1 * LaplacianBoundary; + +//// Plot +//plot(u); + +// In parallel: +// Matrix construction +dmatrix PLaplacian(Laplacian, ArrayIntersection, RestrictionIntersection, D, bs=1); //build the parallel matrix +set(PLaplacian, sparams="-pc_type lu -pc_factor_mat_solver_package mumps"); //preconditioner LU and MUMPS solver (see PETSc doc for detailed parameters) + +// Solve +Uh def(u)=init(0); //define the unknown (must be defined after mesh partitioning) +u[] = PLaplacian^-1 * LaplacianBoundary; + +// Export results to vtk (there is not plot in parallel) +{ + fespace PV(Th, P1); + PV uu=u; + int[int] Order = [1]; + export("Result", Th, uu, Order, mpiCommWorld); +} diff --git a/tests/examplefiles/teraterm.ttl b/tests/examplefiles/teraterm.ttl new file mode 100644 index 00000000..f6a3648a --- /dev/null +++ b/tests/examplefiles/teraterm.ttl @@ -0,0 +1,34 @@ +messagebox "text \\not escaped \nescaped n" "other\n\rthing"
+messagebox "goto label /* a string */ ; same string"
+a=10
+b= 'abc'#$41'def'
+c =#65 /* multiline comment * / * / *//*
+comment */ d = 10 ; inline comment /* still inline */
+e = d + 20 - (($a * 2) / 4) << 3 % (2 >> 1) + result
+
+
+:thing
+
+strcompare c "thing"
+if result = 1 then
+ goto label_
+elseif result > -1 then
+ goto 10
+elseif d > (1+2*3)/7 then
+ messagebox "thing"
+else
+ messagebox "done"
+endif
+
+if abc messagebox "thing1" "title"
+
+
+; Invalid syntax
+bad = "no closing double quote
+bad = 'no closing single quote
+garbage
+...
+...
+...
+
+endgarbage
|
