-
Notifications
You must be signed in to change notification settings - Fork 11
/
Messages.n
894 lines (773 loc) · 29.1 KB
/
Messages.n
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
881
882
883
884
885
886
887
888
889
890
891
892
893
894
using Nemerle;
using Nemerle.Collections;
using Nemerle.Extensions;
using Nemerle.Imperative;
using Nemerle.Text;
using Nemerle.Utility;
using Nitra.ClientServer.Macros;
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Xml.Serialization;
namespace Nitra.ClientServer.Messages
{
public module Constants
{
public AsyncResponsePipeSuffix : string = "-async-response";
public ResponsePipeSuffix : string = "-response";
public RequestPipeSuffix : string = "-request";
public static AssemblyVersionGuid : string = MakeGuidString();
}
[NitraMessage]
public abstract class Message { }
[NitraMessage]
public abstract class RouterMessage : Message { }
[NitraMessage]
public variant ClientMessage : RouterMessage
{
| CheckVersion { assemblyVersionGuid : string; }
| SolutionStartLoading { id : SolutionId; fullPath : string; }
| SolutionLoaded { id : SolutionId; }
| SolutionUnloaded { id : SolutionId; }
| ProjectStartLoading { id : ProjectId; fullPath : string; config : Config; }
| ProjectLoaded { id : ProjectId; }
| ProjectUnloaded { id : ProjectId; }
| ProjectRename { oldId : ProjectId; newId : ProjectId; newPath : string; }
| ProjectReferenceLoaded { projectId : ProjectId; referencedProjectId : ProjectId; path : string; }
| ProjectReferenceUnloaded { projectId : ProjectId; referencedProjectId : ProjectId; path : string; }
| ReferenceLoaded { projectId : ProjectId; name : string; }
| ReferenceUnloaded { projectId : ProjectId; name : string; }
| FileSaved { id : FileId; version : FileVersion; }
| FileLoaded { projectId : ProjectId; fullPath : string; id : FileId; version : FileVersion; hasContent : bool; contentOpt : string; }
| FileReparse { id : FileId; }
| FileUnloaded { projectId : ProjectId; id : FileId; }
| FileRenamed { oldId : FileId; newId : FileId; newPath : string; }
| FileInMemoryLoaded { projectId : ProjectId; id : FileId; name : string; content : string; }
| FileActivated { projectId : ProjectId; id : FileId; version : FileVersion; }
| FileDeactivated { projectId : ProjectId; id : FileId; }
| FileChanged { id : FileId; version : FileVersion; change : FileChange; caretPos : VersionedPos; }
| FileChangedBatch { id : FileId; version : FileVersion; changes : ImmutableArray[FileChange]; caretPos : VersionedPos; }
| PrettyPrint { state : PrettyPrintState; }
| CompleteWord { projectId : ProjectId; id : FileId; version : FileVersion; pos : int; }
| CompleteWordDismiss { projectId : ProjectId; id : FileId }
| FindSymbolReferences { projectId : ProjectId; fileId : FileId; pos : VersionedPos; }
| FindSymbolDefinitions { projectId : ProjectId; fileId : FileId; pos : VersionedPos; }
| ParseTreeReflection { enable : bool; }
| GetObjectContent { solutionId : SolutionId; projectId : ProjectId; fileId : FileId; fileVersion : FileVersion; objectId : int; }
| GetObjectGraph { solutionId : SolutionId; projectId : ProjectId; fileId : FileId; fileVersion : FileVersion; objectId : int; }
| AttachDebugger { }
| GetLibsMetadata { libs : ImmutableArray[string]; }
| GetLibsSyntaxModules { libs : ImmutableArray[string]; }
| GetLibsProjectSupports { libs : ImmutableArray[string]; }
| GetFileExtensions { projectId : ProjectId; languageNames : ImmutableArray[string]; }
| SetCaretPos { projectId : ProjectId; fileId : FileId; pos : VersionedPos; }
| GetHint { projectId : ProjectId; fileId : FileId; pos : VersionedPos; }
| GetSubHint { projectId : ProjectId; symbolId : int; }
| FindDeclarations { pattern : string; primaryProjectId : ProjectId; hideExternalItems : bool; kinds : ImmutableArray[string]; }
| Shutdown { }
public override ToString() : string { ToStringImpl() }
}
[NitraMessage]
public variant ServerMessage
{
| FindSymbolDefinitions { solutionId : SolutionId; referenceSpan : NSpan; definitions : ImmutableArray[SymbolLocation]; }
| FindSymbolReferences { solutionId : SolutionId; referenceSpan : NSpan; symbols : ImmutableArray[SymbolRreferences]; }
| ParseTreeReflection { solutionId : SolutionId; root : ImmutableArray[ParseTreeReflectionStruct]; }
| ObjectContent { solutionId : SolutionId; content : ContentDescriptor; }
| LibsMetadata { solutionId : SolutionId; metadatas : ImmutableArray[LibMetadata]; }
| LibsSyntaxModules { solutionId : SolutionId; modules : ImmutableArray[SyntaxModules]; }
| LibsProjectSupports { solutionId : SolutionId; libs : ImmutableArray[ProjectSupports]; }
| FileExtensions { solutionId : SolutionId; fileExtensions : ImmutableArray[string]; }
| SubHint { text : string; }
public override ToString() : string { ToStringImpl() }
}
[NitraMessage]
public variant AsyncServerMessage
{
public FileId : FileId;
public Version : FileVersion;
public SolutionId : SolutionId;
| LanguageLoaded { spanClassInfos : ImmutableArray[SpanClassInfo]; }
| OutliningCreated { projectId : ProjectId; outlining : ImmutableArray[OutliningInfo]; }
| KeywordsHighlightingCreated { projectId : ProjectId; spanInfos : ImmutableArray[SpanInfo]; }
| MatchedBrackets { projectId : ProjectId; results : ImmutableArray[MatchBrackets]; }
| SymbolsHighlightingCreated { projectId : ProjectId; spanInfos : ImmutableArray[SpanInfo]; }
| ProjectLoadingMessages { projectId : ProjectId; messages : array[CompilerMessage]; }
| ParsingMessages { projectId : ProjectId; messages : array[CompilerMessage]; }
| MappingMessages { projectId : ProjectId; messages : array[CompilerMessage]; }
| SemanticAnalysisMessages { projectId : ProjectId; messages : array[CompilerMessage]; }
| SemanticAnalysisDone { projectId : ProjectId; }
| PrettyPrintCreated { type : PrettyPrintState; text : string; }
| ReflectionStructCreated { root : ParseTreeReflectionStruct; }
| RefreshReferencesFailed { exception : string; }
| RefreshProjectFailed { exception : string; }
| FindSymbolReferences { referenceSpan : NSpan; symbols : ImmutableArray[SymbolRreferences]; }
| Hint { text : string; referenceSpan : NSpan; }
| Exception { exception : string; }
| FoundDeclarations { projectId : ProjectId; declarations : ImmutableArray[DeclarationInfo]; }
| CompleteWord { replacementSpan : NSpan; completionList : ImmutableArray[CompletionElem]; }
public override ToString() : string { ToStringImpl() }
}
[NitraMessage]
public class ProjectSupports
{
public ProjectSupports : ImmutableArray[ProjectSupport];
public override ToString() : string { ProjectSupports.ToString(", ") }
}
[NitraMessage]
public class SyntaxModules
{
public Modules : ImmutableArray[string];
}
[NitraMessage]
public class LibMetadata
{
public ProjectSupprts : ImmutableArray[string];
public Languages : ImmutableArray[LanguageInfo];
}
[NitraMessage, StructuralEquality]
public struct SymbolRreferences
{
public SymbolId : int;
public Definitions : ImmutableArray[SymbolLocation];
public References : ImmutableArray[FileEntries]
}
public enum PrettyPrintState
{
| Disabled
| Text
| Html
}
[NitraMessage, StructuralEquality]
public struct NSpan : IComparable[NSpan]
{
public StartPos : int;
public EndPos : int;
public Length : int { get { EndPos - StartPos }}
public IsEmpty : bool
{
get { StartPos == EndPos }
}
public IntersectsWith(pos : int) : bool { pos <= EndPos && pos >= StartPos }
public IntersectsWith(start : int, end : int) : bool { start <= EndPos && end >= StartPos }
public IntersectsWith(other : NSpan) : bool { IntersectsWith(other.StartPos, other.EndPos) }
public IntersectsWith(other : Range) : bool { IntersectsWith(other.Span) }
public IntersectsWith(other : Location) : bool { IntersectsWith(other.Range) }
public override ToString() : string { StartPos + ", " + EndPos }
public CompareTo(other : NSpan) : int
{
def result = StartPos.CompareTo(other.StartPos);
if (result == 0)
EndPos.CompareTo(other.EndPos)
else
result
}
}
[NitraMessage, StructuralEquality]
public struct SpanInfo
{
public static Comparer : SpanInfoComparer = SpanInfoComparer();
public Span : NSpan;
public SpanClassId : int;
public override ToString() : string
{
"Span=" + Span + ", SpanClassId=" + SpanClassId
}
public class SpanInfoComparer : IComparer[SpanInfo]
{
public Compare(x : SpanInfo, y : SpanInfo) : int
{
def res = x.Span.StartPos.CompareTo(y.Span.StartPos);
when (res != 0)
return res;
x.SpanClassId - y.SpanClassId
}
}
}
[NitraMessage]
public variant FileChange
{
| Insert { pos : int; text : string }
| Delete { span : NSpan }
| Replace { span : NSpan; text : string }
}
[NitraMessage, StructuralEquality]
public struct FileIdentity : IComparable[FileIdentity]
{
public FileId : FileId;
public FileVersion : FileVersion;
public CompareTo(other : FileIdentity) : int
{
FileId.Value.CompareTo(other.FileId.Value)
}
}
[NitraMessage]
public struct FileEntries
{
public File : FileIdentity;
public Ranges : ImmutableArray[Range];
}
[NitraMessage]
public struct DeclarationInfo
{
public SymbolId : int;
public Name : string;
/// Spans which match te pattern
public NameMatchRuns : ImmutableArray[NSpan];
public FullName : string;
public Kind : string;
public SpanClassId : int;
public Location : Location;
}
[NitraMessage]
public struct SymbolLocation
{
public SymbolId : int;
public Location : Location;
}
[NitraMessage, StructuralEquality]
public struct Range : IComparable[Range]
{
public Span : NSpan;
public StartLine : int;
public StartColumn : int;
public EndLine : int;
public EndColumn : int;
public Text : string;
public CompareTo(other : Range) : int { Span.CompareTo(other.Span) }
public override ToString() : string { "{" + StartLine + ", " + StartColumn + "}" }
}
[NitraMessage, StructuralEquality]
public struct Location : IComparable[Location]
{
public File : FileIdentity;
public Range : Range;
public Span : NSpan { get { this.Range.Span } }
public CompareTo(other : Location) : int
{
mutable result = File.CompareTo(other.File);
if (result == 0)
Range.CompareTo(other.Range)
else
result
}
public override ToString() : string
{
"Location(" + this.File.FileId.Value + ", v=" + this.File.FileVersion.Value + ", " + this.Range + ")"
}
}
public enum CompilerMessageSource : byte
{
| ProjectLoading
| Parsing
| Mapping
| SemanticAnalysis
}
public enum CompilerMessageType
{
| FatalError = 0
| Error = 1
| Warning = 2
| Hint = 3
}
[NitraMessage]
public struct CompilerMessage : IComparable[CompilerMessage]
{
public Type : CompilerMessageType;
public Location : Location;
public Text : string;
public Number : int;
public Source : CompilerMessageSource;
public NestedMessages : list[CompilerMessage];
public CompareTo(other : CompilerMessage) : int
{
def result1 = this.Location.CompareTo(other.Location);
when (result1 != 0)
return result1;
def result2 = Type :> int - other.Type :> int;
when (result2 != 0)
return result2;
string.Compare(Text, other.Text, StringComparison.Ordinal)
}
[OverrideObjectEquals]
Equals(other : CompilerMessage) : bool
{
when (!this.Location.Equals(other.Location))
return false;
when (Type != other.Type)
return false;
string.Equals(Text, other.Text)
}
public override GetHashCode() : int
{
this.Location.GetHashCode() ^ Type :> int ^ Text.GetHashCode()
}
}
[NitraMessage]
public sealed class ProjectSupport
{
public this()
{
Caption = "";
TypeFullName = "";
Path = "";
}
/// Caption from ProjectSupportAttributr of the type which implement IProjectSupport
[XmlAttribute] public mutable Caption : string;
/// Fully qualified name of the type which implement IProjectSupport
[XmlAttribute] public mutable TypeFullName : string;
/// Path of assembly where defined the type which implement IProjectSupport
[XmlAttribute] public mutable Path : string;
public IsNotSpecified : bool { get { string.IsNullOrEmpty(TypeFullName) || string.IsNullOrEmpty(Caption) } }
public override ToString() : string { if (IsNotSpecified) "<not specified>" else Caption }
}
[NitraMessage]
public sealed class Config
{
public this() { }
public static InitNew() : Config
{
def x = Config();
x.ProjectSupport = ProjectSupport();
x.Languages = array(0);
x.References = array(0);
x
}
/// Descriptions of class which implements IProjectSupport
public mutable ProjectSupport : ProjectSupport;
/// Language descriptions
[XmlArray(ElementName="Languages", IsNullable=false)]
[XmlArrayItem("Language")]
public mutable Languages : array[LanguageInfo];
/// Library references
[XmlArray(ElementName="References", IsNullable=false)]
[XmlArrayItem("Reference")]
public mutable References : array[string];
}
[NitraMessage]
public struct DynamicExtensionInfo
{
/// Fully qualified name of syntax modules which contains lanuage extensions
[XmlAttribute] public mutable Name : string;
/// Path of assembly where defined lanuage extensions
[XmlAttribute] public mutable Path : string;
public override ToString() : string { "DynamicExtension: " + Name }
}
[NitraMessage]
public struct LanguageInfo
{
/// Fully qualified name of the lanuage
[XmlAttribute] public mutable Name : string;
/// Path of assembly where defined the type where defined lanuage
[XmlAttribute] public mutable Path : string;
/// List of dynamically loaded extensions of the lanuage
[XmlArray(ElementName="DynamicExtensions", IsNullable=false)]
[XmlArrayItem("Extension")]
public mutable DynamicExtensions : array[DynamicExtensionInfo];
public override ToString() : string { "Language: " + Name }
}
[NitraMessage]
public struct SpanClassInfo
{
public FullName : string;
public Id : int;
public ForegroundColor : int;
public override ToString() : string
{
"SpanClass=" + FullName + " Id=" + Id
}
}
[NitraMessage]
public struct OutliningInfo
{
public static Comparer : OutliningInfoComparer = OutliningInfoComparer();
public Span : NSpan;
public IsDefaultCollapsed : bool;// TODO: use bit field
public IsImplementation : bool;
public override ToString() : string
{
"Outlining({" + Span + (if (IsDefaultCollapsed) "}, Collapsed)" else "})")
}
public class OutliningInfoComparer : IComparer[OutliningInfo]
{
public Compare(x : OutliningInfo, y : OutliningInfo) : int
{
x.Span.StartPos.CompareTo(y.Span.StartPos)
}
}
}
public class CompletionElemComparer : IComparer[CompletionElem]
{
public Compare(x : CompletionElem, y : CompletionElem) : int
{
x.Text.CompareTo(y.Text)
}
}
[NitraMessage]
public variant CompletionElem
{
| Literal { text : string; description : string; }
| Symbol { Id : int; name : string; content : string; description : string; iconId : int; }
public override ToString() : string
{
match (this)
{
| Literal as x => "Literal: " + x.text
| Symbol as x => "Symbol: " + x.description
}
}
public Text : string
{
get
{
match (this)
{
| Literal as x => x.text
| Symbol as x => x.name
}
}
}
}
public enum ReflectionKind
{
| Normal
| Recovered
| Ambiguous
| Deleted
}
[NitraMessage]
public class ReflectionInfo
{
public ShortName : string;
public FullName : string;
public IsMarker : bool;
public CanParseEmptyString : bool;
}
[NitraMessage]
public class ParseTreeReflectionStruct
{
public info : ReflectionInfo;
public description : string;
public kind : ReflectionKind;
public span : NSpan;
public children : ImmutableArray[ParseTreeReflectionStruct];
public Info : ReflectionInfo { get { info } }
public Description : string { get { description } }
public Kind : ReflectionKind { get { kind } }
public Span : NSpan { get { span } }
public Children : ImmutableArray[ParseTreeReflectionStruct] { get { children } }
public override ToString() : string{ Description + " Count=" + Children.Length }
}
[NitraMessage]
public class GrammarDescriptor
{
public FullName: string;
public AssemblyLocation: string;
}
[NitraMessage]
public class LibReference
{
public Name: string;
}
public enum PropertyKind
{
| Simple
| DependentIn
| DependentOut
| DependentInOut
| Ast
}
[NitraMessage]
public variant ContentDescriptor
{
| Fail { msg : string; }
| Members { members : array[PropertyDescriptor]; }
| Items { items : array[ObjectDescriptor]; }
| AstItems { members : array[PropertyDescriptor]; items : array[ObjectDescriptor]; }
}
[NitraMessage]
public variant ObjectDescriptor
{
| Unknown { str : string; }
| Null { }
| NotEvaluated { }
| Ast { span : NSpan; id : int; str : string; typeName : string; typeFullName : string; mutable members : array[PropertyDescriptor]; }
| Symbol { id : int; name : string; fullName : string; typeName : string; typeFullName : string; mutable members : array[PropertyDescriptor]; }
| Object { id : int; str : string; typeName : string; typeFullName : string; mutable members : array[PropertyDescriptor]; }
| AstList { span : NSpan; id : int; mutable items : array[ObjectDescriptor]; mutable members : array[PropertyDescriptor]; count : int; }
| Seq { id : int; mutable items : array[ObjectDescriptor]; count : int; }
| String { value : string; }
| Int16 { value : System.Int16 ; }
| Int32 { value : System.Int32 ; }
| Int64 { value : System.Int64 ; }
| Char { value : System.Char ; }
| SByte { value : System.SByte ; }
| UInt16 { value : System.UInt16 ; }
| UInt32 { value : System.UInt32 ; }
| UInt64 { value : System.UInt64 ; }
| Byte { value : System.Byte ; }
| Single { value : System.Single ; }
| Double { value : System.Double ; }
| Boolean { value : System.Boolean; }
| Parsed { span : NSpan; value : ObjectDescriptor; }
public IsObject : bool { get { match (this) { | Ast | Symbol | Object => true | _ => false } } }
public IsSeq : bool { get { match (this) { | AstList | Seq => true | _ => false } } }
public Properties : array[PropertyDescriptor]
{
get
{
match (this)
{
| Ast as x => x.members
| Symbol as x => x.members
| Object as x => x.members
| AstList as x => x.members
| _ => null
}
}
}
public Items : array[ObjectDescriptor]
{
get
{
match (this)
{
| AstList as x => x.items
| Seq as x => x.items
| _ => null
}
}
}
public Count : int
{
get
{
match (this)
{
| AstList as x => x.count
| Seq as x => x.count
| _ => 0
}
}
}
public Id : int
{
get
{
match (this)
{
| Ast as x => x.id
| Symbol as x => x.id
| Object as x => x.id
| AstList as x => x.id
| Seq as x => x.id
| _ => -1
}
}
}
public Span : NSpan
{
get
{
match (this)
{
| Ast as x => x.span
| AstList as x => x.span
| Parsed as x => x.span
| _ => NSpan()
}
}
}
public Value : object
{
get
{
match (this)
{
| Parsed as x => "ParserValue(" + x.value + ")"
| Ast as x when x.Id == 0 => "<Root>"
| Ast as x => x.typeName + " \"" + x.str + "\""
| Symbol as x => x.name
| Object as x => x.str
| AstList as x => "Count=" + x.Count
| Seq as x => "Count=" + x.Count
| String as x => "\"" + x.value + "\""
| Int16 as x => x.value.ToString()
| Int32 as x => x.value.ToString()
| Int64 as x => x.value.ToString()
| Char as x => x.value.ToString()
| SByte as x => x.value.ToString()
| UInt16 as x => x.value.ToString()
| UInt32 as x => x.value.ToString()
| UInt64 as x => x.value.ToString()
| Byte as x => x.value.ToString()
| Single as x => x.value.ToString()
| Double as x => x.value.ToString()
| Boolean as x => x.value.ToString()
| Unknown as x => "Unknown<" + x.str + ">"
| Null => "<null>"
| NotEvaluated => "<not evaluated>"
| _ => null
}
}
}
public TypeFullName : string
{
get
{
match (this)
{
| Parsed as x => "ParserValue<" + x.value.TypeFullName + ">"
| Ast as x when x.Id == 0 => "Ast"
| Ast as x => x.typeFullName
| Symbol as x => x.typeFullName
| Object as x => x.typeFullName
| AstList => "AstList"
| Seq => "Seq"
| String => "String"
| Int16 => "Int16"
| Int32 => "Int32"
| Int64 => "Int64"
| Char => "Char"
| SByte => "SByte"
| UInt16 => "UInt16"
| UInt32 => "UInt32"
| UInt64 => "UInt64"
| Byte => "Byte"
| Single => "Single"
| Double => "Double"
| Boolean => "Boolean"
| Unknown => ""
| _ => ""
}
}
}
public SetContent(content : ContentDescriptor) : void
{
| Members(members) =>
match (this)
{
| Ast as x => x.members = members;
| Symbol as x => x.members = members;
| Object as x => x.members = members;
| _ => assert(false);
}
| Items(items) =>
match (this)
{
| AstList as x => x.items = items;
| Seq as x => x.items = items;
| _ => assert(false);
}
| AstItems(members, items) =>
match (this)
{
| AstList as x => x.members = members; x.items = items;
| _ => assert(false);
}
| Fail => ()
}
public override ToString() : string
{
match (Value)
{
| null => "<null>"
| x => x.ToString()
}
}
}
[NitraMessage]
public class PropertyDescriptor
{
public Kind : PropertyKind;
public Name : string;
public Object : ObjectDescriptor;
public override ToString() : string
{
def prefix =
match (Kind)
{
| PropertyKind.DependentIn => "in "
| PropertyKind.DependentOut => "out "
| PropertyKind.DependentInOut => "inout "
| PropertyKind.Ast => "ast "
| PropertyKind.Simple => null
};
prefix + Name + " " + Object
}
}
[NitraMessage]
[StructuralEquality]
public struct MatchBrackets
{
public Open : NSpan;
public Close : NSpan;
}
[Record]
[StructuralEquality]
public struct SolutionId
{
public static Invalid : SolutionId = SolutionId(-1);
public Value : int;
public Serialize(writer : BinaryWriter) : void { writer.Write(Value); }
public static new Deserialize(reader : BinaryReader) : SolutionId { SolutionId(reader.ReadInt32()) }
public static @:(x : SolutionId) : int { x.Value }
public static @>=(x : SolutionId, y : SolutionId) : bool { x.Value >= y.Value }
public static @<=(x : SolutionId, y : SolutionId) : bool { x.Value <= y.Value }
public override ToString() : string { Value.ToString() }
}
[Record]
[StructuralEquality]
public struct ProjectId
{
public static Invalid : ProjectId = ProjectId(-1);
public Value : int;
public Serialize(writer : BinaryWriter) : void { writer.Write(Value); }
public static new Deserialize(reader : BinaryReader) : ProjectId { ProjectId(reader.ReadInt32()) }
public static @:(x : ProjectId) : int { x.Value }
public static @>=(x : ProjectId, y : ProjectId) : bool { x.Value >= y.Value }
public static @<=(x : ProjectId, y : ProjectId) : bool { x.Value <= y.Value }
public override ToString() : string { Value.ToString() }
}
[Record]
[StructuralEquality]
public struct FileId
{
public static Invalid : FileId = FileId(-1);
public Value : int;
public Serialize(writer : BinaryWriter) : void { writer.Write(Value); }
public static new Deserialize(reader : BinaryReader) : FileId { FileId(reader.ReadInt32()) }
public IsValid : bool { get { Value >= 0 } }
public static @:(x : FileId) : int { x.Value }
public static @>=(x : FileId, y : FileId) : bool { x.Value >= y.Value }
public static @<=(x : FileId, y : FileId) : bool { x.Value <= y.Value }
public override ToString() : string { Value.ToString() }
}
[Record]
[StructuralEquality]
public struct FileVersion
{
public static Invalid : FileVersion = FileVersion(-1);
public Value : int;
public IsInvalid : bool { get { Value < 0 } }
public Serialize(writer : BinaryWriter) : void { writer.Write(Value); }
public static new Deserialize(reader : BinaryReader) : FileVersion { FileVersion(reader.ReadInt32()) }
public static @:(x : FileVersion) : int { x.Value }
public static @>=(x : FileVersion, y : FileVersion) : bool { x.Value >= y.Value }
public static @<=(x : FileVersion, y : FileVersion) : bool { x.Value <= y.Value }
public override ToString() : string { Value.ToString() }
}
[NitraMessage]
[StructuralEquality]
public struct VersionedPos
{
public static Invalid : VersionedPos = VersionedPos(-1, FileVersion(-1));
public Pos : int;
public Version : FileVersion;
public IsInvalid : bool { get { Pos < 0 || Version.IsInvalid } }
public override ToString() : string { if (IsInvalid) "<VersionedPos.Invalid>" else ("VersionedPos(" + Pos + ", " + Version + ")") }
}
}