@herb-tools/core 0.8.10 → 0.9.0

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.
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.0/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,24 @@ 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"
22
33
 
23
34
  export type SerializedErrorType = string
24
35
 
@@ -402,75 +413,6 @@ export class TagNamesMismatchError extends HerbError {
402
413
  }
403
414
  }
404
415
 
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
416
  export interface SerializedVoidElementClosingTagError {
475
417
  type: "VOID_ELEMENT_CLOSING_TAG_ERROR";
476
418
  message: string;
@@ -748,7 +690,7 @@ export class ERBControlFlowScopeError extends HerbError {
748
690
  }
749
691
 
750
692
  export interface SerializedMissingERBEndTagError {
751
- type: "MISSINGERB_END_TAG_ERROR";
693
+ type: "MISSING_ERB_END_TAG_ERROR";
752
694
  message: string;
753
695
  location: SerializedLocation;
754
696
  keyword: string;
@@ -782,7 +724,7 @@ export class MissingERBEndTagError extends HerbError {
782
724
  toJSON(): SerializedMissingERBEndTagError {
783
725
  return {
784
726
  ...super.toJSON(),
785
- type: "MISSINGERB_END_TAG_ERROR",
727
+ type: "MISSING_ERB_END_TAG_ERROR",
786
728
  keyword: this.keyword,
787
729
  };
788
730
  }
@@ -919,6 +861,751 @@ export class ERBCaseWithConditionsError extends HerbError {
919
861
  }
920
862
  }
921
863
 
864
+ export interface SerializedConditionalElementMultipleTagsError {
865
+ type: "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR";
866
+ message: string;
867
+ location: SerializedLocation;
868
+ line: any; // #<Herb::Template::SizeTField:0x0000000121f362c8 @name="line", @options={kind: nil}>
869
+ column: any; // #<Herb::Template::SizeTField:0x0000000121f362a0 @name="column", @options={kind: nil}>
870
+ }
871
+
872
+ export interface ConditionalElementMultipleTagsErrorProps {
873
+ type: string;
874
+ message: string;
875
+ location: Location;
876
+ line: any; // #<Herb::Template::SizeTField:0x0000000121f362c8 @name="line", @options={kind: nil}>
877
+ column: any; // #<Herb::Template::SizeTField:0x0000000121f362a0 @name="column", @options={kind: nil}>
878
+ }
879
+
880
+ export class ConditionalElementMultipleTagsError extends HerbError {
881
+ readonly line: any;
882
+ readonly column: any;
883
+
884
+ static from(data: SerializedConditionalElementMultipleTagsError): ConditionalElementMultipleTagsError {
885
+ return new ConditionalElementMultipleTagsError({
886
+ type: data.type,
887
+ message: data.message,
888
+ location: Location.from(data.location),
889
+ line: data.line,
890
+ column: data.column,
891
+ })
892
+ }
893
+
894
+ constructor(props: ConditionalElementMultipleTagsErrorProps) {
895
+ super(props.type, props.message, props.location);
896
+
897
+ this.line = props.line;
898
+ this.column = props.column;
899
+ }
900
+
901
+ toJSON(): SerializedConditionalElementMultipleTagsError {
902
+ return {
903
+ ...super.toJSON(),
904
+ type: "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR",
905
+ line: this.line,
906
+ column: this.column,
907
+ };
908
+ }
909
+
910
+ toMonacoDiagnostic(): MonacoDiagnostic {
911
+ return {
912
+ line: this.location.start.line,
913
+ column: this.location.start.column,
914
+ endLine: this.location.end.line,
915
+ endColumn: this.location.end.column,
916
+ message: this.message,
917
+ severity: 'error'
918
+ }
919
+ }
920
+
921
+ treeInspect(): string {
922
+ let output = "";
923
+
924
+ output += `@ ConditionalElementMultipleTagsError ${this.location.treeInspectWithLabel()}\n`;
925
+ output += `├── message: "${this.message}"\n`;
926
+ output += `├── line: ${JSON.stringify(this.line)}\n`;
927
+ output += `└── column: ${JSON.stringify(this.column)}\n`;
928
+
929
+ return output;
930
+ }
931
+ }
932
+
933
+ export interface SerializedConditionalElementConditionMismatchError {
934
+ type: "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR";
935
+ message: string;
936
+ location: SerializedLocation;
937
+ tag_name: string;
938
+ open_condition: string;
939
+ open_line: any; // #<Herb::Template::SizeTField:0x0000000121f35c38 @name="open_line", @options={kind: nil}>
940
+ open_column: any; // #<Herb::Template::SizeTField:0x0000000121f35c10 @name="open_column", @options={kind: nil}>
941
+ close_condition: string;
942
+ close_line: any; // #<Herb::Template::SizeTField:0x0000000121f35b70 @name="close_line", @options={kind: nil}>
943
+ close_column: any; // #<Herb::Template::SizeTField:0x0000000121f35b48 @name="close_column", @options={kind: nil}>
944
+ }
945
+
946
+ export interface ConditionalElementConditionMismatchErrorProps {
947
+ type: string;
948
+ message: string;
949
+ location: Location;
950
+ tag_name: string;
951
+ open_condition: string;
952
+ open_line: any; // #<Herb::Template::SizeTField:0x0000000121f35c38 @name="open_line", @options={kind: nil}>
953
+ open_column: any; // #<Herb::Template::SizeTField:0x0000000121f35c10 @name="open_column", @options={kind: nil}>
954
+ close_condition: string;
955
+ close_line: any; // #<Herb::Template::SizeTField:0x0000000121f35b70 @name="close_line", @options={kind: nil}>
956
+ close_column: any; // #<Herb::Template::SizeTField:0x0000000121f35b48 @name="close_column", @options={kind: nil}>
957
+ }
958
+
959
+ export class ConditionalElementConditionMismatchError extends HerbError {
960
+ readonly tag_name: string;
961
+ readonly open_condition: string;
962
+ readonly open_line: any;
963
+ readonly open_column: any;
964
+ readonly close_condition: string;
965
+ readonly close_line: any;
966
+ readonly close_column: any;
967
+
968
+ static from(data: SerializedConditionalElementConditionMismatchError): ConditionalElementConditionMismatchError {
969
+ return new ConditionalElementConditionMismatchError({
970
+ type: data.type,
971
+ message: data.message,
972
+ location: Location.from(data.location),
973
+ tag_name: data.tag_name,
974
+ open_condition: data.open_condition,
975
+ open_line: data.open_line,
976
+ open_column: data.open_column,
977
+ close_condition: data.close_condition,
978
+ close_line: data.close_line,
979
+ close_column: data.close_column,
980
+ })
981
+ }
982
+
983
+ constructor(props: ConditionalElementConditionMismatchErrorProps) {
984
+ super(props.type, props.message, props.location);
985
+
986
+ this.tag_name = props.tag_name;
987
+ this.open_condition = props.open_condition;
988
+ this.open_line = props.open_line;
989
+ this.open_column = props.open_column;
990
+ this.close_condition = props.close_condition;
991
+ this.close_line = props.close_line;
992
+ this.close_column = props.close_column;
993
+ }
994
+
995
+ toJSON(): SerializedConditionalElementConditionMismatchError {
996
+ return {
997
+ ...super.toJSON(),
998
+ type: "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR",
999
+ tag_name: this.tag_name,
1000
+ open_condition: this.open_condition,
1001
+ open_line: this.open_line,
1002
+ open_column: this.open_column,
1003
+ close_condition: this.close_condition,
1004
+ close_line: this.close_line,
1005
+ close_column: this.close_column,
1006
+ };
1007
+ }
1008
+
1009
+ toMonacoDiagnostic(): MonacoDiagnostic {
1010
+ return {
1011
+ line: this.location.start.line,
1012
+ column: this.location.start.column,
1013
+ endLine: this.location.end.line,
1014
+ endColumn: this.location.end.column,
1015
+ message: this.message,
1016
+ severity: 'error'
1017
+ }
1018
+ }
1019
+
1020
+ treeInspect(): string {
1021
+ let output = "";
1022
+
1023
+ output += `@ ConditionalElementConditionMismatchError ${this.location.treeInspectWithLabel()}\n`;
1024
+ output += `├── message: "${this.message}"\n`;
1025
+ output += `├── tag_name: ${JSON.stringify(this.tag_name)}\n`;
1026
+ output += `├── open_condition: ${JSON.stringify(this.open_condition)}\n`;
1027
+ output += `├── open_line: ${JSON.stringify(this.open_line)}\n`;
1028
+ output += `├── open_column: ${JSON.stringify(this.open_column)}\n`;
1029
+ output += `├── close_condition: ${JSON.stringify(this.close_condition)}\n`;
1030
+ output += `├── close_line: ${JSON.stringify(this.close_line)}\n`;
1031
+ output += `└── close_column: ${JSON.stringify(this.close_column)}\n`;
1032
+
1033
+ return output;
1034
+ }
1035
+ }
1036
+
1037
+ export interface SerializedInvalidCommentClosingTagError {
1038
+ type: "INVALID_COMMENT_CLOSING_TAG_ERROR";
1039
+ message: string;
1040
+ location: SerializedLocation;
1041
+ closing_tag: SerializedToken | null;
1042
+ }
1043
+
1044
+ export interface InvalidCommentClosingTagErrorProps {
1045
+ type: string;
1046
+ message: string;
1047
+ location: Location;
1048
+ closing_tag: Token | null;
1049
+ }
1050
+
1051
+ export class InvalidCommentClosingTagError extends HerbError {
1052
+ readonly closing_tag: Token | null;
1053
+
1054
+ static from(data: SerializedInvalidCommentClosingTagError): InvalidCommentClosingTagError {
1055
+ return new InvalidCommentClosingTagError({
1056
+ type: data.type,
1057
+ message: data.message,
1058
+ location: Location.from(data.location),
1059
+ closing_tag: data.closing_tag ? Token.from(data.closing_tag) : null,
1060
+ })
1061
+ }
1062
+
1063
+ constructor(props: InvalidCommentClosingTagErrorProps) {
1064
+ super(props.type, props.message, props.location);
1065
+
1066
+ this.closing_tag = props.closing_tag;
1067
+ }
1068
+
1069
+ toJSON(): SerializedInvalidCommentClosingTagError {
1070
+ return {
1071
+ ...super.toJSON(),
1072
+ type: "INVALID_COMMENT_CLOSING_TAG_ERROR",
1073
+ closing_tag: this.closing_tag ? this.closing_tag.toJSON() : null,
1074
+ };
1075
+ }
1076
+
1077
+ toMonacoDiagnostic(): MonacoDiagnostic {
1078
+ return {
1079
+ line: this.location.start.line,
1080
+ column: this.location.start.column,
1081
+ endLine: this.location.end.line,
1082
+ endColumn: this.location.end.column,
1083
+ message: this.message,
1084
+ severity: 'error'
1085
+ }
1086
+ }
1087
+
1088
+ treeInspect(): string {
1089
+ let output = "";
1090
+
1091
+ output += `@ InvalidCommentClosingTagError ${this.location.treeInspectWithLabel()}\n`;
1092
+ output += `├── message: "${this.message}"\n`;
1093
+ output += `└── closing_tag: ${this.closing_tag ? this.closing_tag.treeInspect() : "∅"}\n`;
1094
+
1095
+ return output;
1096
+ }
1097
+ }
1098
+
1099
+ export interface SerializedOmittedClosingTagError {
1100
+ type: "OMITTED_CLOSING_TAG_ERROR";
1101
+ message: string;
1102
+ location: SerializedLocation;
1103
+ opening_tag: SerializedToken | null;
1104
+ insertion_point: SerializedPosition;
1105
+ }
1106
+
1107
+ export interface OmittedClosingTagErrorProps {
1108
+ type: string;
1109
+ message: string;
1110
+ location: Location;
1111
+ opening_tag: Token | null;
1112
+ insertion_point: Position;
1113
+ }
1114
+
1115
+ export class OmittedClosingTagError extends HerbError {
1116
+ readonly opening_tag: Token | null;
1117
+ readonly insertion_point: Position;
1118
+
1119
+ static from(data: SerializedOmittedClosingTagError): OmittedClosingTagError {
1120
+ return new OmittedClosingTagError({
1121
+ type: data.type,
1122
+ message: data.message,
1123
+ location: Location.from(data.location),
1124
+ opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null,
1125
+ insertion_point: Position.from(data.insertion_point),
1126
+ })
1127
+ }
1128
+
1129
+ constructor(props: OmittedClosingTagErrorProps) {
1130
+ super(props.type, props.message, props.location);
1131
+
1132
+ this.opening_tag = props.opening_tag;
1133
+ this.insertion_point = props.insertion_point;
1134
+ }
1135
+
1136
+ toJSON(): SerializedOmittedClosingTagError {
1137
+ return {
1138
+ ...super.toJSON(),
1139
+ type: "OMITTED_CLOSING_TAG_ERROR",
1140
+ opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null,
1141
+ insertion_point: this.insertion_point.toJSON(),
1142
+ };
1143
+ }
1144
+
1145
+ toMonacoDiagnostic(): MonacoDiagnostic {
1146
+ return {
1147
+ line: this.location.start.line,
1148
+ column: this.location.start.column,
1149
+ endLine: this.location.end.line,
1150
+ endColumn: this.location.end.column,
1151
+ message: this.message,
1152
+ severity: 'error'
1153
+ }
1154
+ }
1155
+
1156
+ treeInspect(): string {
1157
+ let output = "";
1158
+
1159
+ output += `@ OmittedClosingTagError ${this.location.treeInspectWithLabel()}\n`;
1160
+ output += `├── message: "${this.message}"\n`;
1161
+ output += `├── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`;
1162
+ output += `└── insertion_point: (${this.insertion_point.line}:${this.insertion_point.column})\n`;
1163
+
1164
+ return output;
1165
+ }
1166
+ }
1167
+
1168
+ export interface SerializedUnclosedOpenTagError {
1169
+ type: "UNCLOSED_OPEN_TAG_ERROR";
1170
+ message: string;
1171
+ location: SerializedLocation;
1172
+ tag_name: SerializedToken | null;
1173
+ }
1174
+
1175
+ export interface UnclosedOpenTagErrorProps {
1176
+ type: string;
1177
+ message: string;
1178
+ location: Location;
1179
+ tag_name: Token | null;
1180
+ }
1181
+
1182
+ export class UnclosedOpenTagError extends HerbError {
1183
+ readonly tag_name: Token | null;
1184
+
1185
+ static from(data: SerializedUnclosedOpenTagError): UnclosedOpenTagError {
1186
+ return new UnclosedOpenTagError({
1187
+ type: data.type,
1188
+ message: data.message,
1189
+ location: Location.from(data.location),
1190
+ tag_name: data.tag_name ? Token.from(data.tag_name) : null,
1191
+ })
1192
+ }
1193
+
1194
+ constructor(props: UnclosedOpenTagErrorProps) {
1195
+ super(props.type, props.message, props.location);
1196
+
1197
+ this.tag_name = props.tag_name;
1198
+ }
1199
+
1200
+ toJSON(): SerializedUnclosedOpenTagError {
1201
+ return {
1202
+ ...super.toJSON(),
1203
+ type: "UNCLOSED_OPEN_TAG_ERROR",
1204
+ tag_name: this.tag_name ? this.tag_name.toJSON() : null,
1205
+ };
1206
+ }
1207
+
1208
+ toMonacoDiagnostic(): MonacoDiagnostic {
1209
+ return {
1210
+ line: this.location.start.line,
1211
+ column: this.location.start.column,
1212
+ endLine: this.location.end.line,
1213
+ endColumn: this.location.end.column,
1214
+ message: this.message,
1215
+ severity: 'error'
1216
+ }
1217
+ }
1218
+
1219
+ treeInspect(): string {
1220
+ let output = "";
1221
+
1222
+ output += `@ UnclosedOpenTagError ${this.location.treeInspectWithLabel()}\n`;
1223
+ output += `├── message: "${this.message}"\n`;
1224
+ output += `└── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`;
1225
+
1226
+ return output;
1227
+ }
1228
+ }
1229
+
1230
+ export interface SerializedUnclosedCloseTagError {
1231
+ type: "UNCLOSED_CLOSE_TAG_ERROR";
1232
+ message: string;
1233
+ location: SerializedLocation;
1234
+ tag_name: SerializedToken | null;
1235
+ }
1236
+
1237
+ export interface UnclosedCloseTagErrorProps {
1238
+ type: string;
1239
+ message: string;
1240
+ location: Location;
1241
+ tag_name: Token | null;
1242
+ }
1243
+
1244
+ export class UnclosedCloseTagError extends HerbError {
1245
+ readonly tag_name: Token | null;
1246
+
1247
+ static from(data: SerializedUnclosedCloseTagError): UnclosedCloseTagError {
1248
+ return new UnclosedCloseTagError({
1249
+ type: data.type,
1250
+ message: data.message,
1251
+ location: Location.from(data.location),
1252
+ tag_name: data.tag_name ? Token.from(data.tag_name) : null,
1253
+ })
1254
+ }
1255
+
1256
+ constructor(props: UnclosedCloseTagErrorProps) {
1257
+ super(props.type, props.message, props.location);
1258
+
1259
+ this.tag_name = props.tag_name;
1260
+ }
1261
+
1262
+ toJSON(): SerializedUnclosedCloseTagError {
1263
+ return {
1264
+ ...super.toJSON(),
1265
+ type: "UNCLOSED_CLOSE_TAG_ERROR",
1266
+ tag_name: this.tag_name ? this.tag_name.toJSON() : null,
1267
+ };
1268
+ }
1269
+
1270
+ toMonacoDiagnostic(): MonacoDiagnostic {
1271
+ return {
1272
+ line: this.location.start.line,
1273
+ column: this.location.start.column,
1274
+ endLine: this.location.end.line,
1275
+ endColumn: this.location.end.column,
1276
+ message: this.message,
1277
+ severity: 'error'
1278
+ }
1279
+ }
1280
+
1281
+ treeInspect(): string {
1282
+ let output = "";
1283
+
1284
+ output += `@ UnclosedCloseTagError ${this.location.treeInspectWithLabel()}\n`;
1285
+ output += `├── message: "${this.message}"\n`;
1286
+ output += `└── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`;
1287
+
1288
+ return output;
1289
+ }
1290
+ }
1291
+
1292
+ export interface SerializedUnclosedQuoteError {
1293
+ type: "UNCLOSED_QUOTE_ERROR";
1294
+ message: string;
1295
+ location: SerializedLocation;
1296
+ opening_quote: SerializedToken | null;
1297
+ }
1298
+
1299
+ export interface UnclosedQuoteErrorProps {
1300
+ type: string;
1301
+ message: string;
1302
+ location: Location;
1303
+ opening_quote: Token | null;
1304
+ }
1305
+
1306
+ export class UnclosedQuoteError extends HerbError {
1307
+ readonly opening_quote: Token | null;
1308
+
1309
+ static from(data: SerializedUnclosedQuoteError): UnclosedQuoteError {
1310
+ return new UnclosedQuoteError({
1311
+ type: data.type,
1312
+ message: data.message,
1313
+ location: Location.from(data.location),
1314
+ opening_quote: data.opening_quote ? Token.from(data.opening_quote) : null,
1315
+ })
1316
+ }
1317
+
1318
+ constructor(props: UnclosedQuoteErrorProps) {
1319
+ super(props.type, props.message, props.location);
1320
+
1321
+ this.opening_quote = props.opening_quote;
1322
+ }
1323
+
1324
+ toJSON(): SerializedUnclosedQuoteError {
1325
+ return {
1326
+ ...super.toJSON(),
1327
+ type: "UNCLOSED_QUOTE_ERROR",
1328
+ opening_quote: this.opening_quote ? this.opening_quote.toJSON() : null,
1329
+ };
1330
+ }
1331
+
1332
+ toMonacoDiagnostic(): MonacoDiagnostic {
1333
+ return {
1334
+ line: this.location.start.line,
1335
+ column: this.location.start.column,
1336
+ endLine: this.location.end.line,
1337
+ endColumn: this.location.end.column,
1338
+ message: this.message,
1339
+ severity: 'error'
1340
+ }
1341
+ }
1342
+
1343
+ treeInspect(): string {
1344
+ let output = "";
1345
+
1346
+ output += `@ UnclosedQuoteError ${this.location.treeInspectWithLabel()}\n`;
1347
+ output += `├── message: "${this.message}"\n`;
1348
+ output += `└── opening_quote: ${this.opening_quote ? this.opening_quote.treeInspect() : "∅"}\n`;
1349
+
1350
+ return output;
1351
+ }
1352
+ }
1353
+
1354
+ export interface SerializedMissingAttributeValueError {
1355
+ type: "MISSING_ATTRIBUTE_VALUE_ERROR";
1356
+ message: string;
1357
+ location: SerializedLocation;
1358
+ attribute_name: string;
1359
+ }
1360
+
1361
+ export interface MissingAttributeValueErrorProps {
1362
+ type: string;
1363
+ message: string;
1364
+ location: Location;
1365
+ attribute_name: string;
1366
+ }
1367
+
1368
+ export class MissingAttributeValueError extends HerbError {
1369
+ readonly attribute_name: string;
1370
+
1371
+ static from(data: SerializedMissingAttributeValueError): MissingAttributeValueError {
1372
+ return new MissingAttributeValueError({
1373
+ type: data.type,
1374
+ message: data.message,
1375
+ location: Location.from(data.location),
1376
+ attribute_name: data.attribute_name,
1377
+ })
1378
+ }
1379
+
1380
+ constructor(props: MissingAttributeValueErrorProps) {
1381
+ super(props.type, props.message, props.location);
1382
+
1383
+ this.attribute_name = props.attribute_name;
1384
+ }
1385
+
1386
+ toJSON(): SerializedMissingAttributeValueError {
1387
+ return {
1388
+ ...super.toJSON(),
1389
+ type: "MISSING_ATTRIBUTE_VALUE_ERROR",
1390
+ attribute_name: this.attribute_name,
1391
+ };
1392
+ }
1393
+
1394
+ toMonacoDiagnostic(): MonacoDiagnostic {
1395
+ return {
1396
+ line: this.location.start.line,
1397
+ column: this.location.start.column,
1398
+ endLine: this.location.end.line,
1399
+ endColumn: this.location.end.column,
1400
+ message: this.message,
1401
+ severity: 'error'
1402
+ }
1403
+ }
1404
+
1405
+ treeInspect(): string {
1406
+ let output = "";
1407
+
1408
+ output += `@ MissingAttributeValueError ${this.location.treeInspectWithLabel()}\n`;
1409
+ output += `├── message: "${this.message}"\n`;
1410
+ output += `└── attribute_name: ${JSON.stringify(this.attribute_name)}\n`;
1411
+
1412
+ return output;
1413
+ }
1414
+ }
1415
+
1416
+ export interface SerializedUnclosedERBTagError {
1417
+ type: "UNCLOSED_ERB_TAG_ERROR";
1418
+ message: string;
1419
+ location: SerializedLocation;
1420
+ opening_tag: SerializedToken | null;
1421
+ }
1422
+
1423
+ export interface UnclosedERBTagErrorProps {
1424
+ type: string;
1425
+ message: string;
1426
+ location: Location;
1427
+ opening_tag: Token | null;
1428
+ }
1429
+
1430
+ export class UnclosedERBTagError extends HerbError {
1431
+ readonly opening_tag: Token | null;
1432
+
1433
+ static from(data: SerializedUnclosedERBTagError): UnclosedERBTagError {
1434
+ return new UnclosedERBTagError({
1435
+ type: data.type,
1436
+ message: data.message,
1437
+ location: Location.from(data.location),
1438
+ opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null,
1439
+ })
1440
+ }
1441
+
1442
+ constructor(props: UnclosedERBTagErrorProps) {
1443
+ super(props.type, props.message, props.location);
1444
+
1445
+ this.opening_tag = props.opening_tag;
1446
+ }
1447
+
1448
+ toJSON(): SerializedUnclosedERBTagError {
1449
+ return {
1450
+ ...super.toJSON(),
1451
+ type: "UNCLOSED_ERB_TAG_ERROR",
1452
+ opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null,
1453
+ };
1454
+ }
1455
+
1456
+ toMonacoDiagnostic(): MonacoDiagnostic {
1457
+ return {
1458
+ line: this.location.start.line,
1459
+ column: this.location.start.column,
1460
+ endLine: this.location.end.line,
1461
+ endColumn: this.location.end.column,
1462
+ message: this.message,
1463
+ severity: 'error'
1464
+ }
1465
+ }
1466
+
1467
+ treeInspect(): string {
1468
+ let output = "";
1469
+
1470
+ output += `@ UnclosedERBTagError ${this.location.treeInspectWithLabel()}\n`;
1471
+ output += `├── message: "${this.message}"\n`;
1472
+ output += `└── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`;
1473
+
1474
+ return output;
1475
+ }
1476
+ }
1477
+
1478
+ export interface SerializedStrayERBClosingTagError {
1479
+ type: "STRAY_ERB_CLOSING_TAG_ERROR";
1480
+ message: string;
1481
+ location: SerializedLocation;
1482
+ }
1483
+
1484
+ export interface StrayERBClosingTagErrorProps {
1485
+ type: string;
1486
+ message: string;
1487
+ location: Location;
1488
+ }
1489
+
1490
+ export class StrayERBClosingTagError extends HerbError {
1491
+
1492
+ static from(data: SerializedStrayERBClosingTagError): StrayERBClosingTagError {
1493
+ return new StrayERBClosingTagError({
1494
+ type: data.type,
1495
+ message: data.message,
1496
+ location: Location.from(data.location),
1497
+ })
1498
+ }
1499
+
1500
+ constructor(props: StrayERBClosingTagErrorProps) {
1501
+ super(props.type, props.message, props.location);
1502
+
1503
+ }
1504
+
1505
+ toJSON(): SerializedStrayERBClosingTagError {
1506
+ return {
1507
+ ...super.toJSON(),
1508
+ type: "STRAY_ERB_CLOSING_TAG_ERROR",
1509
+ };
1510
+ }
1511
+
1512
+ toMonacoDiagnostic(): MonacoDiagnostic {
1513
+ return {
1514
+ line: this.location.start.line,
1515
+ column: this.location.start.column,
1516
+ endLine: this.location.end.line,
1517
+ endColumn: this.location.end.column,
1518
+ message: this.message,
1519
+ severity: 'error'
1520
+ }
1521
+ }
1522
+
1523
+ treeInspect(): string {
1524
+ let output = "";
1525
+
1526
+ output += `@ StrayERBClosingTagError ${this.location.treeInspectWithLabel()}\n`;
1527
+ output += `└── message: "${this.message}"\n`;
1528
+
1529
+ return output;
1530
+ }
1531
+ }
1532
+
1533
+ export interface SerializedNestedERBTagError {
1534
+ type: "NESTED_ERB_TAG_ERROR";
1535
+ message: string;
1536
+ location: SerializedLocation;
1537
+ opening_tag: SerializedToken | null;
1538
+ nested_tag_line: any; // #<Herb::Template::SizeTField:0x0000000121f30760 @name="nested_tag_line", @options={kind: nil}>
1539
+ nested_tag_column: any; // #<Herb::Template::SizeTField:0x0000000121f306e8 @name="nested_tag_column", @options={kind: nil}>
1540
+ }
1541
+
1542
+ export interface NestedERBTagErrorProps {
1543
+ type: string;
1544
+ message: string;
1545
+ location: Location;
1546
+ opening_tag: Token | null;
1547
+ nested_tag_line: any; // #<Herb::Template::SizeTField:0x0000000121f30760 @name="nested_tag_line", @options={kind: nil}>
1548
+ nested_tag_column: any; // #<Herb::Template::SizeTField:0x0000000121f306e8 @name="nested_tag_column", @options={kind: nil}>
1549
+ }
1550
+
1551
+ export class NestedERBTagError extends HerbError {
1552
+ readonly opening_tag: Token | null;
1553
+ readonly nested_tag_line: any;
1554
+ readonly nested_tag_column: any;
1555
+
1556
+ static from(data: SerializedNestedERBTagError): NestedERBTagError {
1557
+ return new NestedERBTagError({
1558
+ type: data.type,
1559
+ message: data.message,
1560
+ location: Location.from(data.location),
1561
+ opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null,
1562
+ nested_tag_line: data.nested_tag_line,
1563
+ nested_tag_column: data.nested_tag_column,
1564
+ })
1565
+ }
1566
+
1567
+ constructor(props: NestedERBTagErrorProps) {
1568
+ super(props.type, props.message, props.location);
1569
+
1570
+ this.opening_tag = props.opening_tag;
1571
+ this.nested_tag_line = props.nested_tag_line;
1572
+ this.nested_tag_column = props.nested_tag_column;
1573
+ }
1574
+
1575
+ toJSON(): SerializedNestedERBTagError {
1576
+ return {
1577
+ ...super.toJSON(),
1578
+ type: "NESTED_ERB_TAG_ERROR",
1579
+ opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null,
1580
+ nested_tag_line: this.nested_tag_line,
1581
+ nested_tag_column: this.nested_tag_column,
1582
+ };
1583
+ }
1584
+
1585
+ toMonacoDiagnostic(): MonacoDiagnostic {
1586
+ return {
1587
+ line: this.location.start.line,
1588
+ column: this.location.start.column,
1589
+ endLine: this.location.end.line,
1590
+ endColumn: this.location.end.column,
1591
+ message: this.message,
1592
+ severity: 'error'
1593
+ }
1594
+ }
1595
+
1596
+ treeInspect(): string {
1597
+ let output = "";
1598
+
1599
+ output += `@ NestedERBTagError ${this.location.treeInspectWithLabel()}\n`;
1600
+ output += `├── message: "${this.message}"\n`;
1601
+ output += `├── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`;
1602
+ output += `├── nested_tag_line: ${JSON.stringify(this.nested_tag_line)}\n`;
1603
+ output += `└── nested_tag_column: ${JSON.stringify(this.nested_tag_column)}\n`;
1604
+
1605
+ return output;
1606
+ }
1607
+ }
1608
+
922
1609
 
923
1610
  export function fromSerializedError(error: SerializedHerbError): HerbError {
924
1611
  switch (error.type) {
@@ -927,14 +1614,24 @@ export function fromSerializedError(error: SerializedHerbError): HerbError {
927
1614
  case "MISSING_OPENING_TAG_ERROR": return MissingOpeningTagError.from(error as SerializedMissingOpeningTagError);
928
1615
  case "MISSING_CLOSING_TAG_ERROR": return MissingClosingTagError.from(error as SerializedMissingClosingTagError);
929
1616
  case "TAG_NAMES_MISMATCH_ERROR": return TagNamesMismatchError.from(error as SerializedTagNamesMismatchError);
930
- case "QUOTES_MISMATCH_ERROR": return QuotesMismatchError.from(error as SerializedQuotesMismatchError);
931
1617
  case "VOID_ELEMENT_CLOSING_TAG_ERROR": return VoidElementClosingTagError.from(error as SerializedVoidElementClosingTagError);
932
1618
  case "UNCLOSED_ELEMENT_ERROR": return UnclosedElementError.from(error as SerializedUnclosedElementError);
933
1619
  case "RUBY_PARSE_ERROR": return RubyParseError.from(error as SerializedRubyParseError);
934
1620
  case "ERB_CONTROL_FLOW_SCOPE_ERROR": return ERBControlFlowScopeError.from(error as SerializedERBControlFlowScopeError);
935
- case "MISSINGERB_END_TAG_ERROR": return MissingERBEndTagError.from(error as SerializedMissingERBEndTagError);
1621
+ case "MISSING_ERB_END_TAG_ERROR": return MissingERBEndTagError.from(error as SerializedMissingERBEndTagError);
936
1622
  case "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR": return ERBMultipleBlocksInTagError.from(error as SerializedERBMultipleBlocksInTagError);
937
1623
  case "ERB_CASE_WITH_CONDITIONS_ERROR": return ERBCaseWithConditionsError.from(error as SerializedERBCaseWithConditionsError);
1624
+ case "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR": return ConditionalElementMultipleTagsError.from(error as SerializedConditionalElementMultipleTagsError);
1625
+ case "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR": return ConditionalElementConditionMismatchError.from(error as SerializedConditionalElementConditionMismatchError);
1626
+ case "INVALID_COMMENT_CLOSING_TAG_ERROR": return InvalidCommentClosingTagError.from(error as SerializedInvalidCommentClosingTagError);
1627
+ case "OMITTED_CLOSING_TAG_ERROR": return OmittedClosingTagError.from(error as SerializedOmittedClosingTagError);
1628
+ case "UNCLOSED_OPEN_TAG_ERROR": return UnclosedOpenTagError.from(error as SerializedUnclosedOpenTagError);
1629
+ case "UNCLOSED_CLOSE_TAG_ERROR": return UnclosedCloseTagError.from(error as SerializedUnclosedCloseTagError);
1630
+ case "UNCLOSED_QUOTE_ERROR": return UnclosedQuoteError.from(error as SerializedUnclosedQuoteError);
1631
+ case "MISSING_ATTRIBUTE_VALUE_ERROR": return MissingAttributeValueError.from(error as SerializedMissingAttributeValueError);
1632
+ case "UNCLOSED_ERB_TAG_ERROR": return UnclosedERBTagError.from(error as SerializedUnclosedERBTagError);
1633
+ case "STRAY_ERB_CLOSING_TAG_ERROR": return StrayERBClosingTagError.from(error as SerializedStrayERBClosingTagError);
1634
+ case "NESTED_ERB_TAG_ERROR": return NestedERBTagError.from(error as SerializedNestedERBTagError);
938
1635
 
939
1636
  default:
940
1637
  throw new Error(`Unknown node type: ${error.type}`);