diff options
Diffstat (limited to 'tests/examplefiles')
-rw-r--r-- | tests/examplefiles/99_bottles_of_beer.chpl | 27 | ||||
-rw-r--r-- | tests/examplefiles/Charmci.ci | 20 | ||||
-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.flo | 40 | ||||
-rw-r--r-- | tests/examplefiles/example.icn | 283 | ||||
-rw-r--r-- | tests/examplefiles/example.icon | 381 | ||||
-rw-r--r-- | tests/examplefiles/example.md | 3 | ||||
-rw-r--r-- | tests/examplefiles/example.pony | 18 | ||||
-rw-r--r-- | tests/examplefiles/example.sgf | 35 | ||||
-rw-r--r-- | tests/examplefiles/example.sl | 6 | ||||
-rw-r--r-- | tests/examplefiles/example.stan | 4 | ||||
-rw-r--r-- | tests/examplefiles/example.tf | 36 | ||||
-rw-r--r-- | tests/examplefiles/example.toml | 181 | ||||
-rw-r--r-- | tests/examplefiles/example.u | 1 | ||||
-rw-r--r-- | tests/examplefiles/example.u1 | 111 | ||||
-rw-r--r-- | tests/examplefiles/example.vbs | 55 | ||||
-rw-r--r-- | tests/examplefiles/teraterm.ttl | 34 |
19 files changed, 1411 insertions, 3 deletions
diff --git a/tests/examplefiles/99_bottles_of_beer.chpl b/tests/examplefiles/99_bottles_of_beer.chpl index cdc1e650..ff50b294 100644 --- a/tests/examplefiles/99_bottles_of_beer.chpl +++ b/tests/examplefiles/99_bottles_of_beer.chpl @@ -177,3 +177,30 @@ private module M3 { private var x: int; } +prototype module X { + + proc f() throws { + throw new Error(); + } + + proc g() { + try { + f(); + try! f(); + } catch e { + writeln("Caught ", e); + } + } + + proc int.add() { } + + g(); + + override proc test() throws { + var a = new borrowed IntPair(); + var b = new owned IntPair(); + var c = new shared IntPair(); + throw new unmanaged Error(); + } +} + diff --git a/tests/examplefiles/Charmci.ci b/tests/examplefiles/Charmci.ci new file mode 100644 index 00000000..2e5cd5c6 --- /dev/null +++ b/tests/examplefiles/Charmci.ci @@ -0,0 +1,20 @@ +module CkCallback { + readonly CProxy_ckcallback_group _ckcallbackgroup; + message CkCcsRequestMsg { + char data[]; + }; + message CkDataMsg { + char data[]; + }; + + mainchare ckcallback_main { + entry ckcallback_main(CkArgMsg *m); + }; + group [migratable] ckcallback_group : IrrGroup { + entry ckcallback_group(); + entry void registerCcsCallback(char name[strlen(name)+1], + CkCallback cb); + entry void call(CkCallback c,CkMarshalledMessage msg); + entry void call(CkCallback c, int length, char data[length]); + }; +}; 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.flo b/tests/examplefiles/example.flo new file mode 100644 index 00000000..2d4ab5e7 --- /dev/null +++ b/tests/examplefiles/example.flo @@ -0,0 +1,40 @@ +#example mission box1.flo +#from: https://github.com/ioflo/ioflo + +house box1 + + framer vehiclesim be active first vehicle_run + frame vehicle_run + do simulator motion uuv + + framer mission be active first northleg + frame northleg + set elapsed with 20.0 + set heading with 0.0 + set depth with 5.0 + set speed with 2.5 + go next if elapsed >= goal + + frame eastleg + set heading with 90.0 + go next if elapsed >= goal + + frame southleg + set heading with 180.0 + go next if elapsed >= goal + + frame westleg + set heading with 270.0 + go next if elapsed >= goal + + frame mission_stop + bid stop vehiclesim + bid stop autopilot + bid stop me + + framer autopilot be active first autopilot_run + frame autopilot_run + do controller pid speed + do controller pid heading + do controller pid depth + do controller pid pitch
\ No newline at end of file diff --git a/tests/examplefiles/example.icn b/tests/examplefiles/example.icn new file mode 100644 index 00000000..c8fcf335 --- /dev/null +++ b/tests/examplefiles/example.icn @@ -0,0 +1,283 @@ +# +# $Id: button.icn,v 1.7 2006-07-09 23:43:07 rparlett Exp $ +# +# This file is in the public domain. +# +# Author: Robert Parlett (parlett@dial.pipex.com) +# + +package gui +link graphics + +$include "guih.icn" + + +# +# This is the parent class of the button classes, including +# checkboxes. +# +# A {Button} produces a BUTTON_PRESS_EVENT when the button is +# depressed, and code BUTTON_RELEASE_EVENT when it is released, +# as well as an ACTION_EVENT. +# +# By default, when a button holds the keyboard focus a dashed +# line appears just within the button. Then, when return is +# pressed an ACTION_EVENT is generated. The method +# {Dialog.set_initial_focus()} can be used to have the button +# have the focus when the dialog is first displayed. +# +# Buttons also repeatedly produce a BUTTON_HELD_EVENT whilst they +# are held down, rather like a repeating keyboard press. The +# delay between the initial repeat event and subsequent repeat +# events is set in the parent dialog (see above). +# +class Button : Toggle : Component( + is_down, # + is_held, # + is_checked_flag, # + label, + img_up, # + img_down, # + img_w, # + img_h, # + parent_check_box_group, # + parent_button_group, # + repeat_delay, + no_keyboard_flag, # + toggles_flag + ) + + method set_parent_button_group(x) + return self.parent_button_group := x + end + + # + # Invoking this method disables the keyboard control over the + # button described above. No dashed line will ever appear in + # the button display and return will have no effect on the + # button even if it has the focus. + # + method set_no_keyboard() + self.no_keyboard_flag := 1 + self.accepts_focus_flag := &null + end + + # + # Clear the no keyboard behaviour (the default) + # + method clear_no_keyboard() + self.no_keyboard_flag := &null + self.accepts_focus_flag := 1 + end + + method tick() + if dispatcher.curr_time_of_day() > self.repeat_delay then + fire(BUTTON_HELD_EVENT) + end + + method go_down() + self.is_down := 1 + set_ticker(self.parent_dialog.repeat_rate) + end + + method go_up() + self.is_down := &null + stop_ticker() + end + + method handle_press(e) + local b + if self.in_region() then { + go_down() + self.repeat_delay := dispatcher.curr_time_of_day() + self.parent_dialog.repeat_delay + self.is_held := 1 + every b := !(\self.parent_button_group).buttons do { + if b.is_unhidden() then { + b.is_held := 1 + b.repeat_delay := self.repeat_delay + } + } + self.invalidate() + fire(BUTTON_PRESS_EVENT, e) + } + end + + method handle_drag(e) + if \self.is_held then { + # + # Button held down; toggle on/off as it goes over the button + # + if self.in_region() then { + if /self.is_down then { + go_down() + invalidate() + } + } else { + if \self.is_down then { + go_up() + invalidate() + } + } + } + end + + method handle_release(e) + if \self.is_held then { + self.is_held := &null + if \self.is_down then { + go_up() + fire(BUTTON_RELEASE_EVENT, e) + on_action(e) + } + } + end + + method on_action(e) + if \self.toggles_flag then { + if \self.parent_check_box_group then + self.parent_check_box_group.set_which_one(self) + else + self.toggle_is_checked() + } + self.invalidate() + fire(ACTION_EVENT, e) + end + + method handle_accel(e) + self.Component.handle_accel(e) + on_action(e) + end + + method handle_default(e) + if \self.has_focus then { + if /self.no_keyboard_flag & e == ("\r" | "\l" | " ") then { + on_action(e) + } + } + end + + method handle_event(e) + if e === (&lpress | &rpress | &mpress) then { + handle_press(e) + } else if e === (&ldrag | &rdrag | &mdrag) then { + handle_drag(e) + } else if e === (&lrelease | &rrelease | &mrelease) then { + handle_release(e) + } else + handle_default(e) + end + + # + # Set the up/down images (if any) to the strings provided, + # which should be in Icon image format. + # The two images must have the same dimensions. + # @param x The up image + # @param y The down image + # + method set_imgs(x, y) + self.img_up := x + self.img_w := img_width(x) = img_width(y) | fatal("Image widths differ") + self.img_h := img_height(x) = img_height(y) | fatal("Image heights differ") + + self.img_down := y + + return + end + + # + # Set the image (if any) to the given string, which should be in Icon image + # format. + # @param x The image + # + method set_img(x) + self.img_up := self.img_down := x + self.img_w := img_width(x) + self.img_h := img_height(x) + return x + end + + # + # Toggle the checked status of the button. This method, and + # the following two methods, may be + # inappropriate for non-toggle styles of button. + # + method toggle_is_checked() + self.Toggle.toggle_is_checked() + self.invalidate() + end + + # + # Set the status to checked. + # + method set_is_checked() + self.Toggle.set_is_checked() + self.invalidate() + end + + # + # Set the status to unchecked. + # + method clear_is_checked() + self.Toggle.clear_is_checked() + self.invalidate() + end + + # + # Set the button so that when it is pressed, it toggles + # between two states, as indicated by the is_checked + # flag. + # + # Instances of Checkbox have this flag on by default, but + # TextButton and IconButton do not. When the flag is on, + # the latter classes indicate their checked status by + # showing the button as being "down". + # + method set_toggles() + self.toggles_flag := 1 + self.invalidate() + end + + # + # Clear the toggles flag. + # + method clear_toggles() + self.toggles_flag := &null + self.invalidate() + end + + # + # Set the label of the button, if any. + # @param x The label + # + method set_label(x) + self.label := x + self.invalidate() + return x + end + + method set_one(attr, val) + case attr of { + "label" : set_label(string_val(attr, val)) + "is_checked" : + if test_flag(attr, val) then + set_is_checked() + else + clear_is_checked() + "toggles" : + if test_flag(attr, val) then + set_toggles() + else + clear_toggles() + "no_keyboard" : + if test_flag(attr, val) then + set_no_keyboard() + else + clear_no_keyboard() + default: self.Component.set_one(attr, val) + } + end + + initially() + self.Component.initially() + self.accepts_focus_flag := 1 +end
\ No newline at end of file diff --git a/tests/examplefiles/example.icon b/tests/examplefiles/example.icon new file mode 100644 index 00000000..29bc548b --- /dev/null +++ b/tests/examplefiles/example.icon @@ -0,0 +1,381 @@ +############################################################################ +# +# File: kaleid.icn +# +# Subject: Program to produce kaleidoscope +# +# Author: Stephen B. Wampler +# +# Date: May 2, 2001 +# +############################################################################ +# +# This file is in the public domain. +# +############################################################################ +# +# Lots of options, most easily set by with the interface after +# startup. The only one that isn't set that way is -wn where 'n' is +# the size of the kaleidoscope window (default is 600 square). +# +# Terminology (and options): +# +# Window_size (-wN): How big of a display window to use. +# At the current time, this can only be set via a +# command line argument. +# +# Density (-dN): How many circles per octant to keep on display +# at any one time. There is NO LIMIT to the density. +# +# Duration (-lN): How long to keep drawing circles (measured in +# in circles) once the density is reached. There is NO LIMIT +# to the duration. +# +# MaxRadius (-MN): Maximum radius of any circle. +# +# MinRadius (-mN): Preferred minimum radius. Circles with centers +# near the edge have their radii forced down to fit entirely +# on the display +# +# MaxOffset (-XN): Maximum offset from center of display (may wrap). +# +# MinOffset (-xN): Minimum offset +# +# Skew (-sN): Shift probability of placing a circle at a 'typical' +# offset. +# +# Fill (-F): Turns off filling the circles. +# +# Clear (-C): After the duration, reduces density back to 0 before +# quitting. +# +# Random Seed: (-rN): Sets the random number seed. +# +# Thanks to Jon Lipp for help on using vidgets, and to Mary Camaron +# for her Interface Builder. +# +############################################################################ +# +# Requires: Version 9 graphics +# +############################################################################ +# +# Links: vidgets, vslider, vtext, vbuttons, vradio, wopen, xcompat +# +############################################################################ + +link vidgets +link vslider +link vtext +link vbuttons +link vradio +link wopen +link xcompat + +global Clear, fill, duration, density, maxoff, minoff +global maxradius, minradius, r_seed, skew, win_size, mid_win +global root, check1, mainwin, use_dialog +global draw_circle + +global du_v, de_v, rs_v, sk_v + +procedure main (args) + + draw_circle := DrawCircle + + init_globs() + process_args(args) + + if \use_dialog then { # have vidgets, so use them for args. + mainwin := WOpen("label=Kaleidoscope", "width=404", "height=313", + "font=6x12") | + stop ("bad mainwin") + root := ui (mainwin) + GetEvents (root, quit) + } + else { # just rely on command line arguments + kaleidoscope(r_seed) + } + +end + +procedure init_globs() + + duration := 500 # set default characteristics + density := 30 + win_size := 600 + minoff := 1 + maxradius := 150 + minradius := 1 + skew := 1 + fill := "On" + draw_circle := FillCircle + Clear := "Off" + r_seed := map("HhMmYy", "Hh:Mm:Yy", &clock) + # See if the Vidget library is available or not + if \VSet then use_dialog := "yes" + else use_dialog := &null + +end + +procedure process_args(args) + local arg + + # really only needed if you don't use the dialog box + every arg := !args do case arg[1+:2] of { + "-w" : win_size := integer(arg[3:0]) # window size + "-d" : density := integer(arg[3:0]) # density of circles + "-l" : duration := integer(arg[3:0]) # duration + "-M" : maxradius := integer(arg[3:0]) # maximum radius + "-m" : minradius := integer(arg[3:0]) # minimum radius + "-X" : maxoff := integer(arg[3:0]) # maximum offset + "-x" : minoff := integer(arg[3:0]) # minimum offset + "-s" : skew := numeric(arg[3:0]) # set skewedness + "-F" : fill := &null # turn off fill + "-C" : Clear := "yes" # turn on clear mode + "-r" : r_seed := integer(arg[3:0]) # random seed + "-h" : stop("usage: kal [-wn] [-dn] [-ln] [-Mn] [-mn] [-Xn] [-xn] _ + [-sn] [-F] [-C] [-rn]") + } + # adjust parameters that depend on the window size... + mid_win := win_size/2 + maxoff := win_size-1 +end + +# Lorraine Callahan's kaleidoscope program, translated into icon. +# (some of the things she did were too sophisticated for me +# to spend time to figure out, so the output is square instead of +# round), and I use 'xor' to draw instead of writing to separate +# bit planes. + +global putcircle, clrcircle + +procedure kaleidoscope(r) + local colors + + # What colors to use? This can be changed to whatever! + colors := ["red","green","blue","cyan","magenta","yellow"] + + &window := WOpen("label=Kaleidoscope: 'q' quits", "width="||win_size, + "height="||win_size, "bg=black") + WAttrib("drawop=xor") + + # Create two *indentical* sequences of circles, one to use when + # when drawing, one for erasing. (Since 'xor' is used to + # place them, these both just draw the circles!) + + putcircle := create { # draws sequence of circles + &random :=: r + |{ + Fg(?colors) + outcircle() + &random <-> r + } + } + + clrcircle := create { # erases sequence of circles + &random :=: r + |{ + Fg(?colors) + outcircle() + &random <-> r + } + } + + every 1 to density do @putcircle # fill screen to density + + every 1 to duration do { # maintain steady state + @putcircle + @clrcircle + if *Pending(&window) > 0 then break + } + + every (Clear == "On") & 1 to density do @clrcircle + + close(&window) +end + + +procedure outcircle() # select a circle at random, +local radius, xoff, yoff # draw it in kaleidoscopic form + + # get a random center point and radius + xoff := (?(maxoff - minoff) + minoff) % mid_win + yoff := (?(maxoff - minoff) + minoff) % mid_win + radius := ?0 ^ skew + # force radius to 'fit' + radius := ((maxradius-minradius) * radius + minradius) % + (mid_win - ((xoff < yoff)|xoff)) + + # put into all 8 octants + draw_circle(mid_win+xoff, mid_win+yoff, radius) + draw_circle(mid_win+xoff, mid_win-yoff, radius) + draw_circle(mid_win-xoff, mid_win+yoff, radius) + draw_circle(mid_win-xoff, mid_win-yoff, radius) + + draw_circle(mid_win+yoff, mid_win+xoff, radius) + draw_circle(mid_win+yoff, mid_win-xoff, radius) + draw_circle(mid_win-yoff, mid_win+xoff, radius) + draw_circle(mid_win-yoff, mid_win-xoff, radius) + + return +end + + +############################################################################ +# +# Vidget-based user interface -- developed originally using Mary +# Camaron's XIB program. Don't expect this to be very readable - +# you should have to play with it! +# +############################################################################ +procedure ui (win) + local cv1, cv2, cv3, cv4 + local + radio_button2, + radio_button1, + text_input6, + text_input5, + slider4, + slider3, + text_input4, + text_input3, + slider2, + slider1 + + /win := WOpen("label=ui", "width=404", "height=313", "font=6x12") | + stop ("bad win") + root := Vroot_frame (win) + + VInsert (root, Vmessage(win, win_size/2), 168, 98) + VInsert (root, Vmessage(win, "1"), 108, 97) + + VInsert (root, sk_v := Vtext(win,"Skew:\\=1",get_skew,,6), 280, 39) + + VInsert (root, du_v := Vtext(win, "Duration:\\="||duration, get_duration,,9), + 237, 15) + + VInsert (root, Vmessage(win, "Clear at end?"), 232, 145) + VInsert (root, Vmessage(win, "Fill?"), 105, 142) + VInsert (root, Vmessage(win,"Quit?"), 267, 259) + VInsert (root, Vmessage(win,"Display it?"), 26, 260) + + VInsert (root, Vcheckbox(win, do_quit, "check2",20), 305, 255, 20, 20) + + VInsert (root, check1:=Vcheckbox(win, do_display, "check1",20), + 106, 258, 20, 20) + + radio_button2 := Vradio_buttons (win, ["On", "Off"], get_clear, , V_CIRCLE) + VSet(radio_button2,Clear) + VInsert (root, radio_button2, 253, 165) + + radio_button1 := Vradio_buttons (win, ["On", "Off"], get_fill, , V_CIRCLE) + VSet(radio_button1,fill) + VInsert (root, radio_button1, 99, 165) + + cv1 := Vcoupler() + VAddClient(cv1, get_max_offset) + text_input6 := Vtext (win, "Max Offset:\\="||(win_size-1), cv1, , 3) + VAddClient(cv1, text_input6) + slider4 := Vhoriz_slider (win, cv1, "slider4", 70, 12, 0, + win_size-1, win_size-1, ) + VAddClient(cv1, slider4) + VInsert (root, text_input6, 196, 103) + VInsert (root, slider4, 306, 106) + + cv2 := Vcoupler() + VAddClient(cv2, get_min_offset) + text_input5 := Vtext (win, "Min Offset\\=1", cv2, , 3) + VAddClient(cv2, text_input5) + slider3 := Vhoriz_slider (win, cv2, "slider3", 70, 12, 1, win_size-1, 1, ) + VAddClient(cv2, slider3) + VInsert (root, text_input5, 201, 80) + VInsert (root, slider3, 307, 82) + + cv3 := Vcoupler() + VAddClient(cv3, get_max_radius) + text_input4 := Vtext (win, "Max Radius\\="||(win_size/4), cv3, , 3) + VAddClient(cv3, text_input4) + slider2 := Vhoriz_slider (win, cv3, "slider2", 70, 12, 1, win_size/2, + win_size/4, ) + VAddClient(cv3, slider2) + VInsert (root, text_input4, 10, 104) + VInsert (root, slider2, 110, 108) + + cv4 := Vcoupler() + VAddClient(cv4, get_min_radius) + text_input3 := Vtext (win, "Min Radius\\=1", cv4, , 3) + VAddClient(cv4, text_input3) + slider1 := Vhoriz_slider (win, cv4, "slider1", 70, 12, 1, win_size/2, 1, ) + VAddClient(cv4, slider1) + VInsert (root, text_input3, 10, 81) + VInsert (root, slider1, 110, 84) + + VInsert (root, rs_v := Vtext(win,"Random Seed:\\="||r_seed, get_random,, 11), + 30, 41) + VInsert (root, de_v := Vtext(win,"Density:\\="||density, get_density,,8), + 71, 16) + + VResize (root) + return root +end + +procedure get_skew (wit, value) + skew := value +end + +procedure get_duration (wit, value) + duration := value +end + +procedure do_quit (wit, value) + stop() +end + +procedure do_display (wit, value) + r_seed := numeric(rs_v.data) + duration := integer(du_v.data) + density := integer(de_v.data) + skew := integer(sk_v.data) + kaleidoscope(r_seed) + wit.callback.value := &null + VDraw(check1) +end + +procedure get_clear (wit, value) + Clear := value +end + +procedure get_fill (wit, value) + fill := value + if fill == "Off" then draw_circle := DrawCircle + else draw_circle := FillCircle +end + +procedure get_max_offset (wit, value) + maxoff := value +end + +procedure get_min_offset (wit, value) + minoff := value +end + +procedure get_max_radius (wit, value) + maxradius := value +end + +procedure get_min_radius (wit, value) + minradius := value +end + +procedure get_random (wit, value) + r_seed := integer(value) +end + +procedure get_density (wit, value) + density := integer(value) +end + +procedure quit(e) + if e === "q" then stop ("Exiting Kaleidoscope") +end diff --git a/tests/examplefiles/example.md b/tests/examplefiles/example.md index 2befb107..e2bbacf1 100644 --- a/tests/examplefiles/example.md +++ b/tests/examplefiles/example.md @@ -46,6 +46,9 @@ this sentence @tweets a person about a #topic. [google](https://google.com/some/path.html) ![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png) +[reference link][id] +[id]: http://example.com/ + ``` * this is just unformated __text__ 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.sgf b/tests/examplefiles/example.sgf new file mode 100644 index 00000000..024a461e --- /dev/null +++ b/tests/examplefiles/example.sgf @@ -0,0 +1,35 @@ +(;FF[4]GM[1]SZ[19]FG[257:Figure 1]PM[1] +PB[Takemiya Masaki]BR[9 dan]PW[Cho Chikun] +WR[9 dan]RE[W+Resign]KM[5.5]TM[28800]DT[1996-10-18,19] +EV[21st Meijin]RO[2 (final)]SO[Go World #78]US[Arno Hollosi] +;B[pd];W[dp];B[pp];W[dd];B[pj];W[nc];B[oe];W[qc];B[pc];W[qd] +(;B[qf];W[rf];B[rg];W[re];B[qg];W[pb];B[ob];W[qb] +(;B[mp];W[fq];B[ci];W[cg];B[dl];W[cn];B[qo];W[ec];B[jp];W[jd] +;B[ei];W[eg];B[kk]LB[qq:a][dj:b][ck:c][qp:d]N[Figure 1] + +;W[me]FG[257:Figure 2];B[kf];W[ke];B[lf];W[jf];B[jg] +(;W[mf];B[if];W[je];B[ig];W[mg];B[mj];W[mq];B[lq];W[nq] +(;B[lr];W[qq];B[pq];W[pr];B[rq];W[rr];B[rp];W[oq];B[mr];W[oo];B[mn] +(;W[nr];B[qp]LB[kd:a][kh:b]N[Figure 2] + +;W[pk]FG[257:Figure 3];B[pm];W[oj];B[ok];W[qr];B[os];W[ol];B[nk];W[qj] +;B[pi];W[pl];B[qm];W[ns];B[sr];W[om];B[op];W[qi];B[oi] +(;W[rl];B[qh];W[rm];B[rn];W[ri];B[ql];W[qk];B[sm];W[sk];B[sh];W[og] +;B[oh];W[np];B[no];W[mm];B[nn];W[lp];B[kp];W[lo];B[ln];W[ko];B[mo] +;W[jo];B[km]N[Figure 3]) + +(;W[ql]VW[ja:ss]FG[257:Dia. 6]MN[1];B[rm];W[ph];B[oh];W[pg];B[og];W[pf] +;B[qh];W[qe];B[sh];W[of];B[sj]TR[oe][pd][pc][ob]LB[pe:a][sg:b][si:c] +N[Diagram 6])) + +(;W[no]VW[jj:ss]FG[257:Dia. 5]MN[1];B[pn]N[Diagram 5])) + +(;B[pr]FG[257:Dia. 4]MN[1];W[kq];B[lp];W[lr];B[jq];W[jr];B[kp];W[kr];B[ir] +;W[hr]LB[is:a][js:b][or:c]N[Diagram 4])) + +(;W[if]FG[257:Dia. 3]MN[1];B[mf];W[ig];B[jh]LB[ki:a]N[Diagram 3])) + +(;W[oc]VW[aa:sk]FG[257:Dia. 2]MN[1];B[md];W[mc];B[ld]N[Diagram 2])) + +(;B[qe]VW[aa:sj]FG[257:Dia. 1]MN[1];W[re];B[qf];W[rf];B[qg];W[pb];B[ob] +;W[qb]LB[rg:a]N[Diagram 1])) diff --git a/tests/examplefiles/example.sl b/tests/examplefiles/example.sl new file mode 100644 index 00000000..5fb430de --- /dev/null +++ b/tests/examplefiles/example.sl @@ -0,0 +1,6 @@ +#!/bin/bash +#SBATCH --partition=part +#SBATCH --job-name=job +#SBATCH --mem=1G +#SBATCH --cpus-per-task=8 +srun /usr/bin/sleep
\ No newline at end of file diff --git a/tests/examplefiles/example.stan b/tests/examplefiles/example.stan index 69c9ac70..03b7b1b5 100644 --- a/tests/examplefiles/example.stan +++ b/tests/examplefiles/example.stan @@ -16,7 +16,7 @@ functions { data { // valid name int abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_abc; - // all types should be highlighed + // all types should be highlighted int a3; real foo[2]; vector[3] bar; @@ -48,7 +48,7 @@ transformed data { thud <- -12309865; // ./ and .* should be recognized as operators grault2 <- grault .* garply ./ garply; - // ' and \ should be regognized as operators + // ' and \ should be recognized as operators qux2 <- qux' \ bar; } diff --git a/tests/examplefiles/example.tf b/tests/examplefiles/example.tf index 5a85dbee..4cbef52c 100644 --- a/tests/examplefiles/example.tf +++ b/tests/examplefiles/example.tf @@ -23,6 +23,14 @@ variable "aws_amis" { } +resource "aws_internet_gateway" "base_igw" { + vpc_id = "${aws_vpc.something.id}" + tags { + Name = "igw-${var.something}-${var.something}" + } +} + + @@ -170,3 +178,31 @@ resource "aws_instance" "web" { } } + + +resource "aws_autoscaling_group" "bar" { + name = "terraform-asg-example" + launch_configuration = "${aws_launch_configuration.as_conf.name}" + min_size = 1 + max_size = 2 + + lifecycle { + create_before_destroy = true + } +} + + +resource "aws_db_instance" "timeout_example" { + allocated_storage = 10 + engine = "mysql" + engine_version = "5.6.17" + instance_class = "db.t1.micro" + name = "mydb" + + timeouts { + create = "60m" + delete = "2h" + } +} + + 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/example.u b/tests/examplefiles/example.u index 42c85902..8c6686eb 100644 --- a/tests/examplefiles/example.u +++ b/tests/examplefiles/example.u @@ -545,4 +545,3 @@ var y = 0; - diff --git a/tests/examplefiles/example.u1 b/tests/examplefiles/example.u1 new file mode 100644 index 00000000..92c45365 --- /dev/null +++ b/tests/examplefiles/example.u1 @@ -0,0 +1,111 @@ +version U12.1.00 +uid version.u1-1494453463-0 +impl local +global 1 + 0,000005,version,0 + + +proc version + local 0,000000,tab + local 1,000000,find + local 2,000000,many + con 0,010000,8,126,145,162,163,151,157,156,040 + con 1,002000,1,8 + con 2,020000,11,060,061,062,063,064,065,066,067,070,071,056 + con 3,002000,1,1 + declend + filen version.icn + line 23 + colm 11 + synt any + mark L1 + line 25 + colm 4 + synt any + keywd version + line 25 + colm 13 + synt any + bscan + mark L2 + mark L3 + var 0 + pnull + var 1 + str 0 + line 26 + colm 15 + synt any + invoke 1 + int 1 + line 26 + colm 28 + synt any + plus + line 26 + colm 10 + synt any + invoke 1 + line 26 + colm 33 + synt any + esusp + goto L4 +lab L3 + line 26 + colm 35 + synt any + pfail +lab L4 + unmark +lab L2 + var 0 + var 2 + cset 2 + line 27 + colm 15 + synt any + invoke 1 + line 27 + colm 10 + synt any + invoke 1 + line 27 + colm 32 + synt any + bscan + mark L5 + var 0 + pnull + int 3 + line 27 + colm 45 + synt any + neg + line 27 + colm 44 + synt any + invoke 1 + line 27 + colm 34 + synt any + pret +lab L5 + synt any + pfail + line 27 + colm 32 + synt any + escan + line 25 + colm 13 + synt any + escan + unmark +lab L1 + pnull + line 30 + colm 1 + synt any + pfail + end
\ No newline at end of file diff --git a/tests/examplefiles/example.vbs b/tests/examplefiles/example.vbs new file mode 100644 index 00000000..d962b73d --- /dev/null +++ b/tests/examplefiles/example.vbs @@ -0,0 +1,55 @@ +rem VBScript examples + +' Various constants of different types +const someText = "some " & """text""" +const someInt = 123 +const someHex = &h3110c0d3 +const someFloat = 123.45e-67 +const someDate = #1/2/2016# +const someTime = #12:34:56 AM# +const someBool = vbTrue ' -1 + +' Do some math. +radius = 1.e2 +area = radius ^ 2 * 3.1315 +a = 17 : b = 23 +c = sqr(a ^2 + b ^ 2) + +' Write 10 files. +For i = 1 to 10 + createFile( i ) +Next + +Public Sub createFile(a) + Dim fso, TargetFile + TargetPath = "C:\some_" & a & ".tmp" + Set fso = CreateObject("Scripting.FileSystemObject") + Set TargetFile = fso.CreateTextFile(TargetPath) + TargetFile.WriteLine("Hello " & vbCrLf & "world!") + TargetFile.Close +End Sub + +' Define a class with a property. +Class Customer + Private m_CustomerName + + Private Sub Class_Initialize + m_CustomerName = "" + End Sub + + ' CustomerName property. + Public Property Get CustomerName + CustomerName = m_CustomerName + End Property + + Public Property Let CustomerName(custname) + m_CustomerName = custname + End Property +End Class + +' Special constructs +Option Explicit +On Error Resume Next +On Error Goto 0 + +' Comment without terminating CR/LF.
\ No newline at end of file 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
|