diff options
author | Doug Kearns <dougkearns@gmail.com> | 2024-01-05 17:59:04 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-01-05 17:59:04 +0100 |
commit | 68a89470693c7687d4e736ca056c05de632e3ac7 (patch) | |
tree | 6b075cfda5ae9a9f125eaa9012bf0f90f1fc7112 /runtime/syntax/testdir/input | |
parent | 3779516988f14f2070d827514c79383334a0946b (diff) |
patch 9.1.0013: Modula2 filetype support lackingv9.1.0013
Problem: Modula2 filetype support lacking
Solution: Improve the Modula-2 runtime support, add additional modula2
dialects, add compiler plugin, update syntax highlighting,
include syntax tests, update Makefiles (Doug Kearns)
closes: #6796
closes: #8115
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Benjamin Kowarsch <trijezdci@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/syntax/testdir/input')
-rw-r--r-- | runtime/syntax/testdir/input/modula2_iso.def | 114 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/modula2_pim.def | 111 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/modula2_r10.def | 146 |
3 files changed, 371 insertions, 0 deletions
diff --git a/runtime/syntax/testdir/input/modula2_iso.def b/runtime/syntax/testdir/input/modula2_iso.def new file mode 100644 index 0000000000..b979ccf70c --- /dev/null +++ b/runtime/syntax/testdir/input/modula2_iso.def @@ -0,0 +1,114 @@ +(* Modula-2 ISO Test File for Vim Syntax Colouring *) + +(* -------------------------------------------------- + * THIS FILE IS LICENSED UNDER THE VIM LICENSE + * see https://github.com/vim/vim/blob/master/LICENSE + * -------------------------------------------------- *) + + +DEFINITION MODULE Foobar; (*!m2iso*) + +FROM SYSTEM IMPORT LOC, WORD, ADDRESS; + +CONST MaxFoo = 1.0; LF = CHR(10); + +TYPE Foo = POINTER TO Bar; + +(* predefined constants *) +FALSE NIL TRUE INTERRUPTIBLE UNINTERRUPTIBLE + +(* predefined types *) +BITSET BOOLEAN CHAR PROC CARDINAL INTEGER LONGINT REAL LONGREAL +COMPLEX LONGCOMPLEX PROTECTION + +(* predefined procedures *) +CAP DEC EXCL HALT INC INCL + +(* predefined functions *) +ABS CHR CMPLX FLOAT HIGH IM INT LENGTH LFLOAT MAX MIN ODD ORD RE SIZE TRUNC VAL + +(* predefined macros *) +NEW DISPOSE + +(* unsafe builtins *) +ADDRESS BYTE LOC WORD ADR CAST TSIZE SYSTEM +MAKEADR ADDADR SUBADR DIFADR ROTATE SHIFT + +(* non-standard language extensions *) +LONGCARD LONGBITSET + +(* user defined identifiers *) +foobar Foobar FooBar foo123 foo_bar + +(* string literals *) +str := "foo 'bar' baz"; +str := 'foo "bar" baz'; + +(* numeric literals *) +0FFFH, 1.23, 1.23e-45, 1000 + +(* octal literals *) +n := 0377B; ch := 0377C; + +(* pragmas *) +<*$foo*> + +(* block comments with emphasis *) +(* copyright (c) Jurrasic Inc. + author Fred Flintstone Sr. + license see LICENSE file. *) + +(* pre-conditions: foo bar baz bam boo doodle wah. + post-conditions: foodle babble bozo bim bam dang. + error-conditions: dada jingle jungle boggle dee boo. *) + +(* technical debt markers *) +(* TODO: ... *) +(* FIXME *) +(* DEPRECATED *) + +(* procedures *) +PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER ); +BEGIN + NEW(foo); + foo^.bar := bar; + RETURN +END SetBar; + +(* functions *) +PROCEDURE bar ( foo : Foo ) : INTEGER; +BEGIN + IF foo = NIL THEN + HALT + ELSE + RETURN foo^.bar + END (* IF *) +END bar; + +(* disabled code *) +?< +WHILE foo = bar DO + baz(bam, boo) +END (* WHILE *); +>? + +(* synonyms *) +@ & ~ + +(* illegal characters *) +` ! $ % \ ? _ + +(* illegal identifiers *) + +_bar _bar_baz _bar_baz__bam _bar_baz__bam_boo + +bar_ bar_baz_ bar_baz__bam_ bar_baz__bam_boo_ + +__bar __bar_baz __bar_baz__bam __bar_baz__bam_boo + +bar__ bar_baz__ bar_baz__bam__ bar_baz__bam_boo__ + +bar__baz __bar_baz__ __bar__baz__ __ + + +END Foobar. diff --git a/runtime/syntax/testdir/input/modula2_pim.def b/runtime/syntax/testdir/input/modula2_pim.def new file mode 100644 index 0000000000..e008160d34 --- /dev/null +++ b/runtime/syntax/testdir/input/modula2_pim.def @@ -0,0 +1,111 @@ +(* Modula-2 PIM Test File for Vim Syntax Colouring *) + +(* -------------------------------------------------- + * THIS FILE IS LICENSED UNDER THE VIM LICENSE + * see https://github.com/vim/vim/blob/master/LICENSE + * -------------------------------------------------- *) + +DEFINITION MODULE Foobar; (*!m2pim*) + +FROM SYSTEM IMPORT WORD, ADDRESS; + +CONST MaxFoo = 1.0; LF = CHR(10); + +TYPE Foo = POINTER TO Bar; + +(* predefined constants *) +FALSE NIL TRUE + +(* predefined types *) +BITSET BOOLEAN CHAR PROC CARDINAL INTEGER LONGINT REAL LONGREAL + +(* predefined procedures *) +CAP DEC EXCL HALT INC INCL + +(* predefined functions *) +ABS CHR FLOAT HIGH MAX MIN ODD ORD SIZE TRUNC VAL + +(* predefined macros *) +NEW DISPOSE + +(* unsafe builtins *) +ADDRESS PROCESS WORD ADR TSIZE NEWPROCESS TRANSFER SYSTEM + +(* non-standard language extensions *) +BYTE LONGCARD LONGBITSET + +(* user defined identifiers *) +foobar Foobar FooBar foo123 foo_bar + +(* string literals *) +str := "foo 'bar' baz"; +str := 'foo "bar" baz'; + +(* numeric literals *) +0FFFH, 1.23, 1.23e-45, 1000 + +(* octal literals *) +n := 0377B; ch := 0377C; + +(* pragmas *) +(*$foo*) + +(* block comments with emphasis *) +(* copyright (c) Jurrasic Inc. + author Fred Flintstone Sr. + license see LICENSE file. *) + +(* pre-conditions: foo bar baz bam boo doodle wah. + post-conditions: foodle babble bozo bim bam dang. + error-conditions: dada jingle jungle boggle dee boo. *) + +(* technical debt markers *) +(* TODO: ... *) +(* FIXME *) +(* DEPRECATED *) + +(* procedures *) +PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER ); +BEGIN + NEW(foo); + foo^.bar := bar; + RETURN +END SetBar; + +(* functions *) +PROCEDURE bar ( foo : Foo ) : INTEGER; +BEGIN + IF foo = NIL THEN + HALT + ELSE + RETURN foo^.bar + END (* IF *) +END bar; + +(* disabled code *) +?< +WHILE foo = bar DO + baz(bam, boo) +END (* WHILE *); +>? + +(* synonyms *) +& ~ + +(* illegal characters *) +` ! @ $ % \ ? _ + +(* illegal identifiers *) + +_bar _bar_baz _bar_baz__bam _bar_baz__bam_boo + +bar_ bar_baz_ bar_baz__bam_ bar_baz__bam_boo_ + +__bar __bar_baz __bar_baz__bam __bar_baz__bam_boo + +bar__ bar_baz__ bar_baz__bam__ bar_baz__bam_boo__ + +bar__baz __bar_baz__ __bar__baz__ __ + + +END Foobar. diff --git a/runtime/syntax/testdir/input/modula2_r10.def b/runtime/syntax/testdir/input/modula2_r10.def new file mode 100644 index 0000000000..0872d5dfb9 --- /dev/null +++ b/runtime/syntax/testdir/input/modula2_r10.def @@ -0,0 +1,146 @@ +(* Modula-2 R10 Test File for Vim Syntax Colouring *) + +(* -------------------------------------------------- + * THIS FILE IS LICENSED UNDER THE VIM LICENSE + * see https://github.com/vim/vim/blob/master/LICENSE + * -------------------------------------------------- *) + +DEFINITION MODULE Foobar; (*!m2r10*) + +IMPORT UNSAFE ALIAS BYTE, WORD, ADDRESS; + +CONST MaxFoo = 1.0; + +TYPE Foo = ALIAS OF Bar; + +(* predefined constants *) +NIL FALSE TRUE + +(* predefined types *) +BOOLEAN CHAR UNICHAR OCTET CARDINAL LONGCARD INTEGER LONGINT REAL LONGREAL + +(* predefined procedures *) +APPEND INSERT REMOVE SORT SORTNEW + +(* predefined functions *) +CHR ORD ODD ABS SGN MIN MAX LOG2 POW2 ENTIER PRED SUCC PTR CAPACITY COUNT LENGTH + +(* predefined macros *) +NOP TMIN TMAX TSIZE TLIMIT + +(* unsafe builtins *) +UNSAFE + +(* unsafe builtin types *) +BYTE WORD LONGWORD ADDRESS OCTETSEQ + +(* unsafe builtin procedures *) +ADD SUB DEC INC SETBIT HALT + +(* unsafe builtin functions *) +ADR CAST BIT SHL SHR BWNOT BWAND BWOR + +(* non-portable language extensions *) +ASSEMBLER ASM REG + +(* user defined identifiers *) +foobar Foobar FooBar foo_bar foo0 + + +(* string literals *) +str := "foo 'bar' baz"; +str := 'foo "bar" baz'; + +(* numeric literals *) +0b0110'0011'0110'0000, 0u0A, 0x0123, 0xCAFE'D00D +1'000'000.00, 1.23, 1.23e+10, 1.234'567'890e-1'000 + + +(* language defined pragmas *) +<*MSG=INFO:"foobar"*> <*ENCODING="UTF8"*> <*INLINE*> <*NOINLINE*> <*FFI="C"*> + +(* implementation defined pragmas *) +<*GM2.Foobar|W=Bazbam*> + + +(* single line comment *) +! foo bar baz bam boo + +(* block comments with emphasis *) +(* copyright (c) 2016 Modula-2 Foundation. + authors B.Kowarsch and R.Sutcliffe + license see LICENSE *) + +(* pre-conditions: foo bar baz bam boo doodle wah. + post-conditions: foodle babble bozo bim bam dang. + error-conditions: dada jingle jungle boggle dee boo. *) + +(* (* *) *) + +(* bindings *) +PROCEDURE [+] sum ( a, b : BCD ) : BCD; + +PROCEDURE [MOD] modulus ( n, m : INT64 ) : INT64; + +PROCEDURE [RETAIN] Retain ( foo : Foo ); + +PROCEDURE [LENGTH] length ( str : String ) : LONGCARD; + + +(* procedures *) +PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER ); +BEGIN + NEW(foo); + foo^.bar := bar; + RETURN +END NewFooWithBar; + +END END; + +(* functions *) +PROCEDURE bar ( foo : Foo ) : INTEGER; +BEGIN + IF foo = NIL THEN + UNSAFE.HALT + ELSE + RETURN foo^.bar + END (* IF *) +END bar; + + +(* technical debt *) +TO DO ( 1234, Weight.Major ) (* foo *) + "redesign foo", 2d; + "replace foo", 2d; + "test new foo", 1d +END (* TO DO *); + +PROCEDURE SetBaba <*DEPRECATED*> ( n : CARDINAL ); + + +(* disabled code *) +?< +WHILE foo = bar DO + baz(bam, boo) +END (* WHILE *); +>? + + +(* illegal characters *) +` ~ $ % ? _ + +(* illegal identifiers *) + +_bar _bar_baz _bar_baz__bam _bar_baz__bam_boo + +bar_ bar_baz_ bar_baz__bam_ bar_baz__bam_boo_ + +__bar __bar_baz __bar_baz__bam __bar_baz__bam_boo + +bar__ bar_baz__ bar_baz__bam__ bar_baz__bam_boo__ + +bar__baz __bar_baz__ __bar__baz__ __ + + +(* module end *) +END Foobar. |