@herb-tools/core 0.8.10 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/herb-core.browser.js +22728 -320
  2. package/dist/herb-core.browser.js.map +1 -1
  3. package/dist/herb-core.cjs +22815 -321
  4. package/dist/herb-core.cjs.map +1 -1
  5. package/dist/herb-core.esm.js +22728 -320
  6. package/dist/herb-core.esm.js.map +1 -1
  7. package/dist/herb-core.umd.js +22815 -321
  8. package/dist/herb-core.umd.js.map +1 -1
  9. package/dist/types/ast-utils.d.ts +185 -4
  10. package/dist/types/backend.d.ts +6 -6
  11. package/dist/types/diagnostic.d.ts +6 -0
  12. package/dist/types/errors.d.ts +390 -25
  13. package/dist/types/extract-ruby-options.d.ts +6 -0
  14. package/dist/types/herb-backend.d.ts +15 -7
  15. package/dist/types/index.d.ts +2 -0
  16. package/dist/types/node-type-guards.d.ts +113 -32
  17. package/dist/types/nodes.d.ts +465 -49
  18. package/dist/types/parse-result.d.ts +7 -1
  19. package/dist/types/parser-options.d.ts +33 -2
  20. package/dist/types/prism/index.d.ts +28 -0
  21. package/dist/types/prism/inspect.d.ts +3 -0
  22. package/dist/types/util.d.ts +0 -1
  23. package/dist/types/visitor.d.ts +19 -1
  24. package/package.json +4 -1
  25. package/src/ast-utils.ts +564 -8
  26. package/src/backend.ts +7 -7
  27. package/src/diagnostic.ts +7 -0
  28. package/src/errors.ts +1221 -76
  29. package/src/extract-ruby-options.ts +11 -0
  30. package/src/herb-backend.ts +30 -15
  31. package/src/index.ts +2 -0
  32. package/src/node-type-guards.ts +281 -33
  33. package/src/nodes.ts +1309 -100
  34. package/src/parse-result.ts +11 -0
  35. package/src/parser-options.ts +62 -2
  36. package/src/prism/index.ts +44 -0
  37. package/src/prism/inspect.ts +118 -0
  38. package/src/util.ts +0 -12
  39. package/src/visitor.ts +66 -1
package/src/errors.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.10/templates/javascript/packages/core/src/errors.ts.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.9.1/templates/javascript/packages/core/src/errors.ts.erb
3
3
 
4
4
  import { Location, SerializedLocation } from "./location.js"
5
+ import { Position, SerializedPosition } from "./position.js"
5
6
  import { Token, SerializedToken } from "./token.js"
6
7
  import { Diagnostic, MonacoDiagnostic } from "./diagnostic.js"
7
8
 
@@ -11,14 +12,31 @@ export type HerbErrorType =
11
12
  | "MISSING_OPENING_TAG_ERROR"
12
13
  | "MISSING_CLOSING_TAG_ERROR"
13
14
  | "TAG_NAMES_MISMATCH_ERROR"
14
- | "QUOTES_MISMATCH_ERROR"
15
15
  | "VOID_ELEMENT_CLOSING_TAG_ERROR"
16
16
  | "UNCLOSED_ELEMENT_ERROR"
17
17
  | "RUBY_PARSE_ERROR"
18
18
  | "ERB_CONTROL_FLOW_SCOPE_ERROR"
19
- | "MISSINGERB_END_TAG_ERROR"
19
+ | "MISSING_ERB_END_TAG_ERROR"
20
20
  | "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR"
21
21
  | "ERB_CASE_WITH_CONDITIONS_ERROR"
22
+ | "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR"
23
+ | "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR"
24
+ | "INVALID_COMMENT_CLOSING_TAG_ERROR"
25
+ | "OMITTED_CLOSING_TAG_ERROR"
26
+ | "UNCLOSED_OPEN_TAG_ERROR"
27
+ | "UNCLOSED_CLOSE_TAG_ERROR"
28
+ | "UNCLOSED_QUOTE_ERROR"
29
+ | "MISSING_ATTRIBUTE_VALUE_ERROR"
30
+ | "UNCLOSED_ERB_TAG_ERROR"
31
+ | "STRAY_ERB_CLOSING_TAG_ERROR"
32
+ | "NESTED_ERB_TAG_ERROR"
33
+ | "RENDER_AMBIGUOUS_LOCALS_ERROR"
34
+ | "RENDER_MISSING_LOCALS_ERROR"
35
+ | "RENDER_NO_ARGUMENTS_ERROR"
36
+ | "RENDER_CONFLICTING_PARTIAL_ERROR"
37
+ | "RENDER_INVALID_AS_OPTION_ERROR"
38
+ | "RENDER_OBJECT_AND_COLLECTION_ERROR"
39
+ | "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR"
22
40
 
23
41
  export type SerializedErrorType = string
24
42
 
@@ -402,75 +420,6 @@ export class TagNamesMismatchError extends HerbError {
402
420
  }
403
421
  }
404
422
 
405
- export interface SerializedQuotesMismatchError {
406
- type: "QUOTES_MISMATCH_ERROR";
407
- message: string;
408
- location: SerializedLocation;
409
- opening_quote: SerializedToken | null;
410
- closing_quote: SerializedToken | null;
411
- }
412
-
413
- export interface QuotesMismatchErrorProps {
414
- type: string;
415
- message: string;
416
- location: Location;
417
- opening_quote: Token | null;
418
- closing_quote: Token | null;
419
- }
420
-
421
- export class QuotesMismatchError extends HerbError {
422
- readonly opening_quote: Token | null;
423
- readonly closing_quote: Token | null;
424
-
425
- static from(data: SerializedQuotesMismatchError): QuotesMismatchError {
426
- return new QuotesMismatchError({
427
- type: data.type,
428
- message: data.message,
429
- location: Location.from(data.location),
430
- opening_quote: data.opening_quote ? Token.from(data.opening_quote) : null,
431
- closing_quote: data.closing_quote ? Token.from(data.closing_quote) : null,
432
- })
433
- }
434
-
435
- constructor(props: QuotesMismatchErrorProps) {
436
- super(props.type, props.message, props.location);
437
-
438
- this.opening_quote = props.opening_quote;
439
- this.closing_quote = props.closing_quote;
440
- }
441
-
442
- toJSON(): SerializedQuotesMismatchError {
443
- return {
444
- ...super.toJSON(),
445
- type: "QUOTES_MISMATCH_ERROR",
446
- opening_quote: this.opening_quote ? this.opening_quote.toJSON() : null,
447
- closing_quote: this.closing_quote ? this.closing_quote.toJSON() : null,
448
- };
449
- }
450
-
451
- toMonacoDiagnostic(): MonacoDiagnostic {
452
- return {
453
- line: this.location.start.line,
454
- column: this.location.start.column,
455
- endLine: this.location.end.line,
456
- endColumn: this.location.end.column,
457
- message: this.message,
458
- severity: 'error'
459
- }
460
- }
461
-
462
- treeInspect(): string {
463
- let output = "";
464
-
465
- output += `@ QuotesMismatchError ${this.location.treeInspectWithLabel()}\n`;
466
- output += `├── message: "${this.message}"\n`;
467
- output += `├── opening_quote: ${this.opening_quote ? this.opening_quote.treeInspect() : "∅"}\n`;
468
- output += `└── closing_quote: ${this.closing_quote ? this.closing_quote.treeInspect() : "∅"}\n`;
469
-
470
- return output;
471
- }
472
- }
473
-
474
423
  export interface SerializedVoidElementClosingTagError {
475
424
  type: "VOID_ELEMENT_CLOSING_TAG_ERROR";
476
425
  message: string;
@@ -748,7 +697,7 @@ export class ERBControlFlowScopeError extends HerbError {
748
697
  }
749
698
 
750
699
  export interface SerializedMissingERBEndTagError {
751
- type: "MISSINGERB_END_TAG_ERROR";
700
+ type: "MISSING_ERB_END_TAG_ERROR";
752
701
  message: string;
753
702
  location: SerializedLocation;
754
703
  keyword: string;
@@ -782,7 +731,7 @@ export class MissingERBEndTagError extends HerbError {
782
731
  toJSON(): SerializedMissingERBEndTagError {
783
732
  return {
784
733
  ...super.toJSON(),
785
- type: "MISSINGERB_END_TAG_ERROR",
734
+ type: "MISSING_ERB_END_TAG_ERROR",
786
735
  keyword: this.keyword,
787
736
  };
788
737
  }
@@ -919,6 +868,1185 @@ export class ERBCaseWithConditionsError extends HerbError {
919
868
  }
920
869
  }
921
870
 
871
+ export interface SerializedConditionalElementMultipleTagsError {
872
+ type: "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR";
873
+ message: string;
874
+ location: SerializedLocation;
875
+ line: any; // #<Herb::Template::SizeTField:0x000000011e9df368 @name="line", @options={kind: nil}>
876
+ column: any; // #<Herb::Template::SizeTField:0x000000011e9df160 @name="column", @options={kind: nil}>
877
+ }
878
+
879
+ export interface ConditionalElementMultipleTagsErrorProps {
880
+ type: string;
881
+ message: string;
882
+ location: Location;
883
+ line: any; // #<Herb::Template::SizeTField:0x000000011e9df368 @name="line", @options={kind: nil}>
884
+ column: any; // #<Herb::Template::SizeTField:0x000000011e9df160 @name="column", @options={kind: nil}>
885
+ }
886
+
887
+ export class ConditionalElementMultipleTagsError extends HerbError {
888
+ readonly line: any;
889
+ readonly column: any;
890
+
891
+ static from(data: SerializedConditionalElementMultipleTagsError): ConditionalElementMultipleTagsError {
892
+ return new ConditionalElementMultipleTagsError({
893
+ type: data.type,
894
+ message: data.message,
895
+ location: Location.from(data.location),
896
+ line: data.line,
897
+ column: data.column,
898
+ })
899
+ }
900
+
901
+ constructor(props: ConditionalElementMultipleTagsErrorProps) {
902
+ super(props.type, props.message, props.location);
903
+
904
+ this.line = props.line;
905
+ this.column = props.column;
906
+ }
907
+
908
+ toJSON(): SerializedConditionalElementMultipleTagsError {
909
+ return {
910
+ ...super.toJSON(),
911
+ type: "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR",
912
+ line: this.line,
913
+ column: this.column,
914
+ };
915
+ }
916
+
917
+ toMonacoDiagnostic(): MonacoDiagnostic {
918
+ return {
919
+ line: this.location.start.line,
920
+ column: this.location.start.column,
921
+ endLine: this.location.end.line,
922
+ endColumn: this.location.end.column,
923
+ message: this.message,
924
+ severity: 'error'
925
+ }
926
+ }
927
+
928
+ treeInspect(): string {
929
+ let output = "";
930
+
931
+ output += `@ ConditionalElementMultipleTagsError ${this.location.treeInspectWithLabel()}\n`;
932
+ output += `├── message: "${this.message}"\n`;
933
+ output += `├── line: ${JSON.stringify(this.line)}\n`;
934
+ output += `└── column: ${JSON.stringify(this.column)}\n`;
935
+
936
+ return output;
937
+ }
938
+ }
939
+
940
+ export interface SerializedConditionalElementConditionMismatchError {
941
+ type: "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR";
942
+ message: string;
943
+ location: SerializedLocation;
944
+ tag_name: string;
945
+ open_condition: string;
946
+ open_line: any; // #<Herb::Template::SizeTField:0x000000011e9deb70 @name="open_line", @options={kind: nil}>
947
+ open_column: any; // #<Herb::Template::SizeTField:0x000000011e9deb48 @name="open_column", @options={kind: nil}>
948
+ close_condition: string;
949
+ close_line: any; // #<Herb::Template::SizeTField:0x000000011e9deaf8 @name="close_line", @options={kind: nil}>
950
+ close_column: any; // #<Herb::Template::SizeTField:0x000000011e9de990 @name="close_column", @options={kind: nil}>
951
+ }
952
+
953
+ export interface ConditionalElementConditionMismatchErrorProps {
954
+ type: string;
955
+ message: string;
956
+ location: Location;
957
+ tag_name: string;
958
+ open_condition: string;
959
+ open_line: any; // #<Herb::Template::SizeTField:0x000000011e9deb70 @name="open_line", @options={kind: nil}>
960
+ open_column: any; // #<Herb::Template::SizeTField:0x000000011e9deb48 @name="open_column", @options={kind: nil}>
961
+ close_condition: string;
962
+ close_line: any; // #<Herb::Template::SizeTField:0x000000011e9deaf8 @name="close_line", @options={kind: nil}>
963
+ close_column: any; // #<Herb::Template::SizeTField:0x000000011e9de990 @name="close_column", @options={kind: nil}>
964
+ }
965
+
966
+ export class ConditionalElementConditionMismatchError extends HerbError {
967
+ readonly tag_name: string;
968
+ readonly open_condition: string;
969
+ readonly open_line: any;
970
+ readonly open_column: any;
971
+ readonly close_condition: string;
972
+ readonly close_line: any;
973
+ readonly close_column: any;
974
+
975
+ static from(data: SerializedConditionalElementConditionMismatchError): ConditionalElementConditionMismatchError {
976
+ return new ConditionalElementConditionMismatchError({
977
+ type: data.type,
978
+ message: data.message,
979
+ location: Location.from(data.location),
980
+ tag_name: data.tag_name,
981
+ open_condition: data.open_condition,
982
+ open_line: data.open_line,
983
+ open_column: data.open_column,
984
+ close_condition: data.close_condition,
985
+ close_line: data.close_line,
986
+ close_column: data.close_column,
987
+ })
988
+ }
989
+
990
+ constructor(props: ConditionalElementConditionMismatchErrorProps) {
991
+ super(props.type, props.message, props.location);
992
+
993
+ this.tag_name = props.tag_name;
994
+ this.open_condition = props.open_condition;
995
+ this.open_line = props.open_line;
996
+ this.open_column = props.open_column;
997
+ this.close_condition = props.close_condition;
998
+ this.close_line = props.close_line;
999
+ this.close_column = props.close_column;
1000
+ }
1001
+
1002
+ toJSON(): SerializedConditionalElementConditionMismatchError {
1003
+ return {
1004
+ ...super.toJSON(),
1005
+ type: "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR",
1006
+ tag_name: this.tag_name,
1007
+ open_condition: this.open_condition,
1008
+ open_line: this.open_line,
1009
+ open_column: this.open_column,
1010
+ close_condition: this.close_condition,
1011
+ close_line: this.close_line,
1012
+ close_column: this.close_column,
1013
+ };
1014
+ }
1015
+
1016
+ toMonacoDiagnostic(): MonacoDiagnostic {
1017
+ return {
1018
+ line: this.location.start.line,
1019
+ column: this.location.start.column,
1020
+ endLine: this.location.end.line,
1021
+ endColumn: this.location.end.column,
1022
+ message: this.message,
1023
+ severity: 'error'
1024
+ }
1025
+ }
1026
+
1027
+ treeInspect(): string {
1028
+ let output = "";
1029
+
1030
+ output += `@ ConditionalElementConditionMismatchError ${this.location.treeInspectWithLabel()}\n`;
1031
+ output += `├── message: "${this.message}"\n`;
1032
+ output += `├── tag_name: ${JSON.stringify(this.tag_name)}\n`;
1033
+ output += `├── open_condition: ${JSON.stringify(this.open_condition)}\n`;
1034
+ output += `├── open_line: ${JSON.stringify(this.open_line)}\n`;
1035
+ output += `├── open_column: ${JSON.stringify(this.open_column)}\n`;
1036
+ output += `├── close_condition: ${JSON.stringify(this.close_condition)}\n`;
1037
+ output += `├── close_line: ${JSON.stringify(this.close_line)}\n`;
1038
+ output += `└── close_column: ${JSON.stringify(this.close_column)}\n`;
1039
+
1040
+ return output;
1041
+ }
1042
+ }
1043
+
1044
+ export interface SerializedInvalidCommentClosingTagError {
1045
+ type: "INVALID_COMMENT_CLOSING_TAG_ERROR";
1046
+ message: string;
1047
+ location: SerializedLocation;
1048
+ closing_tag: SerializedToken | null;
1049
+ }
1050
+
1051
+ export interface InvalidCommentClosingTagErrorProps {
1052
+ type: string;
1053
+ message: string;
1054
+ location: Location;
1055
+ closing_tag: Token | null;
1056
+ }
1057
+
1058
+ export class InvalidCommentClosingTagError extends HerbError {
1059
+ readonly closing_tag: Token | null;
1060
+
1061
+ static from(data: SerializedInvalidCommentClosingTagError): InvalidCommentClosingTagError {
1062
+ return new InvalidCommentClosingTagError({
1063
+ type: data.type,
1064
+ message: data.message,
1065
+ location: Location.from(data.location),
1066
+ closing_tag: data.closing_tag ? Token.from(data.closing_tag) : null,
1067
+ })
1068
+ }
1069
+
1070
+ constructor(props: InvalidCommentClosingTagErrorProps) {
1071
+ super(props.type, props.message, props.location);
1072
+
1073
+ this.closing_tag = props.closing_tag;
1074
+ }
1075
+
1076
+ toJSON(): SerializedInvalidCommentClosingTagError {
1077
+ return {
1078
+ ...super.toJSON(),
1079
+ type: "INVALID_COMMENT_CLOSING_TAG_ERROR",
1080
+ closing_tag: this.closing_tag ? this.closing_tag.toJSON() : null,
1081
+ };
1082
+ }
1083
+
1084
+ toMonacoDiagnostic(): MonacoDiagnostic {
1085
+ return {
1086
+ line: this.location.start.line,
1087
+ column: this.location.start.column,
1088
+ endLine: this.location.end.line,
1089
+ endColumn: this.location.end.column,
1090
+ message: this.message,
1091
+ severity: 'error'
1092
+ }
1093
+ }
1094
+
1095
+ treeInspect(): string {
1096
+ let output = "";
1097
+
1098
+ output += `@ InvalidCommentClosingTagError ${this.location.treeInspectWithLabel()}\n`;
1099
+ output += `├── message: "${this.message}"\n`;
1100
+ output += `└── closing_tag: ${this.closing_tag ? this.closing_tag.treeInspect() : "∅"}\n`;
1101
+
1102
+ return output;
1103
+ }
1104
+ }
1105
+
1106
+ export interface SerializedOmittedClosingTagError {
1107
+ type: "OMITTED_CLOSING_TAG_ERROR";
1108
+ message: string;
1109
+ location: SerializedLocation;
1110
+ opening_tag: SerializedToken | null;
1111
+ insertion_point: SerializedPosition;
1112
+ }
1113
+
1114
+ export interface OmittedClosingTagErrorProps {
1115
+ type: string;
1116
+ message: string;
1117
+ location: Location;
1118
+ opening_tag: Token | null;
1119
+ insertion_point: Position;
1120
+ }
1121
+
1122
+ export class OmittedClosingTagError extends HerbError {
1123
+ readonly opening_tag: Token | null;
1124
+ readonly insertion_point: Position;
1125
+
1126
+ static from(data: SerializedOmittedClosingTagError): OmittedClosingTagError {
1127
+ return new OmittedClosingTagError({
1128
+ type: data.type,
1129
+ message: data.message,
1130
+ location: Location.from(data.location),
1131
+ opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null,
1132
+ insertion_point: Position.from(data.insertion_point),
1133
+ })
1134
+ }
1135
+
1136
+ constructor(props: OmittedClosingTagErrorProps) {
1137
+ super(props.type, props.message, props.location);
1138
+
1139
+ this.opening_tag = props.opening_tag;
1140
+ this.insertion_point = props.insertion_point;
1141
+ }
1142
+
1143
+ toJSON(): SerializedOmittedClosingTagError {
1144
+ return {
1145
+ ...super.toJSON(),
1146
+ type: "OMITTED_CLOSING_TAG_ERROR",
1147
+ opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null,
1148
+ insertion_point: this.insertion_point.toJSON(),
1149
+ };
1150
+ }
1151
+
1152
+ toMonacoDiagnostic(): MonacoDiagnostic {
1153
+ return {
1154
+ line: this.location.start.line,
1155
+ column: this.location.start.column,
1156
+ endLine: this.location.end.line,
1157
+ endColumn: this.location.end.column,
1158
+ message: this.message,
1159
+ severity: 'error'
1160
+ }
1161
+ }
1162
+
1163
+ treeInspect(): string {
1164
+ let output = "";
1165
+
1166
+ output += `@ OmittedClosingTagError ${this.location.treeInspectWithLabel()}\n`;
1167
+ output += `├── message: "${this.message}"\n`;
1168
+ output += `├── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`;
1169
+ output += `└── insertion_point: (${this.insertion_point.line}:${this.insertion_point.column})\n`;
1170
+
1171
+ return output;
1172
+ }
1173
+ }
1174
+
1175
+ export interface SerializedUnclosedOpenTagError {
1176
+ type: "UNCLOSED_OPEN_TAG_ERROR";
1177
+ message: string;
1178
+ location: SerializedLocation;
1179
+ tag_name: SerializedToken | null;
1180
+ }
1181
+
1182
+ export interface UnclosedOpenTagErrorProps {
1183
+ type: string;
1184
+ message: string;
1185
+ location: Location;
1186
+ tag_name: Token | null;
1187
+ }
1188
+
1189
+ export class UnclosedOpenTagError extends HerbError {
1190
+ readonly tag_name: Token | null;
1191
+
1192
+ static from(data: SerializedUnclosedOpenTagError): UnclosedOpenTagError {
1193
+ return new UnclosedOpenTagError({
1194
+ type: data.type,
1195
+ message: data.message,
1196
+ location: Location.from(data.location),
1197
+ tag_name: data.tag_name ? Token.from(data.tag_name) : null,
1198
+ })
1199
+ }
1200
+
1201
+ constructor(props: UnclosedOpenTagErrorProps) {
1202
+ super(props.type, props.message, props.location);
1203
+
1204
+ this.tag_name = props.tag_name;
1205
+ }
1206
+
1207
+ toJSON(): SerializedUnclosedOpenTagError {
1208
+ return {
1209
+ ...super.toJSON(),
1210
+ type: "UNCLOSED_OPEN_TAG_ERROR",
1211
+ tag_name: this.tag_name ? this.tag_name.toJSON() : null,
1212
+ };
1213
+ }
1214
+
1215
+ toMonacoDiagnostic(): MonacoDiagnostic {
1216
+ return {
1217
+ line: this.location.start.line,
1218
+ column: this.location.start.column,
1219
+ endLine: this.location.end.line,
1220
+ endColumn: this.location.end.column,
1221
+ message: this.message,
1222
+ severity: 'error'
1223
+ }
1224
+ }
1225
+
1226
+ treeInspect(): string {
1227
+ let output = "";
1228
+
1229
+ output += `@ UnclosedOpenTagError ${this.location.treeInspectWithLabel()}\n`;
1230
+ output += `├── message: "${this.message}"\n`;
1231
+ output += `└── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`;
1232
+
1233
+ return output;
1234
+ }
1235
+ }
1236
+
1237
+ export interface SerializedUnclosedCloseTagError {
1238
+ type: "UNCLOSED_CLOSE_TAG_ERROR";
1239
+ message: string;
1240
+ location: SerializedLocation;
1241
+ tag_name: SerializedToken | null;
1242
+ }
1243
+
1244
+ export interface UnclosedCloseTagErrorProps {
1245
+ type: string;
1246
+ message: string;
1247
+ location: Location;
1248
+ tag_name: Token | null;
1249
+ }
1250
+
1251
+ export class UnclosedCloseTagError extends HerbError {
1252
+ readonly tag_name: Token | null;
1253
+
1254
+ static from(data: SerializedUnclosedCloseTagError): UnclosedCloseTagError {
1255
+ return new UnclosedCloseTagError({
1256
+ type: data.type,
1257
+ message: data.message,
1258
+ location: Location.from(data.location),
1259
+ tag_name: data.tag_name ? Token.from(data.tag_name) : null,
1260
+ })
1261
+ }
1262
+
1263
+ constructor(props: UnclosedCloseTagErrorProps) {
1264
+ super(props.type, props.message, props.location);
1265
+
1266
+ this.tag_name = props.tag_name;
1267
+ }
1268
+
1269
+ toJSON(): SerializedUnclosedCloseTagError {
1270
+ return {
1271
+ ...super.toJSON(),
1272
+ type: "UNCLOSED_CLOSE_TAG_ERROR",
1273
+ tag_name: this.tag_name ? this.tag_name.toJSON() : null,
1274
+ };
1275
+ }
1276
+
1277
+ toMonacoDiagnostic(): MonacoDiagnostic {
1278
+ return {
1279
+ line: this.location.start.line,
1280
+ column: this.location.start.column,
1281
+ endLine: this.location.end.line,
1282
+ endColumn: this.location.end.column,
1283
+ message: this.message,
1284
+ severity: 'error'
1285
+ }
1286
+ }
1287
+
1288
+ treeInspect(): string {
1289
+ let output = "";
1290
+
1291
+ output += `@ UnclosedCloseTagError ${this.location.treeInspectWithLabel()}\n`;
1292
+ output += `├── message: "${this.message}"\n`;
1293
+ output += `└── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`;
1294
+
1295
+ return output;
1296
+ }
1297
+ }
1298
+
1299
+ export interface SerializedUnclosedQuoteError {
1300
+ type: "UNCLOSED_QUOTE_ERROR";
1301
+ message: string;
1302
+ location: SerializedLocation;
1303
+ opening_quote: SerializedToken | null;
1304
+ }
1305
+
1306
+ export interface UnclosedQuoteErrorProps {
1307
+ type: string;
1308
+ message: string;
1309
+ location: Location;
1310
+ opening_quote: Token | null;
1311
+ }
1312
+
1313
+ export class UnclosedQuoteError extends HerbError {
1314
+ readonly opening_quote: Token | null;
1315
+
1316
+ static from(data: SerializedUnclosedQuoteError): UnclosedQuoteError {
1317
+ return new UnclosedQuoteError({
1318
+ type: data.type,
1319
+ message: data.message,
1320
+ location: Location.from(data.location),
1321
+ opening_quote: data.opening_quote ? Token.from(data.opening_quote) : null,
1322
+ })
1323
+ }
1324
+
1325
+ constructor(props: UnclosedQuoteErrorProps) {
1326
+ super(props.type, props.message, props.location);
1327
+
1328
+ this.opening_quote = props.opening_quote;
1329
+ }
1330
+
1331
+ toJSON(): SerializedUnclosedQuoteError {
1332
+ return {
1333
+ ...super.toJSON(),
1334
+ type: "UNCLOSED_QUOTE_ERROR",
1335
+ opening_quote: this.opening_quote ? this.opening_quote.toJSON() : null,
1336
+ };
1337
+ }
1338
+
1339
+ toMonacoDiagnostic(): MonacoDiagnostic {
1340
+ return {
1341
+ line: this.location.start.line,
1342
+ column: this.location.start.column,
1343
+ endLine: this.location.end.line,
1344
+ endColumn: this.location.end.column,
1345
+ message: this.message,
1346
+ severity: 'error'
1347
+ }
1348
+ }
1349
+
1350
+ treeInspect(): string {
1351
+ let output = "";
1352
+
1353
+ output += `@ UnclosedQuoteError ${this.location.treeInspectWithLabel()}\n`;
1354
+ output += `├── message: "${this.message}"\n`;
1355
+ output += `└── opening_quote: ${this.opening_quote ? this.opening_quote.treeInspect() : "∅"}\n`;
1356
+
1357
+ return output;
1358
+ }
1359
+ }
1360
+
1361
+ export interface SerializedMissingAttributeValueError {
1362
+ type: "MISSING_ATTRIBUTE_VALUE_ERROR";
1363
+ message: string;
1364
+ location: SerializedLocation;
1365
+ attribute_name: string;
1366
+ }
1367
+
1368
+ export interface MissingAttributeValueErrorProps {
1369
+ type: string;
1370
+ message: string;
1371
+ location: Location;
1372
+ attribute_name: string;
1373
+ }
1374
+
1375
+ export class MissingAttributeValueError extends HerbError {
1376
+ readonly attribute_name: string;
1377
+
1378
+ static from(data: SerializedMissingAttributeValueError): MissingAttributeValueError {
1379
+ return new MissingAttributeValueError({
1380
+ type: data.type,
1381
+ message: data.message,
1382
+ location: Location.from(data.location),
1383
+ attribute_name: data.attribute_name,
1384
+ })
1385
+ }
1386
+
1387
+ constructor(props: MissingAttributeValueErrorProps) {
1388
+ super(props.type, props.message, props.location);
1389
+
1390
+ this.attribute_name = props.attribute_name;
1391
+ }
1392
+
1393
+ toJSON(): SerializedMissingAttributeValueError {
1394
+ return {
1395
+ ...super.toJSON(),
1396
+ type: "MISSING_ATTRIBUTE_VALUE_ERROR",
1397
+ attribute_name: this.attribute_name,
1398
+ };
1399
+ }
1400
+
1401
+ toMonacoDiagnostic(): MonacoDiagnostic {
1402
+ return {
1403
+ line: this.location.start.line,
1404
+ column: this.location.start.column,
1405
+ endLine: this.location.end.line,
1406
+ endColumn: this.location.end.column,
1407
+ message: this.message,
1408
+ severity: 'error'
1409
+ }
1410
+ }
1411
+
1412
+ treeInspect(): string {
1413
+ let output = "";
1414
+
1415
+ output += `@ MissingAttributeValueError ${this.location.treeInspectWithLabel()}\n`;
1416
+ output += `├── message: "${this.message}"\n`;
1417
+ output += `└── attribute_name: ${JSON.stringify(this.attribute_name)}\n`;
1418
+
1419
+ return output;
1420
+ }
1421
+ }
1422
+
1423
+ export interface SerializedUnclosedERBTagError {
1424
+ type: "UNCLOSED_ERB_TAG_ERROR";
1425
+ message: string;
1426
+ location: SerializedLocation;
1427
+ opening_tag: SerializedToken | null;
1428
+ }
1429
+
1430
+ export interface UnclosedERBTagErrorProps {
1431
+ type: string;
1432
+ message: string;
1433
+ location: Location;
1434
+ opening_tag: Token | null;
1435
+ }
1436
+
1437
+ export class UnclosedERBTagError extends HerbError {
1438
+ readonly opening_tag: Token | null;
1439
+
1440
+ static from(data: SerializedUnclosedERBTagError): UnclosedERBTagError {
1441
+ return new UnclosedERBTagError({
1442
+ type: data.type,
1443
+ message: data.message,
1444
+ location: Location.from(data.location),
1445
+ opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null,
1446
+ })
1447
+ }
1448
+
1449
+ constructor(props: UnclosedERBTagErrorProps) {
1450
+ super(props.type, props.message, props.location);
1451
+
1452
+ this.opening_tag = props.opening_tag;
1453
+ }
1454
+
1455
+ toJSON(): SerializedUnclosedERBTagError {
1456
+ return {
1457
+ ...super.toJSON(),
1458
+ type: "UNCLOSED_ERB_TAG_ERROR",
1459
+ opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null,
1460
+ };
1461
+ }
1462
+
1463
+ toMonacoDiagnostic(): MonacoDiagnostic {
1464
+ return {
1465
+ line: this.location.start.line,
1466
+ column: this.location.start.column,
1467
+ endLine: this.location.end.line,
1468
+ endColumn: this.location.end.column,
1469
+ message: this.message,
1470
+ severity: 'error'
1471
+ }
1472
+ }
1473
+
1474
+ treeInspect(): string {
1475
+ let output = "";
1476
+
1477
+ output += `@ UnclosedERBTagError ${this.location.treeInspectWithLabel()}\n`;
1478
+ output += `├── message: "${this.message}"\n`;
1479
+ output += `└── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`;
1480
+
1481
+ return output;
1482
+ }
1483
+ }
1484
+
1485
+ export interface SerializedStrayERBClosingTagError {
1486
+ type: "STRAY_ERB_CLOSING_TAG_ERROR";
1487
+ message: string;
1488
+ location: SerializedLocation;
1489
+ }
1490
+
1491
+ export interface StrayERBClosingTagErrorProps {
1492
+ type: string;
1493
+ message: string;
1494
+ location: Location;
1495
+ }
1496
+
1497
+ export class StrayERBClosingTagError extends HerbError {
1498
+
1499
+ static from(data: SerializedStrayERBClosingTagError): StrayERBClosingTagError {
1500
+ return new StrayERBClosingTagError({
1501
+ type: data.type,
1502
+ message: data.message,
1503
+ location: Location.from(data.location),
1504
+ })
1505
+ }
1506
+
1507
+ constructor(props: StrayERBClosingTagErrorProps) {
1508
+ super(props.type, props.message, props.location);
1509
+
1510
+ }
1511
+
1512
+ toJSON(): SerializedStrayERBClosingTagError {
1513
+ return {
1514
+ ...super.toJSON(),
1515
+ type: "STRAY_ERB_CLOSING_TAG_ERROR",
1516
+ };
1517
+ }
1518
+
1519
+ toMonacoDiagnostic(): MonacoDiagnostic {
1520
+ return {
1521
+ line: this.location.start.line,
1522
+ column: this.location.start.column,
1523
+ endLine: this.location.end.line,
1524
+ endColumn: this.location.end.column,
1525
+ message: this.message,
1526
+ severity: 'error'
1527
+ }
1528
+ }
1529
+
1530
+ treeInspect(): string {
1531
+ let output = "";
1532
+
1533
+ output += `@ StrayERBClosingTagError ${this.location.treeInspectWithLabel()}\n`;
1534
+ output += `└── message: "${this.message}"\n`;
1535
+
1536
+ return output;
1537
+ }
1538
+ }
1539
+
1540
+ export interface SerializedNestedERBTagError {
1541
+ type: "NESTED_ERB_TAG_ERROR";
1542
+ message: string;
1543
+ location: SerializedLocation;
1544
+ opening_tag: SerializedToken | null;
1545
+ nested_tag_line: any; // #<Herb::Template::SizeTField:0x000000011e9dac00 @name="nested_tag_line", @options={kind: nil}>
1546
+ nested_tag_column: any; // #<Herb::Template::SizeTField:0x000000011e9dab60 @name="nested_tag_column", @options={kind: nil}>
1547
+ }
1548
+
1549
+ export interface NestedERBTagErrorProps {
1550
+ type: string;
1551
+ message: string;
1552
+ location: Location;
1553
+ opening_tag: Token | null;
1554
+ nested_tag_line: any; // #<Herb::Template::SizeTField:0x000000011e9dac00 @name="nested_tag_line", @options={kind: nil}>
1555
+ nested_tag_column: any; // #<Herb::Template::SizeTField:0x000000011e9dab60 @name="nested_tag_column", @options={kind: nil}>
1556
+ }
1557
+
1558
+ export class NestedERBTagError extends HerbError {
1559
+ readonly opening_tag: Token | null;
1560
+ readonly nested_tag_line: any;
1561
+ readonly nested_tag_column: any;
1562
+
1563
+ static from(data: SerializedNestedERBTagError): NestedERBTagError {
1564
+ return new NestedERBTagError({
1565
+ type: data.type,
1566
+ message: data.message,
1567
+ location: Location.from(data.location),
1568
+ opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null,
1569
+ nested_tag_line: data.nested_tag_line,
1570
+ nested_tag_column: data.nested_tag_column,
1571
+ })
1572
+ }
1573
+
1574
+ constructor(props: NestedERBTagErrorProps) {
1575
+ super(props.type, props.message, props.location);
1576
+
1577
+ this.opening_tag = props.opening_tag;
1578
+ this.nested_tag_line = props.nested_tag_line;
1579
+ this.nested_tag_column = props.nested_tag_column;
1580
+ }
1581
+
1582
+ toJSON(): SerializedNestedERBTagError {
1583
+ return {
1584
+ ...super.toJSON(),
1585
+ type: "NESTED_ERB_TAG_ERROR",
1586
+ opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null,
1587
+ nested_tag_line: this.nested_tag_line,
1588
+ nested_tag_column: this.nested_tag_column,
1589
+ };
1590
+ }
1591
+
1592
+ toMonacoDiagnostic(): MonacoDiagnostic {
1593
+ return {
1594
+ line: this.location.start.line,
1595
+ column: this.location.start.column,
1596
+ endLine: this.location.end.line,
1597
+ endColumn: this.location.end.column,
1598
+ message: this.message,
1599
+ severity: 'error'
1600
+ }
1601
+ }
1602
+
1603
+ treeInspect(): string {
1604
+ let output = "";
1605
+
1606
+ output += `@ NestedERBTagError ${this.location.treeInspectWithLabel()}\n`;
1607
+ output += `├── message: "${this.message}"\n`;
1608
+ output += `├── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`;
1609
+ output += `├── nested_tag_line: ${JSON.stringify(this.nested_tag_line)}\n`;
1610
+ output += `└── nested_tag_column: ${JSON.stringify(this.nested_tag_column)}\n`;
1611
+
1612
+ return output;
1613
+ }
1614
+ }
1615
+
1616
+ export interface SerializedRenderAmbiguousLocalsError {
1617
+ type: "RENDER_AMBIGUOUS_LOCALS_ERROR";
1618
+ message: string;
1619
+ location: SerializedLocation;
1620
+ partial: string;
1621
+ }
1622
+
1623
+ export interface RenderAmbiguousLocalsErrorProps {
1624
+ type: string;
1625
+ message: string;
1626
+ location: Location;
1627
+ partial: string;
1628
+ }
1629
+
1630
+ export class RenderAmbiguousLocalsError extends HerbError {
1631
+ readonly partial: string;
1632
+
1633
+ static from(data: SerializedRenderAmbiguousLocalsError): RenderAmbiguousLocalsError {
1634
+ return new RenderAmbiguousLocalsError({
1635
+ type: data.type,
1636
+ message: data.message,
1637
+ location: Location.from(data.location),
1638
+ partial: data.partial,
1639
+ })
1640
+ }
1641
+
1642
+ constructor(props: RenderAmbiguousLocalsErrorProps) {
1643
+ super(props.type, props.message, props.location);
1644
+
1645
+ this.partial = props.partial;
1646
+ }
1647
+
1648
+ toJSON(): SerializedRenderAmbiguousLocalsError {
1649
+ return {
1650
+ ...super.toJSON(),
1651
+ type: "RENDER_AMBIGUOUS_LOCALS_ERROR",
1652
+ partial: this.partial,
1653
+ };
1654
+ }
1655
+
1656
+ toMonacoDiagnostic(): MonacoDiagnostic {
1657
+ return {
1658
+ line: this.location.start.line,
1659
+ column: this.location.start.column,
1660
+ endLine: this.location.end.line,
1661
+ endColumn: this.location.end.column,
1662
+ message: this.message,
1663
+ severity: 'error'
1664
+ }
1665
+ }
1666
+
1667
+ treeInspect(): string {
1668
+ let output = "";
1669
+
1670
+ output += `@ RenderAmbiguousLocalsError ${this.location.treeInspectWithLabel()}\n`;
1671
+ output += `├── message: "${this.message}"\n`;
1672
+ output += `└── partial: ${JSON.stringify(this.partial)}\n`;
1673
+
1674
+ return output;
1675
+ }
1676
+ }
1677
+
1678
+ export interface SerializedRenderMissingLocalsError {
1679
+ type: "RENDER_MISSING_LOCALS_ERROR";
1680
+ message: string;
1681
+ location: SerializedLocation;
1682
+ partial: string;
1683
+ keywords: string;
1684
+ }
1685
+
1686
+ export interface RenderMissingLocalsErrorProps {
1687
+ type: string;
1688
+ message: string;
1689
+ location: Location;
1690
+ partial: string;
1691
+ keywords: string;
1692
+ }
1693
+
1694
+ export class RenderMissingLocalsError extends HerbError {
1695
+ readonly partial: string;
1696
+ readonly keywords: string;
1697
+
1698
+ static from(data: SerializedRenderMissingLocalsError): RenderMissingLocalsError {
1699
+ return new RenderMissingLocalsError({
1700
+ type: data.type,
1701
+ message: data.message,
1702
+ location: Location.from(data.location),
1703
+ partial: data.partial,
1704
+ keywords: data.keywords,
1705
+ })
1706
+ }
1707
+
1708
+ constructor(props: RenderMissingLocalsErrorProps) {
1709
+ super(props.type, props.message, props.location);
1710
+
1711
+ this.partial = props.partial;
1712
+ this.keywords = props.keywords;
1713
+ }
1714
+
1715
+ toJSON(): SerializedRenderMissingLocalsError {
1716
+ return {
1717
+ ...super.toJSON(),
1718
+ type: "RENDER_MISSING_LOCALS_ERROR",
1719
+ partial: this.partial,
1720
+ keywords: this.keywords,
1721
+ };
1722
+ }
1723
+
1724
+ toMonacoDiagnostic(): MonacoDiagnostic {
1725
+ return {
1726
+ line: this.location.start.line,
1727
+ column: this.location.start.column,
1728
+ endLine: this.location.end.line,
1729
+ endColumn: this.location.end.column,
1730
+ message: this.message,
1731
+ severity: 'error'
1732
+ }
1733
+ }
1734
+
1735
+ treeInspect(): string {
1736
+ let output = "";
1737
+
1738
+ output += `@ RenderMissingLocalsError ${this.location.treeInspectWithLabel()}\n`;
1739
+ output += `├── message: "${this.message}"\n`;
1740
+ output += `├── partial: ${JSON.stringify(this.partial)}\n`;
1741
+ output += `└── keywords: ${JSON.stringify(this.keywords)}\n`;
1742
+
1743
+ return output;
1744
+ }
1745
+ }
1746
+
1747
+ export interface SerializedRenderNoArgumentsError {
1748
+ type: "RENDER_NO_ARGUMENTS_ERROR";
1749
+ message: string;
1750
+ location: SerializedLocation;
1751
+ }
1752
+
1753
+ export interface RenderNoArgumentsErrorProps {
1754
+ type: string;
1755
+ message: string;
1756
+ location: Location;
1757
+ }
1758
+
1759
+ export class RenderNoArgumentsError extends HerbError {
1760
+
1761
+ static from(data: SerializedRenderNoArgumentsError): RenderNoArgumentsError {
1762
+ return new RenderNoArgumentsError({
1763
+ type: data.type,
1764
+ message: data.message,
1765
+ location: Location.from(data.location),
1766
+ })
1767
+ }
1768
+
1769
+ constructor(props: RenderNoArgumentsErrorProps) {
1770
+ super(props.type, props.message, props.location);
1771
+
1772
+ }
1773
+
1774
+ toJSON(): SerializedRenderNoArgumentsError {
1775
+ return {
1776
+ ...super.toJSON(),
1777
+ type: "RENDER_NO_ARGUMENTS_ERROR",
1778
+ };
1779
+ }
1780
+
1781
+ toMonacoDiagnostic(): MonacoDiagnostic {
1782
+ return {
1783
+ line: this.location.start.line,
1784
+ column: this.location.start.column,
1785
+ endLine: this.location.end.line,
1786
+ endColumn: this.location.end.column,
1787
+ message: this.message,
1788
+ severity: 'error'
1789
+ }
1790
+ }
1791
+
1792
+ treeInspect(): string {
1793
+ let output = "";
1794
+
1795
+ output += `@ RenderNoArgumentsError ${this.location.treeInspectWithLabel()}\n`;
1796
+ output += `└── message: "${this.message}"\n`;
1797
+
1798
+ return output;
1799
+ }
1800
+ }
1801
+
1802
+ export interface SerializedRenderConflictingPartialError {
1803
+ type: "RENDER_CONFLICTING_PARTIAL_ERROR";
1804
+ message: string;
1805
+ location: SerializedLocation;
1806
+ positional_partial: string;
1807
+ keyword_partial: string;
1808
+ }
1809
+
1810
+ export interface RenderConflictingPartialErrorProps {
1811
+ type: string;
1812
+ message: string;
1813
+ location: Location;
1814
+ positional_partial: string;
1815
+ keyword_partial: string;
1816
+ }
1817
+
1818
+ export class RenderConflictingPartialError extends HerbError {
1819
+ readonly positional_partial: string;
1820
+ readonly keyword_partial: string;
1821
+
1822
+ static from(data: SerializedRenderConflictingPartialError): RenderConflictingPartialError {
1823
+ return new RenderConflictingPartialError({
1824
+ type: data.type,
1825
+ message: data.message,
1826
+ location: Location.from(data.location),
1827
+ positional_partial: data.positional_partial,
1828
+ keyword_partial: data.keyword_partial,
1829
+ })
1830
+ }
1831
+
1832
+ constructor(props: RenderConflictingPartialErrorProps) {
1833
+ super(props.type, props.message, props.location);
1834
+
1835
+ this.positional_partial = props.positional_partial;
1836
+ this.keyword_partial = props.keyword_partial;
1837
+ }
1838
+
1839
+ toJSON(): SerializedRenderConflictingPartialError {
1840
+ return {
1841
+ ...super.toJSON(),
1842
+ type: "RENDER_CONFLICTING_PARTIAL_ERROR",
1843
+ positional_partial: this.positional_partial,
1844
+ keyword_partial: this.keyword_partial,
1845
+ };
1846
+ }
1847
+
1848
+ toMonacoDiagnostic(): MonacoDiagnostic {
1849
+ return {
1850
+ line: this.location.start.line,
1851
+ column: this.location.start.column,
1852
+ endLine: this.location.end.line,
1853
+ endColumn: this.location.end.column,
1854
+ message: this.message,
1855
+ severity: 'error'
1856
+ }
1857
+ }
1858
+
1859
+ treeInspect(): string {
1860
+ let output = "";
1861
+
1862
+ output += `@ RenderConflictingPartialError ${this.location.treeInspectWithLabel()}\n`;
1863
+ output += `├── message: "${this.message}"\n`;
1864
+ output += `├── positional_partial: ${JSON.stringify(this.positional_partial)}\n`;
1865
+ output += `└── keyword_partial: ${JSON.stringify(this.keyword_partial)}\n`;
1866
+
1867
+ return output;
1868
+ }
1869
+ }
1870
+
1871
+ export interface SerializedRenderInvalidAsOptionError {
1872
+ type: "RENDER_INVALID_AS_OPTION_ERROR";
1873
+ message: string;
1874
+ location: SerializedLocation;
1875
+ as_value: string;
1876
+ }
1877
+
1878
+ export interface RenderInvalidAsOptionErrorProps {
1879
+ type: string;
1880
+ message: string;
1881
+ location: Location;
1882
+ as_value: string;
1883
+ }
1884
+
1885
+ export class RenderInvalidAsOptionError extends HerbError {
1886
+ readonly as_value: string;
1887
+
1888
+ static from(data: SerializedRenderInvalidAsOptionError): RenderInvalidAsOptionError {
1889
+ return new RenderInvalidAsOptionError({
1890
+ type: data.type,
1891
+ message: data.message,
1892
+ location: Location.from(data.location),
1893
+ as_value: data.as_value,
1894
+ })
1895
+ }
1896
+
1897
+ constructor(props: RenderInvalidAsOptionErrorProps) {
1898
+ super(props.type, props.message, props.location);
1899
+
1900
+ this.as_value = props.as_value;
1901
+ }
1902
+
1903
+ toJSON(): SerializedRenderInvalidAsOptionError {
1904
+ return {
1905
+ ...super.toJSON(),
1906
+ type: "RENDER_INVALID_AS_OPTION_ERROR",
1907
+ as_value: this.as_value,
1908
+ };
1909
+ }
1910
+
1911
+ toMonacoDiagnostic(): MonacoDiagnostic {
1912
+ return {
1913
+ line: this.location.start.line,
1914
+ column: this.location.start.column,
1915
+ endLine: this.location.end.line,
1916
+ endColumn: this.location.end.column,
1917
+ message: this.message,
1918
+ severity: 'error'
1919
+ }
1920
+ }
1921
+
1922
+ treeInspect(): string {
1923
+ let output = "";
1924
+
1925
+ output += `@ RenderInvalidAsOptionError ${this.location.treeInspectWithLabel()}\n`;
1926
+ output += `├── message: "${this.message}"\n`;
1927
+ output += `└── as_value: ${JSON.stringify(this.as_value)}\n`;
1928
+
1929
+ return output;
1930
+ }
1931
+ }
1932
+
1933
+ export interface SerializedRenderObjectAndCollectionError {
1934
+ type: "RENDER_OBJECT_AND_COLLECTION_ERROR";
1935
+ message: string;
1936
+ location: SerializedLocation;
1937
+ }
1938
+
1939
+ export interface RenderObjectAndCollectionErrorProps {
1940
+ type: string;
1941
+ message: string;
1942
+ location: Location;
1943
+ }
1944
+
1945
+ export class RenderObjectAndCollectionError extends HerbError {
1946
+
1947
+ static from(data: SerializedRenderObjectAndCollectionError): RenderObjectAndCollectionError {
1948
+ return new RenderObjectAndCollectionError({
1949
+ type: data.type,
1950
+ message: data.message,
1951
+ location: Location.from(data.location),
1952
+ })
1953
+ }
1954
+
1955
+ constructor(props: RenderObjectAndCollectionErrorProps) {
1956
+ super(props.type, props.message, props.location);
1957
+
1958
+ }
1959
+
1960
+ toJSON(): SerializedRenderObjectAndCollectionError {
1961
+ return {
1962
+ ...super.toJSON(),
1963
+ type: "RENDER_OBJECT_AND_COLLECTION_ERROR",
1964
+ };
1965
+ }
1966
+
1967
+ toMonacoDiagnostic(): MonacoDiagnostic {
1968
+ return {
1969
+ line: this.location.start.line,
1970
+ column: this.location.start.column,
1971
+ endLine: this.location.end.line,
1972
+ endColumn: this.location.end.column,
1973
+ message: this.message,
1974
+ severity: 'error'
1975
+ }
1976
+ }
1977
+
1978
+ treeInspect(): string {
1979
+ let output = "";
1980
+
1981
+ output += `@ RenderObjectAndCollectionError ${this.location.treeInspectWithLabel()}\n`;
1982
+ output += `└── message: "${this.message}"\n`;
1983
+
1984
+ return output;
1985
+ }
1986
+ }
1987
+
1988
+ export interface SerializedRenderLayoutWithoutBlockError {
1989
+ type: "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR";
1990
+ message: string;
1991
+ location: SerializedLocation;
1992
+ layout: string;
1993
+ }
1994
+
1995
+ export interface RenderLayoutWithoutBlockErrorProps {
1996
+ type: string;
1997
+ message: string;
1998
+ location: Location;
1999
+ layout: string;
2000
+ }
2001
+
2002
+ export class RenderLayoutWithoutBlockError extends HerbError {
2003
+ readonly layout: string;
2004
+
2005
+ static from(data: SerializedRenderLayoutWithoutBlockError): RenderLayoutWithoutBlockError {
2006
+ return new RenderLayoutWithoutBlockError({
2007
+ type: data.type,
2008
+ message: data.message,
2009
+ location: Location.from(data.location),
2010
+ layout: data.layout,
2011
+ })
2012
+ }
2013
+
2014
+ constructor(props: RenderLayoutWithoutBlockErrorProps) {
2015
+ super(props.type, props.message, props.location);
2016
+
2017
+ this.layout = props.layout;
2018
+ }
2019
+
2020
+ toJSON(): SerializedRenderLayoutWithoutBlockError {
2021
+ return {
2022
+ ...super.toJSON(),
2023
+ type: "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR",
2024
+ layout: this.layout,
2025
+ };
2026
+ }
2027
+
2028
+ toMonacoDiagnostic(): MonacoDiagnostic {
2029
+ return {
2030
+ line: this.location.start.line,
2031
+ column: this.location.start.column,
2032
+ endLine: this.location.end.line,
2033
+ endColumn: this.location.end.column,
2034
+ message: this.message,
2035
+ severity: 'error'
2036
+ }
2037
+ }
2038
+
2039
+ treeInspect(): string {
2040
+ let output = "";
2041
+
2042
+ output += `@ RenderLayoutWithoutBlockError ${this.location.treeInspectWithLabel()}\n`;
2043
+ output += `├── message: "${this.message}"\n`;
2044
+ output += `└── layout: ${JSON.stringify(this.layout)}\n`;
2045
+
2046
+ return output;
2047
+ }
2048
+ }
2049
+
922
2050
 
923
2051
  export function fromSerializedError(error: SerializedHerbError): HerbError {
924
2052
  switch (error.type) {
@@ -927,14 +2055,31 @@ export function fromSerializedError(error: SerializedHerbError): HerbError {
927
2055
  case "MISSING_OPENING_TAG_ERROR": return MissingOpeningTagError.from(error as SerializedMissingOpeningTagError);
928
2056
  case "MISSING_CLOSING_TAG_ERROR": return MissingClosingTagError.from(error as SerializedMissingClosingTagError);
929
2057
  case "TAG_NAMES_MISMATCH_ERROR": return TagNamesMismatchError.from(error as SerializedTagNamesMismatchError);
930
- case "QUOTES_MISMATCH_ERROR": return QuotesMismatchError.from(error as SerializedQuotesMismatchError);
931
2058
  case "VOID_ELEMENT_CLOSING_TAG_ERROR": return VoidElementClosingTagError.from(error as SerializedVoidElementClosingTagError);
932
2059
  case "UNCLOSED_ELEMENT_ERROR": return UnclosedElementError.from(error as SerializedUnclosedElementError);
933
2060
  case "RUBY_PARSE_ERROR": return RubyParseError.from(error as SerializedRubyParseError);
934
2061
  case "ERB_CONTROL_FLOW_SCOPE_ERROR": return ERBControlFlowScopeError.from(error as SerializedERBControlFlowScopeError);
935
- case "MISSINGERB_END_TAG_ERROR": return MissingERBEndTagError.from(error as SerializedMissingERBEndTagError);
2062
+ case "MISSING_ERB_END_TAG_ERROR": return MissingERBEndTagError.from(error as SerializedMissingERBEndTagError);
936
2063
  case "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR": return ERBMultipleBlocksInTagError.from(error as SerializedERBMultipleBlocksInTagError);
937
2064
  case "ERB_CASE_WITH_CONDITIONS_ERROR": return ERBCaseWithConditionsError.from(error as SerializedERBCaseWithConditionsError);
2065
+ case "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR": return ConditionalElementMultipleTagsError.from(error as SerializedConditionalElementMultipleTagsError);
2066
+ case "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR": return ConditionalElementConditionMismatchError.from(error as SerializedConditionalElementConditionMismatchError);
2067
+ case "INVALID_COMMENT_CLOSING_TAG_ERROR": return InvalidCommentClosingTagError.from(error as SerializedInvalidCommentClosingTagError);
2068
+ case "OMITTED_CLOSING_TAG_ERROR": return OmittedClosingTagError.from(error as SerializedOmittedClosingTagError);
2069
+ case "UNCLOSED_OPEN_TAG_ERROR": return UnclosedOpenTagError.from(error as SerializedUnclosedOpenTagError);
2070
+ case "UNCLOSED_CLOSE_TAG_ERROR": return UnclosedCloseTagError.from(error as SerializedUnclosedCloseTagError);
2071
+ case "UNCLOSED_QUOTE_ERROR": return UnclosedQuoteError.from(error as SerializedUnclosedQuoteError);
2072
+ case "MISSING_ATTRIBUTE_VALUE_ERROR": return MissingAttributeValueError.from(error as SerializedMissingAttributeValueError);
2073
+ case "UNCLOSED_ERB_TAG_ERROR": return UnclosedERBTagError.from(error as SerializedUnclosedERBTagError);
2074
+ case "STRAY_ERB_CLOSING_TAG_ERROR": return StrayERBClosingTagError.from(error as SerializedStrayERBClosingTagError);
2075
+ case "NESTED_ERB_TAG_ERROR": return NestedERBTagError.from(error as SerializedNestedERBTagError);
2076
+ case "RENDER_AMBIGUOUS_LOCALS_ERROR": return RenderAmbiguousLocalsError.from(error as SerializedRenderAmbiguousLocalsError);
2077
+ case "RENDER_MISSING_LOCALS_ERROR": return RenderMissingLocalsError.from(error as SerializedRenderMissingLocalsError);
2078
+ case "RENDER_NO_ARGUMENTS_ERROR": return RenderNoArgumentsError.from(error as SerializedRenderNoArgumentsError);
2079
+ case "RENDER_CONFLICTING_PARTIAL_ERROR": return RenderConflictingPartialError.from(error as SerializedRenderConflictingPartialError);
2080
+ case "RENDER_INVALID_AS_OPTION_ERROR": return RenderInvalidAsOptionError.from(error as SerializedRenderInvalidAsOptionError);
2081
+ case "RENDER_OBJECT_AND_COLLECTION_ERROR": return RenderObjectAndCollectionError.from(error as SerializedRenderObjectAndCollectionError);
2082
+ case "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR": return RenderLayoutWithoutBlockError.from(error as SerializedRenderLayoutWithoutBlockError);
938
2083
 
939
2084
  default:
940
2085
  throw new Error(`Unknown node type: ${error.type}`);