summaryrefslogtreecommitdiff
path: root/tests/examplefiles/example.reds
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-10-08 08:50:24 +0200
committerGeorg Brandl <georg@python.org>2014-10-08 08:50:24 +0200
commitab509e4ea2a8bd3c7e8e355b0e83b3e2de9f7a01 (patch)
treedb1c94d9d2ba3fc0c664b71ba798007eb0da5a65 /tests/examplefiles/example.reds
parent7f5c98a36c3a8e1b9877e1d4cfe41fd00f08833a (diff)
parente07ba8bf31d7a9ee2cfd4832608a9453a9f81fbe (diff)
downloadpygments-ab509e4ea2a8bd3c7e8e355b0e83b3e2de9f7a01.tar.gz
Merged in __russ__/pygments-main (pull request #165)
Diffstat (limited to 'tests/examplefiles/example.reds')
-rw-r--r--tests/examplefiles/example.reds150
1 files changed, 150 insertions, 0 deletions
diff --git a/tests/examplefiles/example.reds b/tests/examplefiles/example.reds
new file mode 100644
index 00000000..eb92310d
--- /dev/null
+++ b/tests/examplefiles/example.reds
@@ -0,0 +1,150 @@
+Red/System [
+ Title: "Red/System example file"
+ Purpose: "Just some code for testing Pygments colorizer"
+ Language: http://www.red-lang.org/
+]
+
+#include %../common/FPU-configuration.reds
+
+; C types
+
+#define time! long!
+#define clock! long!
+
+date!: alias struct! [
+ second [integer!] ; 0-61 (60?)
+ minute [integer!] ; 0-59
+ hour [integer!] ; 0-23
+
+ day [integer!] ; 1-31
+ month [integer!] ; 0-11
+ year [integer!] ; Since 1900
+
+ weekday [integer!] ; 0-6 since Sunday
+ yearday [integer!] ; 0-365
+ daylight-saving-time? [integer!] ; Negative: unknown
+]
+
+#either OS = 'Windows [
+ #define clocks-per-second 1000
+][
+ ; CLOCKS_PER_SEC value for Syllable, Linux (XSI-conformant systems)
+ ; TODO: check for other systems
+ #define clocks-per-second 1000'000
+]
+
+#import [LIBC-file cdecl [
+
+ ; Error handling
+
+ form-error: "strerror" [ ; Return error description.
+ code [integer!]
+ return: [c-string!]
+ ]
+ print-error: "perror" [ ; Print error to standard error output.
+ string [c-string!]
+ ]
+
+
+ ; Memory management
+
+ make: "calloc" [ ; Allocate zero-filled memory.
+ chunks [size!]
+ size [size!]
+ return: [binary!]
+ ]
+ resize: "realloc" [ ; Resize memory allocation.
+ memory [binary!]
+ size [size!]
+ return: [binary!]
+ ]
+ ]
+
+ JVM!: alias struct! [
+ reserved0 [int-ptr!]
+ reserved1 [int-ptr!]
+ reserved2 [int-ptr!]
+
+ DestroyJavaVM [function! [[JNICALL] vm [JVM-ptr!] return: [jint!]]]
+ AttachCurrentThread [function! [[JNICALL] vm [JVM-ptr!] penv [struct! [p [int-ptr!]]] args [byte-ptr!] return: [jint!]]]
+ DetachCurrentThread [function! [[JNICALL] vm [JVM-ptr!] return: [jint!]]]
+ GetEnv [function! [[JNICALL] vm [JVM-ptr!] penv [struct! [p [int-ptr!]]] version [integer!] return: [jint!]]]
+ AttachCurrentThreadAsDaemon [function! [[JNICALL] vm [JVM-ptr!] penv [struct! [p [int-ptr!]]] args [byte-ptr!] return: [jint!]]]
+]
+
+ ;just some datatypes for testing:
+
+ #some-hash
+ 10-1-2013
+ quit
+
+ ;binary:
+ #{00FF0000}
+ #{00FF0000 FF000000}
+ #{00FF0000 FF000000} ;with tab instead of space
+ 2#{00001111}
+ 64#{/wAAAA==}
+ 64#{/wAAA A==} ;with space inside
+ 64#{/wAAA A==} ;with tab inside
+
+
+ ;string with char
+ {bla ^(ff) foo}
+ {bla ^(( foo}
+ ;some numbers:
+ 12
+ 1'000
+ 1.2
+ FF00FF00h
+
+ ;some tests of hexa number notation with not common ending
+ [ff00h ff00h] ff00h{} FFh"foo" 00h(1 + 2) (AEh)
+
+;normal words:
+foo char
+
+;get-word
+:foo
+
+;lit-word:
+'foo 'foo
+
+;multiple comment tests...
+1 + 1
+comment "aa"
+2 + 2
+comment {aa}
+3 + 3
+comment {a^{}
+4 + 4
+comment {{}}
+5 + 5
+comment {
+ foo: 6
+}
+6 + 6
+comment [foo: 6]
+7 + 7
+comment [foo: "[" ]
+8 + 8
+comment [foo: {^{} ]
+9 + 9
+comment [foo: {boo} ]
+10 + 10
+comment 5-May-2014/11:17:34+2:00
+11 + 11
+
+
+to-integer foo
+foo/(a + 1)/b
+
+call/output reform ['which interpreter] path: copy ""
+
+ version-1.1: 00010001h
+
+ #if type = 'exe [
+ push system/stack/frame ;-- save previous frame pointer
+ system/stack/frame: system/stack/top ;-- @@ reposition frame pointer just after the catch flag
+]
+push CATCH_ALL ;-- exceptions root barrier
+push 0 ;-- keep stack aligned on 64-bit \ No newline at end of file