-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathHoverInfo.java
More file actions
880 lines (721 loc) · 33.2 KB
/
HoverInfo.java
File metadata and controls
880 lines (721 loc) · 33.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
package de.peeeq.wurstio.languageserver.requests;
import de.peeeq.wurstio.languageserver.BufferManager;
import de.peeeq.wurstio.languageserver.ModelManager;
import de.peeeq.wurstio.languageserver.WFile;
import de.peeeq.wurstscript.WLogger;
import de.peeeq.wurstscript.ast.*;
import de.peeeq.wurstscript.attributes.names.FuncLink;
import de.peeeq.wurstscript.attributes.names.NameLink;
import de.peeeq.wurstscript.types.CallSignature;
import de.peeeq.wurstscript.types.WurstType;
import de.peeeq.wurstscript.types.WurstTypeNamedScope;
import de.peeeq.wurstscript.utils.Utils;
import org.eclipse.lsp4j.Hover;
import org.eclipse.lsp4j.MarkedString;
import org.eclipse.lsp4j.TextDocumentPositionParams;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Created by peter on 24.04.16.
*/
public class HoverInfo extends UserRequest<Hover> {
private final WFile filename;
private final String buffer;
private final int line;
private final int column;
public HoverInfo(TextDocumentPositionParams position, BufferManager bufferManager) {
this.filename = WFile.create(position.getTextDocument().getUri());
this.buffer = bufferManager.getBuffer(position.getTextDocument());
this.line = position.getPosition().getLine() + 1;
this.column = position.getPosition().getCharacter() + 1;
}
@Override
public Hover execute(ModelManager modelManager) {
CompilationUnit cu = modelManager.replaceCompilationUnitContent(filename, buffer, false);
if (cu == null) {
return new Hover(Collections.singletonList(Either.forLeft("File " + filename + " is not part of the project. Move it to the wurst folder.")));
}
Element e = Utils.getAstElementAtPos(cu, line, column, false);
WLogger.info("hovering over " + Utils.printElement(e));
List<Either<String, MarkedString>> desription = e.match(new Description());
desription = addArgumentHint(e, desription);
return new Hover(desription);
}
private List<Either<String, MarkedString>> addArgumentHint(Element e, List<Either<String, MarkedString>> desription) {
try {
if (e.getParent() instanceof Arguments) {
Arguments args = (Arguments) e.getParent();
int index = args.indexOf(e);
if (args.getParent() instanceof FunctionCall) {
FunctionCall fc = (FunctionCall) args.getParent();
FuncLink f = fc.attrFuncLink();
WurstType parameterType = f.getParameterType(index);
String parameterName = f.getParameterName(index);
desription = Utils.append(desription, Either.forLeft("Parameter " + parameterType + " " + parameterName));
}
}
} catch (Exception ex) {
WLogger.info("Could not get argument hint");
WLogger.info(ex);
}
return desription;
}
private static List<Either<String, MarkedString>> description(Element n) {
return n.match(new Description());
}
static String descriptionString(Element n) {
List<Either<String, MarkedString>> descr = description(n);
StringBuilder res = new StringBuilder();
for (Either<String, MarkedString> d : descr) {
if (d.isLeft()) {
res.append(d.getLeft());
} else {
res.append(d.getRight().getValue());
}
res.append("\n");
}
return res.toString().trim();
}
public static String getParameterString(AstElementWithParameters f) {
StringBuilder descrhtml = new StringBuilder();
boolean first = true;
for (WParameter p : f.getParameters()) {
if (!first) {
descrhtml.append(", ");
}
descrhtml.append(type(p.attrTyp())).append(" ").append(p.getName());
first = false;
}
return descrhtml.toString();
}
private static String type(WurstType wurstType) {
return wurstType.toString();
}
static class Description implements Element.Matcher<List<Either<String, MarkedString>>> {
public List<Either<String, MarkedString>> description(FunctionDefinition f) {
List<Either<String, MarkedString>> result = new ArrayList<>();
String comment = f.attrComment();
// TODO parse comment
if (comment != null && !comment.isEmpty()) {
result.add(Either.forLeft(comment));
}
String params = getParameterString(f);
String returnTypeHtml = type(f.attrReturnTyp());
String functionDescription = "";
String funcName = f.getName();
if (f instanceof ExtensionFuncDef) {
ExtensionFuncDef exf = (ExtensionFuncDef) f;
funcName = type(exf.getExtendedType().attrTyp()) + "." + funcName;
}
functionDescription += "function " + funcName + "(" + params + ") ";
if (!f.attrTyp().isVoid()) {
functionDescription += "returns " + returnTypeHtml;
}
result.add(Either.forRight(new MarkedString("wurst", functionDescription)));
result.add(Either.forLeft("defined in " + nearestScopeName(f)));
return result;
}
private static String nearestScopeName(Element n) {
if (n.attrNearestNamedScope() != null) {
return Utils.printElement(n.attrNearestNamedScope());
} else {
return "Global";
}
}
public List<Either<String, MarkedString>> description(NameDef n) {
if (n == null) {
return Collections.emptyList();
}
List<Either<String, MarkedString>> result = new ArrayList<>();
String comment = n.attrComment();
if (comment != null && !comment.isEmpty()) {
result.add(Either.forLeft(comment));
}
if (n.attrIsConstant()) {
if (n instanceof GlobalOrLocalVarDef) {
GlobalOrLocalVarDef v = (GlobalOrLocalVarDef) n;
VarInitialization initialExpr = v.getInitialExpr();
String initial = Utils.prettyPrint(initialExpr);
result.add(Either.forRight(new MarkedString("wurst", " = " + initial)));
}
}
String additionalProposalInfo = type(n.attrTyp()) + " " + n.getName()
+ " defined in " + nearestScopeName(n);
result.add(Either.forLeft(additionalProposalInfo));
return result;
}
public List<Either<String, MarkedString>> description(ConstructorDef f) {
List<Either<String, MarkedString>> result = new ArrayList<>();
String comment = f.attrComment();
// TODO parse comment
if (comment != null && !comment.isEmpty()) {
result.add(Either.forLeft(comment));
}
String params = getParameterString(f);
String functionDescription = "";
ClassOrModule classOrModule = f.attrNearestClassOrModule();
if (classOrModule != null) {
functionDescription += classOrModule.getName();
}
functionDescription += "(" + params + ") ";
result.add(Either.forRight(new MarkedString("wurst", functionDescription)));
result.add(Either.forLeft("defined in " + nearestScopeName(f)));
return result;
}
public List<Either<String, MarkedString>> description(NameRef nr) {
NameLink nameDef = nr.attrNameLink();
if (nameDef == null) {
return string(nr.getVarName() + " is not defined yet.");
}
return nameDef.getDef().match(this);
}
public List<Either<String, MarkedString>> description(FuncRef fr) {
FuncLink def = fr.attrFuncLink();
if (def == null) {
return string(fr.getFuncName() + " is not defined yet.");
}
return def.getDef().match(this);
}
@Override
public List<Either<String, MarkedString>> case_NativeFunc(NativeFunc nativeFunc) {
return description(nativeFunc);
}
@Override
public List<Either<String, MarkedString>> case_ExprEmpty(ExprEmpty exprEmpty) {
return string("empty expression");
}
@Override
public List<Either<String, MarkedString>> case_ModuleDef(ModuleDef moduleDef) {
return description(moduleDef);
}
@Override
public List<Either<String, MarkedString>> case_StmtErr(StmtErr stmtErr) {
return string("Error statement");
}
@Override
public List<Either<String, MarkedString>> case_ExprRealVal(ExprRealVal exprRealVal) {
return string("The number " + exprRealVal.getValR() + " of type real.");
}
@Override
public List<Either<String, MarkedString>> case_NoExpr(NoExpr noExpr) {
return string("no expression");
}
@Override
public List<Either<String, MarkedString>> case_StartFunctionStatement(StartFunctionStatement startFunctionStatement) {
return string("start function call");
}
@Override
public List<Either<String, MarkedString>> case_ModStatic(ModStatic modStatic) {
return string("static: This function or variable is just like a function outside of a class. "
+ "It is not bound to an instance. No dynamic dispatch is used.");
}
@Override
public List<Either<String, MarkedString>> case_ClassDef(ClassDef classDef) {
return description(classDef);
}
@Override
public List<Either<String, MarkedString>> case_ExprIntVal(ExprIntVal exprIntVal) {
return string("integer constant");
}
@Override
public List<Either<String, MarkedString>> case_ExprCast(ExprCast e) {
return string("Change the type of the left expression to " + type(e.getTyp().attrTyp()));
}
@Override
public List<Either<String, MarkedString>> case_WImport(WImport imp) {
WPackage imported = imp.attrImportedPackage();
if (imported != null)
return string(imported.attrComment());
return string("import ...");
}
@Override
public List<Either<String, MarkedString>> case_TupleDef(TupleDef tupleDef) {
return description(tupleDef);
}
@Override
public List<Either<String, MarkedString>> case_ExprVarAccess(ExprVarAccess exprVarAccess) {
return description(exprVarAccess);
}
@Override
public List<Either<String, MarkedString>> case_InterfaceDef(InterfaceDef interfaceDef) {
return description(interfaceDef);
}
@Override
public List<Either<String, MarkedString>> case_VisibilityProtected(VisibilityProtected visibilityProtected) {
return string("protected: can be used in subclasses and in the same package");
}
@Override
public List<Either<String, MarkedString>> case_Annotation(Annotation annotation) {
FunctionDefinition def = annotation.attrFuncDef();
if (def != null) {
return string(def.attrComment());
}
return string("This is an undefined annotation.");
}
@Override
public List<Either<String, MarkedString>> case_StmtExitwhen(StmtExitwhen stmtExitwhen) {
return string("extiwhen: Exits the current loop when the condition is true");
}
@Override
public List<Either<String, MarkedString>> case_ConstructorDef(ConstructorDef constr) {
List<Either<String, MarkedString>> result = new ArrayList<>();
NamedScope c = constr.attrNearestNamedScope();
String comment = constr.attrComment();
result.add(Either.forLeft(comment));
String descr = "construct(" + getParameterString(constr) + ") "
+ "defined in " + Utils.printElement(c);
result.add(Either.forRight(new MarkedString("wurst", descr)));
return result;
}
@Override
public List<Either<String, MarkedString>> case_WImports(WImports wImports) {
return string("imports");
}
@Override
public List<Either<String, MarkedString>> case_WStatements(WStatements wStatements) {
return string("statements");
}
@Override
public List<Either<String, MarkedString>> case_CompilationUnit(CompilationUnit compilationUnit) {
return string("File " + compilationUnit.getCuInfo().getFile());
}
@Override
public List<Either<String, MarkedString>> case_SwitchStmt(SwitchStmt switchStmt) {
return string("A switch statement does different things depending on the value of an epxression.");
}
@Override
public List<Either<String, MarkedString>> case_ExtensionFuncDef(ExtensionFuncDef extensionFuncDef) {
return description(extensionFuncDef);
}
@Override
public List<Either<String, MarkedString>> case_EndFunctionStatement(EndFunctionStatement endFunctionStatement) {
return string("end function");
}
@Override
public List<Either<String, MarkedString>> case_ArrayInitializer(ArrayInitializer arrayInitializer) {
return string("Initial values for the array.");
}
@Override
public List<Either<String, MarkedString>> case_ModOverride(ModOverride modOverride) {
return string("override: This function overrides an other function from a module or superclass");
}
@Override
public List<Either<String, MarkedString>> case_SomeSuperConstructorCall(SomeSuperConstructorCall sc) {
ConstructorDef constr = (ConstructorDef) sc.getParent();
ConstructorDef superConstr = constr.attrSuperConstructor();
if (superConstr == null) {
return string("Calling an unknown super constructor");
} else {
return description(superConstr);
}
}
@Override
public List<Either<String, MarkedString>> case_LocalVarDef(LocalVarDef v) {
return string("Local Variable " + v.getName() + " of type " + type(v.attrTyp()));
}
private List<Either<String, MarkedString>> string(String s) {
return Collections.singletonList(Either.forLeft(s));
}
@Override
public List<Either<String, MarkedString>> case_StmtForRangeDown(StmtForRangeDown s) {
return string("Do something for all " + s.getLoopVar().getName() + " counting from _ down to _");
}
@Override
public List<Either<String, MarkedString>> case_NoDefaultCase(NoDefaultCase noDefaultCase) {
return string("no default case");
}
@Override
public List<Either<String, MarkedString>> case_ExprSuper(ExprSuper exprSuper) {
return string("super: refers to the super class (extends ...) of this class");
}
@Override
public List<Either<String, MarkedString>> case_IdentifierWithTypeArgs(IdentifierWithTypeArgs identifierWithTypeArgs) {
return identifierWithTypeArgs.getParent().match(this);
}
@Override
public List<Either<String, MarkedString>> case_ExprMemberVarDotDot(ExprMemberVarDotDot exprMemberVarDotDot) {
return description(exprMemberVarDotDot);
}
@Override
public List<Either<String, MarkedString>> case_ExprVarArrayAccess(ExprVarArrayAccess exprVarArrayAccess) {
return description(exprVarArrayAccess);
}
@Override
public List<Either<String, MarkedString>> case_ExprMemberMethodDot(ExprMemberMethodDot exprMemberMethodDot) {
return description(exprMemberMethodDot);
}
@Override
public List<Either<String, MarkedString>> case_ExprClosure(ExprClosure exprClosure) {
return string("Closure with type " + exprClosure.attrTyp() + " (implements " + exprClosure.attrExpectedTypAfterOverloading() + ")");
}
@Override
public List<Either<String, MarkedString>> case_SwitchCases(SwitchCases switchCases) {
return string("A switch statement");
}
@Override
public List<Either<String, MarkedString>> case_ExprBinary(ExprBinary exprBinary) {
FuncLink funcDef = exprBinary.attrFuncLink();
if (funcDef != null) {
return description(funcDef.getDef());
}
return string("A binary operation");
}
@Override
public List<Either<String, MarkedString>> case_NoTypeExpr(NoTypeExpr noTypeExpr) {
return string("not type");
}
@Override
public List<Either<String, MarkedString>> case_ModuleUse(ModuleUse moduleUse) {
return description(moduleUse.attrModuleDef());
}
@Override
public List<Either<String, MarkedString>> case_ExprFunctionCall(ExprFunctionCall exprFunctionCall) {
return description(exprFunctionCall);
}
@Override
public List<Either<String, MarkedString>> case_ExprBoolVal(ExprBoolVal exprBoolVal) {
return string("A boolean value");
}
@Override
public List<Either<String, MarkedString>> case_ModConstant(ModConstant modConstant) {
return string("This modifiers ensures that the variable cannot change after initialization.");
}
@Override
public List<Either<String, MarkedString>> case_ExprTypeId(ExprTypeId exprTypeId) {
return string("Get the typeId");
}
@Override
public List<Either<String, MarkedString>> case_TypeExprList(TypeExprList typeExprList) {
return string("A list of type-expressions");
}
@Override
public List<Either<String, MarkedString>> case_FuncDefs(FuncDefs funcDefs) {
return string("A list of function definitions");
}
@Override
public List<Either<String, MarkedString>> case_ExprNewObject(ExprNewObject exprNewObject) {
ConstructorDef constr = exprNewObject.attrConstructorDef();
if (constr == null) {
return string("Constructor for " + exprNewObject.getTypeName() + " not defined yet.");
}
return description(constr);
}
@Override
public List<Either<String, MarkedString>> case_VisibilityPrivate(VisibilityPrivate visibilityPrivate) {
return string("Modifier private: This element can only be used in the current scope.");
}
@Override
public List<Either<String, MarkedString>> case_VisibilityDefault(VisibilityDefault visibilityDefault) {
return string("Default visibility.");
}
@Override
public List<Either<String, MarkedString>> case_Arguments(Arguments arguments) {
return string("List of arguments");
}
@Override
public List<Either<String, MarkedString>> case_ModuleInstanciations(ModuleInstanciations moduleInstanciations) {
return string("List of module instantiations.");
}
@Override
public List<Either<String, MarkedString>> case_WShortParameters(WShortParameters wShortParameters) {
return string("Parameters of anonymous function.");
}
@Override
public List<Either<String, MarkedString>> case_SwitchDefaultCaseStatements(SwitchDefaultCaseStatements switchDefaultCaseStatements) {
return string("Default statements of switch-statement");
}
@Override
public List<Either<String, MarkedString>> case_ExprStatementsBlock(ExprStatementsBlock exprStatementsBlock) {
return string("A block of statements.");
}
@Override
public List<Either<String, MarkedString>> case_ModuleUses(ModuleUses moduleUses) {
return string("A list of module uses");
}
@Override
public List<Either<String, MarkedString>> case_GlobalVarDef(GlobalVarDef globalVarDef) {
return description(globalVarDef);
}
@Override
public List<Either<String, MarkedString>> case_JassToplevelDeclarations(JassToplevelDeclarations jassToplevelDeclarations) {
return string("A list of declarations.");
}
@Override
public List<Either<String, MarkedString>> case_ExprIncomplete(ExprIncomplete exprIncomplete) {
return string("This expression is incomplete.");
}
@Override
public List<Either<String, MarkedString>> case_ExprMemberArrayVarDotDot(ExprMemberArrayVarDotDot exprMemberArrayVarDotDot) {
return description(exprMemberArrayVarDotDot);
}
@Override
public List<Either<String, MarkedString>> case_ConstructorDefs(ConstructorDefs constructorDefs) {
return string("A list of constructors");
}
private List<Either<String, MarkedString>> typeExpr(TypeExpr t) {
WurstType wt = t.attrTyp();
if (wt == null) {
return string("Type " + t);
}
if (wt instanceof WurstTypeNamedScope) {
WurstTypeNamedScope wtn = (WurstTypeNamedScope) wt;
return description(wtn.getDef());
}
return string(type(wt));
}
@Override
public List<Either<String, MarkedString>> case_TypeExprArray(TypeExprArray t) {
return typeExpr(t);
}
@Override
public List<Either<String, MarkedString>> case_TypeExprSimple(TypeExprSimple t) {
return typeExpr(t);
}
@Override
public List<Either<String, MarkedString>> case_Modifiers(Modifiers modifiers) {
return string("A list of modifiers");
}
@Override
public List<Either<String, MarkedString>> case_ModAbstract(ModAbstract modAbstract) {
return string("Abstract members are declarations without implementations. They must be implemented in concrete subtypes.");
}
@Override
public List<Either<String, MarkedString>> case_WBlock(WBlock wBlock) {
return string("A block.");
}
@Override
public List<Either<String, MarkedString>> case_StmtSkip(StmtSkip stmtSkip) {
return string("The skip statement does nothing and can be used to fill an empty block.");
}
@Override
public List<Either<String, MarkedString>> case_FuncDef(FuncDef funcDef) {
return description(funcDef);
}
@Override
public List<Either<String, MarkedString>> case_ExprList(ExprList exprList) {
return string("A list of expressions.");
}
@Override
public List<Either<String, MarkedString>> case_NativeType(NativeType nativeType) {
return description(nativeType);
}
@Override
public List<Either<String, MarkedString>> case_NoTypeParamConstraints(NoTypeParamConstraints noTypeParamConstraints) {
return string("No type parameter constraints given.");
}
@Override
public List<Either<String, MarkedString>> case_StmtForRangeUp(StmtForRangeUp stmtForRangeUp) {
return string("Execute the body several times, counting up");
}
@Override
public List<Either<String, MarkedString>> case_StmtLoop(StmtLoop stmtLoop) {
return string("Primitive loop statement");
}
@Override
public List<Either<String, MarkedString>> case_ExprStringVal(ExprStringVal exprStringVal) {
return string("A string constant.");
}
@Override
public List<Either<String, MarkedString>> case_ExprNull(ExprNull exprNull) {
return string("The null-reference");
}
@Override
public List<Either<String, MarkedString>> case_TypeParamConstraintList(TypeParamConstraintList typeParamConstraintList) {
return string("Type parameter constraints define type classes that must be implemented for type parameters.");
}
@Override
public List<Either<String, MarkedString>> case_ClassDefs(ClassDefs classDefs) {
return string("A list of class definitions.");
}
@Override
public List<Either<String, MarkedString>> case_ModuleInstanciation(ModuleInstanciation moduleInstanciation) {
return string("A module instantiation.");
}
@Override
public List<Either<String, MarkedString>> case_ExprMemberArrayVarDot(ExprMemberArrayVarDot exprMemberArrayVarDot) {
return description(exprMemberArrayVarDot);
}
@Override
public List<Either<String, MarkedString>> case_ExprFuncRef(ExprFuncRef exprFuncRef) {
return description(exprFuncRef);
}
@Override
public List<Either<String, MarkedString>> case_TypeParamDefs(TypeParamDefs typeParamDefs) {
return string("A list of type parameters.");
}
@Override
public List<Either<String, MarkedString>> case_StmtForFrom(StmtForFrom stmtForFrom) {
return string("The for-from loop takes an iterate and takes elements from the iterator until it is empty.");
}
@Override
public List<Either<String, MarkedString>> case_Indexes(Indexes indexes) {
return string("A list of indexes");
}
@Override
public List<Either<String, MarkedString>> case_VisibilityPublicread(VisibilityPublicread visibilityPublicread) {
return string("This variable can be read from everywhere but only written to in this scope.");
}
@Override
public List<Either<String, MarkedString>> case_EnumMember(EnumMember enumMember) {
return description(enumMember);
}
@Override
public List<Either<String, MarkedString>> case_ExprInstanceOf(ExprInstanceOf exprInstanceOf) {
return string("The instanceof expression checks if an object is an instance of a given type.");
}
@Override
public List<Either<String, MarkedString>> case_WurstModel(WurstModel wurstModel) {
return string("The wurst model.");
}
@Override
public List<Either<String, MarkedString>> case_Identifier(Identifier identifier) {
return identifier.getParent().match(this);
}
@Override
public List<Either<String, MarkedString>> case_StmtWhile(StmtWhile stmtWhile) {
return string("A while loop");
}
@Override
public List<Either<String, MarkedString>> case_ExprMemberMethodDotDot(ExprMemberMethodDotDot exprMemberMethodDotDot) {
return description(exprMemberMethodDotDot);
}
@Override
public List<Either<String, MarkedString>> case_TypeParamDef(TypeParamDef typeParamDef) {
return description(typeParamDef);
}
@Override
public List<Either<String, MarkedString>> case_IdentifierWithTypeParamDefs(IdentifierWithTypeParamDefs identifierWithTypeParamDefs) {
return identifierWithTypeParamDefs.getParent().match(this);
}
@Override
public List<Either<String, MarkedString>> case_GlobalVarDefs(GlobalVarDefs globalVarDefs) {
return string("A list of global variables.");
}
@Override
public List<Either<String, MarkedString>> case_ExprThis(ExprThis exprThis) {
return string("'this' refers to the current object (of type " + exprThis.attrTyp() + ")");
}
@Override
public List<Either<String, MarkedString>> case_StmtReturn(StmtReturn stmtReturn) {
return string("Returns from the current function.");
}
@Override
public List<Either<String, MarkedString>> case_WPackages(WPackages wPackages) {
return string("A list of packages.");
}
@Override
public List<Either<String, MarkedString>> case_ExprIfElse(ExprIfElse exprIfElse) {
return string("A conditional expression (condition ? ifTrue : ifFalse).");
}
@Override
public List<Either<String, MarkedString>> case_TypeParamConstraint(TypeParamConstraint t) {
return string(t.description());
}
@Override
public List<Either<String, MarkedString>> case_WurstDoc(WurstDoc wurstDoc) {
return wurstDoc.getParent().match(this);
}
@Override
public List<Either<String, MarkedString>> case_NoSuperConstructorCall(NoSuperConstructorCall noSuperConstructorCall) {
return string("no super constructor called");
}
@Override
public List<Either<String, MarkedString>> case_StmtIf(StmtIf stmtIf) {
return string("An if-statement.");
}
@Override
public List<Either<String, MarkedString>> case_WPackage(WPackage wPackage) {
return description(wPackage);
}
@Override
public List<Either<String, MarkedString>> case_OnDestroyDef(OnDestroyDef onDestroyDef) {
return string("This is called when an object of this type is destroyed.");
}
@Override
public List<Either<String, MarkedString>> case_ModVararg(ModVararg modVararg) {
return string("Declares the parameter to be a array of variable length");
}
@Override
public List<Either<String, MarkedString>> case_InstanceDecl(InstanceDecl instanceDecl) {
return string("An instance declaration for the type-class " + instanceDecl.getImplementedInterface().attrTyp());
}
@Override
public List<Either<String, MarkedString>> case_TypeExprResolved(TypeExprResolved typeExprResolved) {
return typeExpr(typeExprResolved);
}
@Override
public List<Either<String, MarkedString>> case_VisibilityPublic(VisibilityPublic visibilityPublic) {
return string("This element can be used everywhere");
}
@Override
public List<Either<String, MarkedString>> case_TopLevelDeclarations(TopLevelDeclarations topLevelDeclarations) {
return string("A list of declarations.");
}
@Override
public List<Either<String, MarkedString>> case_StmtSet(StmtSet stmtSet) {
return string("An assignment.");
}
@Override
public List<Either<String, MarkedString>> case_ExprDestroy(ExprDestroy exprDestroy) {
return string("Destroys the given object.");
}
@Override
public List<Either<String, MarkedString>> case_WEntities(WEntities wEntities) {
return string("A list of entities");
}
@Override
public List<Either<String, MarkedString>> case_ArraySizes(ArraySizes arraySizes) {
return string("A list of array-sizes");
}
@Override
public List<Either<String, MarkedString>> case_EnumDef(EnumDef enumDef) {
return description(enumDef);
}
@Override
public List<Either<String, MarkedString>> case_SwitchCase(SwitchCase switchCase) {
return string("A case in a switch-statement");
}
@Override
public List<Either<String, MarkedString>> case_EnumMembers(EnumMembers enumMembers) {
return string("A list of enum-members.");
}
@Override
public List<Either<String, MarkedString>> case_TypeExprThis(TypeExprThis typeExprThis) {
return typeExpr(typeExprThis);
}
@Override
public List<Either<String, MarkedString>> case_ExprUnary(ExprUnary exprUnary) {
return string("A unary expression");
}
@Override
public List<Either<String, MarkedString>> case_JassGlobalBlock(JassGlobalBlock jassGlobalBlock) {
return string("A block of global variables.");
}
@Override
public List<Either<String, MarkedString>> case_StmtForIn(StmtForIn stmtForIn) {
return string("The for-in loop executes the loop body for every element in the given collection using its iterator method.");
}
@Override
public List<Either<String, MarkedString>> case_InitBlock(InitBlock initBlock) {
return string("The init block is called at the start of the program.");
}
@Override
public List<Either<String, MarkedString>> case_WParameter(WParameter wParameter) {
return description(wParameter);
}
@Override
public List<Either<String, MarkedString>> case_WShortParameter(WShortParameter wShortParameter) {
return description(wShortParameter);
}
@Override
public List<Either<String, MarkedString>> case_ExprMemberVarDot(ExprMemberVarDot exprMemberVarDot) {
return description(exprMemberVarDot);
}
@Override
public List<Either<String, MarkedString>> case_WParameters(WParameters wParameters) {
return string("A list of parameters");
}
}
}