src/parser/parser-proto.lisp: Muffle a `&optional ... &key ...' warning.
[sod] / test / bad.sod
CommitLineData
deef4956
MW
1/* -*-sod-*-
2 *
3 * A file full of terribleness, to check error reporting and recovery.
4 *
5 * (c) 2019 Straylight/Edgeware
6 */
7
8/* The reference file for this test isn't intended to be normative: it's fine
9 * if things are reordered, or messages are rephrased. But it's good to know
10 * when these things change, and besides this approach is way easier than the
11 * alternatives.
12 */
13
14typename Bad;
15
16import "chimaera";
17
18lisp ;this is actually a comment
19 (format t ";; Hello from Lisp!~%")
20 /* and this is the statement terminator */;
21
22lisp
23(define-pluggable-parser module test (scanner pset)
24 ;; `demo' string `;'
25 (declare (ignore pset))
26 (with-parser-context (token-scanner-context :scanner scanner)
27 (parse (seq ("demo" (string (must :string)) (nil (must #\;)))
28 (format t ";; DEMO ~S~%" string)))));
29demo "foo";
30
31code c: user ( not like this '' 'xyz' );
32
33class {
34}
35
36class Wrong {
37 void frob() { ... }
38 void wrong.frob() { ... }
39
40 int x = 2;
41 wrong.x = 7;
42 wrong.x = 3;
43 int filler, y(), .z[45], q;
44 int wrong.fizzbuzz(int n) extern;
45 wtf.y = 19, wrong.z = 69, x.= r;
46 int (*bogon)(const char *) { return strlen(p); }
47}
48
49class Fail: SodObject { void badkw(?int x) extern; void ebw(?) extern; }
50class Unlikely: Fail { void fail.badkw(?double y) extern; }
51class Whoops: Fail { void fail.badkw(?int y) extern; }
52class Arrgh: Unlikely, Whoops {
53 void fail.badkw(?double x) extern;
54 void fail.ebw(?) extern;
55}
56
57[nick = join] class JSuper: SodObject { }
58[nick = sub] class LSub: JSuper { }
59[nick = sub] class RSub: JSuper { }
60[nick = join] class BadNicks: LSub, RSub { }
61class Super: SodObject { }
62class Left: Super { }
63class Right: Super { }
64class Join: Left, Right { }
65class Nioj: Right, Left { }
66class Splinch: Join, SodObject, Nioj { }
67[link = Super] class Hopeless: Wrong { }
68
69[link = SodClass]
70class MyClass: SodClass {
71 int foo = 1;
72 int bar = 2;
73}
74
75class MyOtherClass: SodClass { }
76
77[metaclass = MyClass, link = SodObject]
78class MyObject: SodObject {
79 class myclass.foo = 42;
80}
81
82[metaclass = MyOtherClass] class MyOtherObject: SodObject { }
83class WhichMetaClass: MyObject, MyOtherObject { }
84
85class dismissed;
86
87class hopeful: dismissed
88;