// NOTE: This file is generated by the templates/template.rb script and should not // be modified manually. See /home/runner/work/herb/herb/templates/javascript/packages/core/src/errors.ts.erb import { Location, SerializedLocation } from "./location.js" import { Position, SerializedPosition } from "./position.js" import { Token, SerializedToken } from "./token.js" import { Diagnostic, MonacoDiagnostic } from "./diagnostic.js" export type HerbErrorType = | "UNEXPECTED_ERROR" | "UNEXPECTED_TOKEN_ERROR" | "MISSING_OPENING_TAG_ERROR" | "MISSING_CLOSING_TAG_ERROR" | "TAG_NAMES_MISMATCH_ERROR" | "VOID_ELEMENT_CLOSING_TAG_ERROR" | "UNCLOSED_ELEMENT_ERROR" | "RUBY_PARSE_ERROR" | "ERB_CONTROL_FLOW_SCOPE_ERROR" | "MISSING_ERB_END_TAG_ERROR" | "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR" | "ERB_CASE_WITH_CONDITIONS_ERROR" | "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR" | "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR" | "INVALID_COMMENT_CLOSING_TAG_ERROR" | "OMITTED_CLOSING_TAG_ERROR" | "UNCLOSED_OPEN_TAG_ERROR" | "UNCLOSED_CLOSE_TAG_ERROR" | "UNCLOSED_QUOTE_ERROR" | "MISSING_ATTRIBUTE_VALUE_ERROR" | "UNCLOSED_ERB_TAG_ERROR" | "STRAY_ERB_CLOSING_TAG_ERROR" | "NESTED_ERB_TAG_ERROR" | "RENDER_AMBIGUOUS_LOCALS_ERROR" | "RENDER_MISSING_LOCALS_ERROR" | "RENDER_NO_ARGUMENTS_ERROR" | "RENDER_CONFLICTING_PARTIAL_ERROR" | "RENDER_INVALID_AS_OPTION_ERROR" | "RENDER_OBJECT_AND_COLLECTION_ERROR" | "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR" | "STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR" | "STRICT_LOCALS_BLOCK_ARGUMENT_ERROR" | "STRICT_LOCALS_SPLAT_ARGUMENT_ERROR" | "STRICT_LOCALS_MISSING_PARENTHESIS_ERROR" | "STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR" | "VOID_ELEMENT_CONTENT_ERROR" | "DOT_NOTATION_CASING_ERROR" | "TIMEOUT_ERROR" export type SerializedErrorType = string export interface SerializedHerbError { type: string message: string location: SerializedLocation } export abstract class HerbError implements Diagnostic { readonly type: string readonly message: string readonly location: Location readonly severity: "error" | "warning" | "info" | "hint" = "error" readonly source: string = "parser" get code(): string { return this.type } static from(error: SerializedHerbError): HerbError { return fromSerializedError(error) } constructor(type: string, message: string, location: Location) { this.type = type this.message = message this.location = location } toJSON(): SerializedHerbError { return { type: this.type, message: this.message, location: this.location.toJSON(), } } inspect(): string { return this.treeInspect(0) } abstract treeInspect(indent?: number): string } export interface SerializedUnexpectedError { type: "UNEXPECTED_ERROR"; message: string; location: SerializedLocation; description: string; expected: string; found: string; } export interface UnexpectedErrorProps { type: string; message: string; location: Location; description: string; expected: string; found: string; } export class UnexpectedError extends HerbError { readonly description: string; readonly expected: string; readonly found: string; static from(data: SerializedUnexpectedError): UnexpectedError { return new UnexpectedError({ type: data.type, message: data.message, location: Location.from(data.location), description: data.description, expected: data.expected, found: data.found, }) } constructor(props: UnexpectedErrorProps) { super(props.type, props.message, props.location); this.description = props.description; this.expected = props.expected; this.found = props.found; } toJSON(): SerializedUnexpectedError { return { ...super.toJSON(), type: "UNEXPECTED_ERROR", description: this.description, expected: this.expected, found: this.found, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ UnexpectedError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── description: ${JSON.stringify(this.description)}\n`; output += `├── expected: ${JSON.stringify(this.expected)}\n`; output += `└── found: ${JSON.stringify(this.found)}\n`; return output; } } export interface SerializedUnexpectedTokenError { type: "UNEXPECTED_TOKEN_ERROR"; message: string; location: SerializedLocation; expected_type: string | null; found: SerializedToken | null; } export interface UnexpectedTokenErrorProps { type: string; message: string; location: Location; expected_type: string | null; found: Token | null; } export class UnexpectedTokenError extends HerbError { readonly expected_type: string | null; readonly found: Token | null; static from(data: SerializedUnexpectedTokenError): UnexpectedTokenError { return new UnexpectedTokenError({ type: data.type, message: data.message, location: Location.from(data.location), expected_type: data.expected_type, found: data.found ? Token.from(data.found) : null, }) } constructor(props: UnexpectedTokenErrorProps) { super(props.type, props.message, props.location); this.expected_type = props.expected_type; this.found = props.found; } toJSON(): SerializedUnexpectedTokenError { return { ...super.toJSON(), type: "UNEXPECTED_TOKEN_ERROR", expected_type: this.expected_type, found: this.found ? this.found.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ UnexpectedTokenError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── expected_type: ${JSON.stringify(this.expected_type)}\n`; output += `└── found: ${this.found ? this.found.treeInspect() : "∅"}\n`; return output; } } export interface SerializedMissingOpeningTagError { type: "MISSING_OPENING_TAG_ERROR"; message: string; location: SerializedLocation; closing_tag: SerializedToken | null; } export interface MissingOpeningTagErrorProps { type: string; message: string; location: Location; closing_tag: Token | null; } export class MissingOpeningTagError extends HerbError { readonly closing_tag: Token | null; static from(data: SerializedMissingOpeningTagError): MissingOpeningTagError { return new MissingOpeningTagError({ type: data.type, message: data.message, location: Location.from(data.location), closing_tag: data.closing_tag ? Token.from(data.closing_tag) : null, }) } constructor(props: MissingOpeningTagErrorProps) { super(props.type, props.message, props.location); this.closing_tag = props.closing_tag; } toJSON(): SerializedMissingOpeningTagError { return { ...super.toJSON(), type: "MISSING_OPENING_TAG_ERROR", closing_tag: this.closing_tag ? this.closing_tag.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ MissingOpeningTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── closing_tag: ${this.closing_tag ? this.closing_tag.treeInspect() : "∅"}\n`; return output; } } export interface SerializedMissingClosingTagError { type: "MISSING_CLOSING_TAG_ERROR"; message: string; location: SerializedLocation; opening_tag: SerializedToken | null; } export interface MissingClosingTagErrorProps { type: string; message: string; location: Location; opening_tag: Token | null; } export class MissingClosingTagError extends HerbError { readonly opening_tag: Token | null; static from(data: SerializedMissingClosingTagError): MissingClosingTagError { return new MissingClosingTagError({ type: data.type, message: data.message, location: Location.from(data.location), opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null, }) } constructor(props: MissingClosingTagErrorProps) { super(props.type, props.message, props.location); this.opening_tag = props.opening_tag; } toJSON(): SerializedMissingClosingTagError { return { ...super.toJSON(), type: "MISSING_CLOSING_TAG_ERROR", opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ MissingClosingTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`; return output; } } export interface SerializedTagNamesMismatchError { type: "TAG_NAMES_MISMATCH_ERROR"; message: string; location: SerializedLocation; opening_tag: SerializedToken | null; closing_tag: SerializedToken | null; } export interface TagNamesMismatchErrorProps { type: string; message: string; location: Location; opening_tag: Token | null; closing_tag: Token | null; } export class TagNamesMismatchError extends HerbError { readonly opening_tag: Token | null; readonly closing_tag: Token | null; static from(data: SerializedTagNamesMismatchError): TagNamesMismatchError { return new TagNamesMismatchError({ type: data.type, message: data.message, location: Location.from(data.location), opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null, closing_tag: data.closing_tag ? Token.from(data.closing_tag) : null, }) } constructor(props: TagNamesMismatchErrorProps) { super(props.type, props.message, props.location); this.opening_tag = props.opening_tag; this.closing_tag = props.closing_tag; } toJSON(): SerializedTagNamesMismatchError { return { ...super.toJSON(), type: "TAG_NAMES_MISMATCH_ERROR", opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null, closing_tag: this.closing_tag ? this.closing_tag.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ TagNamesMismatchError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`; output += `└── closing_tag: ${this.closing_tag ? this.closing_tag.treeInspect() : "∅"}\n`; return output; } } export interface SerializedVoidElementClosingTagError { type: "VOID_ELEMENT_CLOSING_TAG_ERROR"; message: string; location: SerializedLocation; tag_name: SerializedToken | null; expected: string; found: string; } export interface VoidElementClosingTagErrorProps { type: string; message: string; location: Location; tag_name: Token | null; expected: string; found: string; } export class VoidElementClosingTagError extends HerbError { readonly tag_name: Token | null; readonly expected: string; readonly found: string; static from(data: SerializedVoidElementClosingTagError): VoidElementClosingTagError { return new VoidElementClosingTagError({ type: data.type, message: data.message, location: Location.from(data.location), tag_name: data.tag_name ? Token.from(data.tag_name) : null, expected: data.expected, found: data.found, }) } constructor(props: VoidElementClosingTagErrorProps) { super(props.type, props.message, props.location); this.tag_name = props.tag_name; this.expected = props.expected; this.found = props.found; } toJSON(): SerializedVoidElementClosingTagError { return { ...super.toJSON(), type: "VOID_ELEMENT_CLOSING_TAG_ERROR", tag_name: this.tag_name ? this.tag_name.toJSON() : null, expected: this.expected, found: this.found, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ VoidElementClosingTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`; output += `├── expected: ${JSON.stringify(this.expected)}\n`; output += `└── found: ${JSON.stringify(this.found)}\n`; return output; } } export interface SerializedUnclosedElementError { type: "UNCLOSED_ELEMENT_ERROR"; message: string; location: SerializedLocation; opening_tag: SerializedToken | null; } export interface UnclosedElementErrorProps { type: string; message: string; location: Location; opening_tag: Token | null; } export class UnclosedElementError extends HerbError { readonly opening_tag: Token | null; static from(data: SerializedUnclosedElementError): UnclosedElementError { return new UnclosedElementError({ type: data.type, message: data.message, location: Location.from(data.location), opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null, }) } constructor(props: UnclosedElementErrorProps) { super(props.type, props.message, props.location); this.opening_tag = props.opening_tag; } toJSON(): SerializedUnclosedElementError { return { ...super.toJSON(), type: "UNCLOSED_ELEMENT_ERROR", opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ UnclosedElementError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`; return output; } } export interface SerializedRubyParseError { type: "RUBY_PARSE_ERROR"; message: string; location: SerializedLocation; error_message: string; diagnostic_id: string; level: string; } export interface RubyParseErrorProps { type: string; message: string; location: Location; error_message: string; diagnostic_id: string; level: string; } export class RubyParseError extends HerbError { readonly error_message: string; readonly diagnostic_id: string; readonly level: string; static from(data: SerializedRubyParseError): RubyParseError { return new RubyParseError({ type: data.type, message: data.message, location: Location.from(data.location), error_message: data.error_message, diagnostic_id: data.diagnostic_id, level: data.level, }) } constructor(props: RubyParseErrorProps) { super(props.type, props.message, props.location); this.error_message = props.error_message; this.diagnostic_id = props.diagnostic_id; this.level = props.level; } toJSON(): SerializedRubyParseError { return { ...super.toJSON(), type: "RUBY_PARSE_ERROR", error_message: this.error_message, diagnostic_id: this.diagnostic_id, level: this.level, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ RubyParseError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── error_message: ${JSON.stringify(this.error_message)}\n`; output += `├── diagnostic_id: ${JSON.stringify(this.diagnostic_id)}\n`; output += `└── level: ${JSON.stringify(this.level)}\n`; return output; } } export interface SerializedERBControlFlowScopeError { type: "ERB_CONTROL_FLOW_SCOPE_ERROR"; message: string; location: SerializedLocation; keyword: string; } export interface ERBControlFlowScopeErrorProps { type: string; message: string; location: Location; keyword: string; } export class ERBControlFlowScopeError extends HerbError { readonly keyword: string; static from(data: SerializedERBControlFlowScopeError): ERBControlFlowScopeError { return new ERBControlFlowScopeError({ type: data.type, message: data.message, location: Location.from(data.location), keyword: data.keyword, }) } constructor(props: ERBControlFlowScopeErrorProps) { super(props.type, props.message, props.location); this.keyword = props.keyword; } toJSON(): SerializedERBControlFlowScopeError { return { ...super.toJSON(), type: "ERB_CONTROL_FLOW_SCOPE_ERROR", keyword: this.keyword, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ ERBControlFlowScopeError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── keyword: ${JSON.stringify(this.keyword)}\n`; return output; } } export interface SerializedMissingERBEndTagError { type: "MISSING_ERB_END_TAG_ERROR"; message: string; location: SerializedLocation; keyword: string; } export interface MissingERBEndTagErrorProps { type: string; message: string; location: Location; keyword: string; } export class MissingERBEndTagError extends HerbError { readonly keyword: string; static from(data: SerializedMissingERBEndTagError): MissingERBEndTagError { return new MissingERBEndTagError({ type: data.type, message: data.message, location: Location.from(data.location), keyword: data.keyword, }) } constructor(props: MissingERBEndTagErrorProps) { super(props.type, props.message, props.location); this.keyword = props.keyword; } toJSON(): SerializedMissingERBEndTagError { return { ...super.toJSON(), type: "MISSING_ERB_END_TAG_ERROR", keyword: this.keyword, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ MissingERBEndTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── keyword: ${JSON.stringify(this.keyword)}\n`; return output; } } export interface SerializedERBMultipleBlocksInTagError { type: "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR"; message: string; location: SerializedLocation; } export interface ERBMultipleBlocksInTagErrorProps { type: string; message: string; location: Location; } export class ERBMultipleBlocksInTagError extends HerbError { static from(data: SerializedERBMultipleBlocksInTagError): ERBMultipleBlocksInTagError { return new ERBMultipleBlocksInTagError({ type: data.type, message: data.message, location: Location.from(data.location), }) } constructor(props: ERBMultipleBlocksInTagErrorProps) { super(props.type, props.message, props.location); } toJSON(): SerializedERBMultipleBlocksInTagError { return { ...super.toJSON(), type: "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR", }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ ERBMultipleBlocksInTagError ${this.location.treeInspectWithLabel()}\n`; output += `└── message: "${this.message}"\n`; return output; } } export interface SerializedERBCaseWithConditionsError { type: "ERB_CASE_WITH_CONDITIONS_ERROR"; message: string; location: SerializedLocation; } export interface ERBCaseWithConditionsErrorProps { type: string; message: string; location: Location; } export class ERBCaseWithConditionsError extends HerbError { static from(data: SerializedERBCaseWithConditionsError): ERBCaseWithConditionsError { return new ERBCaseWithConditionsError({ type: data.type, message: data.message, location: Location.from(data.location), }) } constructor(props: ERBCaseWithConditionsErrorProps) { super(props.type, props.message, props.location); } toJSON(): SerializedERBCaseWithConditionsError { return { ...super.toJSON(), type: "ERB_CASE_WITH_CONDITIONS_ERROR", }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ ERBCaseWithConditionsError ${this.location.treeInspectWithLabel()}\n`; output += `└── message: "${this.message}"\n`; return output; } } export interface SerializedConditionalElementMultipleTagsError { type: "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR"; message: string; location: SerializedLocation; line: any; // # column: any; // # } export interface ConditionalElementMultipleTagsErrorProps { type: string; message: string; location: Location; line: any; // # column: any; // # } export class ConditionalElementMultipleTagsError extends HerbError { readonly line: any; readonly column: any; static from(data: SerializedConditionalElementMultipleTagsError): ConditionalElementMultipleTagsError { return new ConditionalElementMultipleTagsError({ type: data.type, message: data.message, location: Location.from(data.location), line: data.line, column: data.column, }) } constructor(props: ConditionalElementMultipleTagsErrorProps) { super(props.type, props.message, props.location); this.line = props.line; this.column = props.column; } toJSON(): SerializedConditionalElementMultipleTagsError { return { ...super.toJSON(), type: "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR", line: this.line, column: this.column, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ ConditionalElementMultipleTagsError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── line: ${JSON.stringify(this.line)}\n`; output += `└── column: ${JSON.stringify(this.column)}\n`; return output; } } export interface SerializedConditionalElementConditionMismatchError { type: "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR"; message: string; location: SerializedLocation; tag_name: string; open_condition: string; open_line: any; // # open_column: any; // # close_condition: string; close_line: any; // # close_column: any; // # } export interface ConditionalElementConditionMismatchErrorProps { type: string; message: string; location: Location; tag_name: string; open_condition: string; open_line: any; // # open_column: any; // # close_condition: string; close_line: any; // # close_column: any; // # } export class ConditionalElementConditionMismatchError extends HerbError { readonly tag_name: string; readonly open_condition: string; readonly open_line: any; readonly open_column: any; readonly close_condition: string; readonly close_line: any; readonly close_column: any; static from(data: SerializedConditionalElementConditionMismatchError): ConditionalElementConditionMismatchError { return new ConditionalElementConditionMismatchError({ type: data.type, message: data.message, location: Location.from(data.location), tag_name: data.tag_name, open_condition: data.open_condition, open_line: data.open_line, open_column: data.open_column, close_condition: data.close_condition, close_line: data.close_line, close_column: data.close_column, }) } constructor(props: ConditionalElementConditionMismatchErrorProps) { super(props.type, props.message, props.location); this.tag_name = props.tag_name; this.open_condition = props.open_condition; this.open_line = props.open_line; this.open_column = props.open_column; this.close_condition = props.close_condition; this.close_line = props.close_line; this.close_column = props.close_column; } toJSON(): SerializedConditionalElementConditionMismatchError { return { ...super.toJSON(), type: "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR", tag_name: this.tag_name, open_condition: this.open_condition, open_line: this.open_line, open_column: this.open_column, close_condition: this.close_condition, close_line: this.close_line, close_column: this.close_column, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ ConditionalElementConditionMismatchError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── tag_name: ${JSON.stringify(this.tag_name)}\n`; output += `├── open_condition: ${JSON.stringify(this.open_condition)}\n`; output += `├── open_line: ${JSON.stringify(this.open_line)}\n`; output += `├── open_column: ${JSON.stringify(this.open_column)}\n`; output += `├── close_condition: ${JSON.stringify(this.close_condition)}\n`; output += `├── close_line: ${JSON.stringify(this.close_line)}\n`; output += `└── close_column: ${JSON.stringify(this.close_column)}\n`; return output; } } export interface SerializedInvalidCommentClosingTagError { type: "INVALID_COMMENT_CLOSING_TAG_ERROR"; message: string; location: SerializedLocation; closing_tag: SerializedToken | null; } export interface InvalidCommentClosingTagErrorProps { type: string; message: string; location: Location; closing_tag: Token | null; } export class InvalidCommentClosingTagError extends HerbError { readonly closing_tag: Token | null; static from(data: SerializedInvalidCommentClosingTagError): InvalidCommentClosingTagError { return new InvalidCommentClosingTagError({ type: data.type, message: data.message, location: Location.from(data.location), closing_tag: data.closing_tag ? Token.from(data.closing_tag) : null, }) } constructor(props: InvalidCommentClosingTagErrorProps) { super(props.type, props.message, props.location); this.closing_tag = props.closing_tag; } toJSON(): SerializedInvalidCommentClosingTagError { return { ...super.toJSON(), type: "INVALID_COMMENT_CLOSING_TAG_ERROR", closing_tag: this.closing_tag ? this.closing_tag.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ InvalidCommentClosingTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── closing_tag: ${this.closing_tag ? this.closing_tag.treeInspect() : "∅"}\n`; return output; } } export interface SerializedOmittedClosingTagError { type: "OMITTED_CLOSING_TAG_ERROR"; message: string; location: SerializedLocation; opening_tag: SerializedToken | null; insertion_point: SerializedPosition; } export interface OmittedClosingTagErrorProps { type: string; message: string; location: Location; opening_tag: Token | null; insertion_point: Position; } export class OmittedClosingTagError extends HerbError { readonly opening_tag: Token | null; readonly insertion_point: Position; static from(data: SerializedOmittedClosingTagError): OmittedClosingTagError { return new OmittedClosingTagError({ type: data.type, message: data.message, location: Location.from(data.location), opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null, insertion_point: Position.from(data.insertion_point), }) } constructor(props: OmittedClosingTagErrorProps) { super(props.type, props.message, props.location); this.opening_tag = props.opening_tag; this.insertion_point = props.insertion_point; } toJSON(): SerializedOmittedClosingTagError { return { ...super.toJSON(), type: "OMITTED_CLOSING_TAG_ERROR", opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null, insertion_point: this.insertion_point.toJSON(), }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ OmittedClosingTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`; output += `└── insertion_point: (${this.insertion_point.line}:${this.insertion_point.column})\n`; return output; } } export interface SerializedUnclosedOpenTagError { type: "UNCLOSED_OPEN_TAG_ERROR"; message: string; location: SerializedLocation; tag_name: SerializedToken | null; } export interface UnclosedOpenTagErrorProps { type: string; message: string; location: Location; tag_name: Token | null; } export class UnclosedOpenTagError extends HerbError { readonly tag_name: Token | null; static from(data: SerializedUnclosedOpenTagError): UnclosedOpenTagError { return new UnclosedOpenTagError({ type: data.type, message: data.message, location: Location.from(data.location), tag_name: data.tag_name ? Token.from(data.tag_name) : null, }) } constructor(props: UnclosedOpenTagErrorProps) { super(props.type, props.message, props.location); this.tag_name = props.tag_name; } toJSON(): SerializedUnclosedOpenTagError { return { ...super.toJSON(), type: "UNCLOSED_OPEN_TAG_ERROR", tag_name: this.tag_name ? this.tag_name.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ UnclosedOpenTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`; return output; } } export interface SerializedUnclosedCloseTagError { type: "UNCLOSED_CLOSE_TAG_ERROR"; message: string; location: SerializedLocation; tag_name: SerializedToken | null; } export interface UnclosedCloseTagErrorProps { type: string; message: string; location: Location; tag_name: Token | null; } export class UnclosedCloseTagError extends HerbError { readonly tag_name: Token | null; static from(data: SerializedUnclosedCloseTagError): UnclosedCloseTagError { return new UnclosedCloseTagError({ type: data.type, message: data.message, location: Location.from(data.location), tag_name: data.tag_name ? Token.from(data.tag_name) : null, }) } constructor(props: UnclosedCloseTagErrorProps) { super(props.type, props.message, props.location); this.tag_name = props.tag_name; } toJSON(): SerializedUnclosedCloseTagError { return { ...super.toJSON(), type: "UNCLOSED_CLOSE_TAG_ERROR", tag_name: this.tag_name ? this.tag_name.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ UnclosedCloseTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`; return output; } } export interface SerializedUnclosedQuoteError { type: "UNCLOSED_QUOTE_ERROR"; message: string; location: SerializedLocation; opening_quote: SerializedToken | null; } export interface UnclosedQuoteErrorProps { type: string; message: string; location: Location; opening_quote: Token | null; } export class UnclosedQuoteError extends HerbError { readonly opening_quote: Token | null; static from(data: SerializedUnclosedQuoteError): UnclosedQuoteError { return new UnclosedQuoteError({ type: data.type, message: data.message, location: Location.from(data.location), opening_quote: data.opening_quote ? Token.from(data.opening_quote) : null, }) } constructor(props: UnclosedQuoteErrorProps) { super(props.type, props.message, props.location); this.opening_quote = props.opening_quote; } toJSON(): SerializedUnclosedQuoteError { return { ...super.toJSON(), type: "UNCLOSED_QUOTE_ERROR", opening_quote: this.opening_quote ? this.opening_quote.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ UnclosedQuoteError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── opening_quote: ${this.opening_quote ? this.opening_quote.treeInspect() : "∅"}\n`; return output; } } export interface SerializedMissingAttributeValueError { type: "MISSING_ATTRIBUTE_VALUE_ERROR"; message: string; location: SerializedLocation; attribute_name: string; } export interface MissingAttributeValueErrorProps { type: string; message: string; location: Location; attribute_name: string; } export class MissingAttributeValueError extends HerbError { readonly attribute_name: string; static from(data: SerializedMissingAttributeValueError): MissingAttributeValueError { return new MissingAttributeValueError({ type: data.type, message: data.message, location: Location.from(data.location), attribute_name: data.attribute_name, }) } constructor(props: MissingAttributeValueErrorProps) { super(props.type, props.message, props.location); this.attribute_name = props.attribute_name; } toJSON(): SerializedMissingAttributeValueError { return { ...super.toJSON(), type: "MISSING_ATTRIBUTE_VALUE_ERROR", attribute_name: this.attribute_name, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ MissingAttributeValueError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── attribute_name: ${JSON.stringify(this.attribute_name)}\n`; return output; } } export interface SerializedUnclosedERBTagError { type: "UNCLOSED_ERB_TAG_ERROR"; message: string; location: SerializedLocation; opening_tag: SerializedToken | null; } export interface UnclosedERBTagErrorProps { type: string; message: string; location: Location; opening_tag: Token | null; } export class UnclosedERBTagError extends HerbError { readonly opening_tag: Token | null; static from(data: SerializedUnclosedERBTagError): UnclosedERBTagError { return new UnclosedERBTagError({ type: data.type, message: data.message, location: Location.from(data.location), opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null, }) } constructor(props: UnclosedERBTagErrorProps) { super(props.type, props.message, props.location); this.opening_tag = props.opening_tag; } toJSON(): SerializedUnclosedERBTagError { return { ...super.toJSON(), type: "UNCLOSED_ERB_TAG_ERROR", opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ UnclosedERBTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`; return output; } } export interface SerializedStrayERBClosingTagError { type: "STRAY_ERB_CLOSING_TAG_ERROR"; message: string; location: SerializedLocation; } export interface StrayERBClosingTagErrorProps { type: string; message: string; location: Location; } export class StrayERBClosingTagError extends HerbError { static from(data: SerializedStrayERBClosingTagError): StrayERBClosingTagError { return new StrayERBClosingTagError({ type: data.type, message: data.message, location: Location.from(data.location), }) } constructor(props: StrayERBClosingTagErrorProps) { super(props.type, props.message, props.location); } toJSON(): SerializedStrayERBClosingTagError { return { ...super.toJSON(), type: "STRAY_ERB_CLOSING_TAG_ERROR", }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ StrayERBClosingTagError ${this.location.treeInspectWithLabel()}\n`; output += `└── message: "${this.message}"\n`; return output; } } export interface SerializedNestedERBTagError { type: "NESTED_ERB_TAG_ERROR"; message: string; location: SerializedLocation; opening_tag: SerializedToken | null; nested_tag_line: any; // # nested_tag_column: any; // # } export interface NestedERBTagErrorProps { type: string; message: string; location: Location; opening_tag: Token | null; nested_tag_line: any; // # nested_tag_column: any; // # } export class NestedERBTagError extends HerbError { readonly opening_tag: Token | null; readonly nested_tag_line: any; readonly nested_tag_column: any; static from(data: SerializedNestedERBTagError): NestedERBTagError { return new NestedERBTagError({ type: data.type, message: data.message, location: Location.from(data.location), opening_tag: data.opening_tag ? Token.from(data.opening_tag) : null, nested_tag_line: data.nested_tag_line, nested_tag_column: data.nested_tag_column, }) } constructor(props: NestedERBTagErrorProps) { super(props.type, props.message, props.location); this.opening_tag = props.opening_tag; this.nested_tag_line = props.nested_tag_line; this.nested_tag_column = props.nested_tag_column; } toJSON(): SerializedNestedERBTagError { return { ...super.toJSON(), type: "NESTED_ERB_TAG_ERROR", opening_tag: this.opening_tag ? this.opening_tag.toJSON() : null, nested_tag_line: this.nested_tag_line, nested_tag_column: this.nested_tag_column, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ NestedERBTagError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── opening_tag: ${this.opening_tag ? this.opening_tag.treeInspect() : "∅"}\n`; output += `├── nested_tag_line: ${JSON.stringify(this.nested_tag_line)}\n`; output += `└── nested_tag_column: ${JSON.stringify(this.nested_tag_column)}\n`; return output; } } export interface SerializedRenderAmbiguousLocalsError { type: "RENDER_AMBIGUOUS_LOCALS_ERROR"; message: string; location: SerializedLocation; partial: string; } export interface RenderAmbiguousLocalsErrorProps { type: string; message: string; location: Location; partial: string; } export class RenderAmbiguousLocalsError extends HerbError { readonly partial: string; static from(data: SerializedRenderAmbiguousLocalsError): RenderAmbiguousLocalsError { return new RenderAmbiguousLocalsError({ type: data.type, message: data.message, location: Location.from(data.location), partial: data.partial, }) } constructor(props: RenderAmbiguousLocalsErrorProps) { super(props.type, props.message, props.location); this.partial = props.partial; } toJSON(): SerializedRenderAmbiguousLocalsError { return { ...super.toJSON(), type: "RENDER_AMBIGUOUS_LOCALS_ERROR", partial: this.partial, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ RenderAmbiguousLocalsError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── partial: ${JSON.stringify(this.partial)}\n`; return output; } } export interface SerializedRenderMissingLocalsError { type: "RENDER_MISSING_LOCALS_ERROR"; message: string; location: SerializedLocation; partial: string; keywords: string; } export interface RenderMissingLocalsErrorProps { type: string; message: string; location: Location; partial: string; keywords: string; } export class RenderMissingLocalsError extends HerbError { readonly partial: string; readonly keywords: string; static from(data: SerializedRenderMissingLocalsError): RenderMissingLocalsError { return new RenderMissingLocalsError({ type: data.type, message: data.message, location: Location.from(data.location), partial: data.partial, keywords: data.keywords, }) } constructor(props: RenderMissingLocalsErrorProps) { super(props.type, props.message, props.location); this.partial = props.partial; this.keywords = props.keywords; } toJSON(): SerializedRenderMissingLocalsError { return { ...super.toJSON(), type: "RENDER_MISSING_LOCALS_ERROR", partial: this.partial, keywords: this.keywords, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ RenderMissingLocalsError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── partial: ${JSON.stringify(this.partial)}\n`; output += `└── keywords: ${JSON.stringify(this.keywords)}\n`; return output; } } export interface SerializedRenderNoArgumentsError { type: "RENDER_NO_ARGUMENTS_ERROR"; message: string; location: SerializedLocation; } export interface RenderNoArgumentsErrorProps { type: string; message: string; location: Location; } export class RenderNoArgumentsError extends HerbError { static from(data: SerializedRenderNoArgumentsError): RenderNoArgumentsError { return new RenderNoArgumentsError({ type: data.type, message: data.message, location: Location.from(data.location), }) } constructor(props: RenderNoArgumentsErrorProps) { super(props.type, props.message, props.location); } toJSON(): SerializedRenderNoArgumentsError { return { ...super.toJSON(), type: "RENDER_NO_ARGUMENTS_ERROR", }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ RenderNoArgumentsError ${this.location.treeInspectWithLabel()}\n`; output += `└── message: "${this.message}"\n`; return output; } } export interface SerializedRenderConflictingPartialError { type: "RENDER_CONFLICTING_PARTIAL_ERROR"; message: string; location: SerializedLocation; positional_partial: string; keyword_partial: string; } export interface RenderConflictingPartialErrorProps { type: string; message: string; location: Location; positional_partial: string; keyword_partial: string; } export class RenderConflictingPartialError extends HerbError { readonly positional_partial: string; readonly keyword_partial: string; static from(data: SerializedRenderConflictingPartialError): RenderConflictingPartialError { return new RenderConflictingPartialError({ type: data.type, message: data.message, location: Location.from(data.location), positional_partial: data.positional_partial, keyword_partial: data.keyword_partial, }) } constructor(props: RenderConflictingPartialErrorProps) { super(props.type, props.message, props.location); this.positional_partial = props.positional_partial; this.keyword_partial = props.keyword_partial; } toJSON(): SerializedRenderConflictingPartialError { return { ...super.toJSON(), type: "RENDER_CONFLICTING_PARTIAL_ERROR", positional_partial: this.positional_partial, keyword_partial: this.keyword_partial, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ RenderConflictingPartialError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── positional_partial: ${JSON.stringify(this.positional_partial)}\n`; output += `└── keyword_partial: ${JSON.stringify(this.keyword_partial)}\n`; return output; } } export interface SerializedRenderInvalidAsOptionError { type: "RENDER_INVALID_AS_OPTION_ERROR"; message: string; location: SerializedLocation; as_value: string; } export interface RenderInvalidAsOptionErrorProps { type: string; message: string; location: Location; as_value: string; } export class RenderInvalidAsOptionError extends HerbError { readonly as_value: string; static from(data: SerializedRenderInvalidAsOptionError): RenderInvalidAsOptionError { return new RenderInvalidAsOptionError({ type: data.type, message: data.message, location: Location.from(data.location), as_value: data.as_value, }) } constructor(props: RenderInvalidAsOptionErrorProps) { super(props.type, props.message, props.location); this.as_value = props.as_value; } toJSON(): SerializedRenderInvalidAsOptionError { return { ...super.toJSON(), type: "RENDER_INVALID_AS_OPTION_ERROR", as_value: this.as_value, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ RenderInvalidAsOptionError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── as_value: ${JSON.stringify(this.as_value)}\n`; return output; } } export interface SerializedRenderObjectAndCollectionError { type: "RENDER_OBJECT_AND_COLLECTION_ERROR"; message: string; location: SerializedLocation; } export interface RenderObjectAndCollectionErrorProps { type: string; message: string; location: Location; } export class RenderObjectAndCollectionError extends HerbError { static from(data: SerializedRenderObjectAndCollectionError): RenderObjectAndCollectionError { return new RenderObjectAndCollectionError({ type: data.type, message: data.message, location: Location.from(data.location), }) } constructor(props: RenderObjectAndCollectionErrorProps) { super(props.type, props.message, props.location); } toJSON(): SerializedRenderObjectAndCollectionError { return { ...super.toJSON(), type: "RENDER_OBJECT_AND_COLLECTION_ERROR", }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ RenderObjectAndCollectionError ${this.location.treeInspectWithLabel()}\n`; output += `└── message: "${this.message}"\n`; return output; } } export interface SerializedRenderLayoutWithoutBlockError { type: "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR"; message: string; location: SerializedLocation; layout: string; } export interface RenderLayoutWithoutBlockErrorProps { type: string; message: string; location: Location; layout: string; } export class RenderLayoutWithoutBlockError extends HerbError { readonly layout: string; static from(data: SerializedRenderLayoutWithoutBlockError): RenderLayoutWithoutBlockError { return new RenderLayoutWithoutBlockError({ type: data.type, message: data.message, location: Location.from(data.location), layout: data.layout, }) } constructor(props: RenderLayoutWithoutBlockErrorProps) { super(props.type, props.message, props.location); this.layout = props.layout; } toJSON(): SerializedRenderLayoutWithoutBlockError { return { ...super.toJSON(), type: "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR", layout: this.layout, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ RenderLayoutWithoutBlockError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── layout: ${JSON.stringify(this.layout)}\n`; return output; } } export interface SerializedStrictLocalsPositionalArgumentError { type: "STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR"; message: string; location: SerializedLocation; name: string; } export interface StrictLocalsPositionalArgumentErrorProps { type: string; message: string; location: Location; name: string; } export class StrictLocalsPositionalArgumentError extends HerbError { readonly name: string; static from(data: SerializedStrictLocalsPositionalArgumentError): StrictLocalsPositionalArgumentError { return new StrictLocalsPositionalArgumentError({ type: data.type, message: data.message, location: Location.from(data.location), name: data.name, }) } constructor(props: StrictLocalsPositionalArgumentErrorProps) { super(props.type, props.message, props.location); this.name = props.name; } toJSON(): SerializedStrictLocalsPositionalArgumentError { return { ...super.toJSON(), type: "STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR", name: this.name, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ StrictLocalsPositionalArgumentError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── name: ${JSON.stringify(this.name)}\n`; return output; } } export interface SerializedStrictLocalsBlockArgumentError { type: "STRICT_LOCALS_BLOCK_ARGUMENT_ERROR"; message: string; location: SerializedLocation; name: string; } export interface StrictLocalsBlockArgumentErrorProps { type: string; message: string; location: Location; name: string; } export class StrictLocalsBlockArgumentError extends HerbError { readonly name: string; static from(data: SerializedStrictLocalsBlockArgumentError): StrictLocalsBlockArgumentError { return new StrictLocalsBlockArgumentError({ type: data.type, message: data.message, location: Location.from(data.location), name: data.name, }) } constructor(props: StrictLocalsBlockArgumentErrorProps) { super(props.type, props.message, props.location); this.name = props.name; } toJSON(): SerializedStrictLocalsBlockArgumentError { return { ...super.toJSON(), type: "STRICT_LOCALS_BLOCK_ARGUMENT_ERROR", name: this.name, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ StrictLocalsBlockArgumentError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── name: ${JSON.stringify(this.name)}\n`; return output; } } export interface SerializedStrictLocalsSplatArgumentError { type: "STRICT_LOCALS_SPLAT_ARGUMENT_ERROR"; message: string; location: SerializedLocation; name: string; } export interface StrictLocalsSplatArgumentErrorProps { type: string; message: string; location: Location; name: string; } export class StrictLocalsSplatArgumentError extends HerbError { readonly name: string; static from(data: SerializedStrictLocalsSplatArgumentError): StrictLocalsSplatArgumentError { return new StrictLocalsSplatArgumentError({ type: data.type, message: data.message, location: Location.from(data.location), name: data.name, }) } constructor(props: StrictLocalsSplatArgumentErrorProps) { super(props.type, props.message, props.location); this.name = props.name; } toJSON(): SerializedStrictLocalsSplatArgumentError { return { ...super.toJSON(), type: "STRICT_LOCALS_SPLAT_ARGUMENT_ERROR", name: this.name, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ StrictLocalsSplatArgumentError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── name: ${JSON.stringify(this.name)}\n`; return output; } } export interface SerializedStrictLocalsMissingParenthesisError { type: "STRICT_LOCALS_MISSING_PARENTHESIS_ERROR"; message: string; location: SerializedLocation; rest: string; } export interface StrictLocalsMissingParenthesisErrorProps { type: string; message: string; location: Location; rest: string; } export class StrictLocalsMissingParenthesisError extends HerbError { readonly rest: string; static from(data: SerializedStrictLocalsMissingParenthesisError): StrictLocalsMissingParenthesisError { return new StrictLocalsMissingParenthesisError({ type: data.type, message: data.message, location: Location.from(data.location), rest: data.rest, }) } constructor(props: StrictLocalsMissingParenthesisErrorProps) { super(props.type, props.message, props.location); this.rest = props.rest; } toJSON(): SerializedStrictLocalsMissingParenthesisError { return { ...super.toJSON(), type: "STRICT_LOCALS_MISSING_PARENTHESIS_ERROR", rest: this.rest, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ StrictLocalsMissingParenthesisError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── rest: ${JSON.stringify(this.rest)}\n`; return output; } } export interface SerializedStrictLocalsDuplicateDeclarationError { type: "STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR"; message: string; location: SerializedLocation; } export interface StrictLocalsDuplicateDeclarationErrorProps { type: string; message: string; location: Location; } export class StrictLocalsDuplicateDeclarationError extends HerbError { static from(data: SerializedStrictLocalsDuplicateDeclarationError): StrictLocalsDuplicateDeclarationError { return new StrictLocalsDuplicateDeclarationError({ type: data.type, message: data.message, location: Location.from(data.location), }) } constructor(props: StrictLocalsDuplicateDeclarationErrorProps) { super(props.type, props.message, props.location); } toJSON(): SerializedStrictLocalsDuplicateDeclarationError { return { ...super.toJSON(), type: "STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR", }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ StrictLocalsDuplicateDeclarationError ${this.location.treeInspectWithLabel()}\n`; output += `└── message: "${this.message}"\n`; return output; } } export interface SerializedVoidElementContentError { type: "VOID_ELEMENT_CONTENT_ERROR"; message: string; location: SerializedLocation; tag_name: SerializedToken | null; helper_name: string; content_type: string; } export interface VoidElementContentErrorProps { type: string; message: string; location: Location; tag_name: Token | null; helper_name: string; content_type: string; } export class VoidElementContentError extends HerbError { readonly tag_name: Token | null; readonly helper_name: string; readonly content_type: string; static from(data: SerializedVoidElementContentError): VoidElementContentError { return new VoidElementContentError({ type: data.type, message: data.message, location: Location.from(data.location), tag_name: data.tag_name ? Token.from(data.tag_name) : null, helper_name: data.helper_name, content_type: data.content_type, }) } constructor(props: VoidElementContentErrorProps) { super(props.type, props.message, props.location); this.tag_name = props.tag_name; this.helper_name = props.helper_name; this.content_type = props.content_type; } toJSON(): SerializedVoidElementContentError { return { ...super.toJSON(), type: "VOID_ELEMENT_CONTENT_ERROR", tag_name: this.tag_name ? this.tag_name.toJSON() : null, helper_name: this.helper_name, content_type: this.content_type, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ VoidElementContentError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `├── tag_name: ${this.tag_name ? this.tag_name.treeInspect() : "∅"}\n`; output += `├── helper_name: ${JSON.stringify(this.helper_name)}\n`; output += `└── content_type: ${JSON.stringify(this.content_type)}\n`; return output; } } export interface SerializedDotNotationCasingError { type: "DOT_NOTATION_CASING_ERROR"; message: string; location: SerializedLocation; segment: SerializedToken | null; } export interface DotNotationCasingErrorProps { type: string; message: string; location: Location; segment: Token | null; } export class DotNotationCasingError extends HerbError { readonly segment: Token | null; static from(data: SerializedDotNotationCasingError): DotNotationCasingError { return new DotNotationCasingError({ type: data.type, message: data.message, location: Location.from(data.location), segment: data.segment ? Token.from(data.segment) : null, }) } constructor(props: DotNotationCasingErrorProps) { super(props.type, props.message, props.location); this.segment = props.segment; } toJSON(): SerializedDotNotationCasingError { return { ...super.toJSON(), type: "DOT_NOTATION_CASING_ERROR", segment: this.segment ? this.segment.toJSON() : null, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ DotNotationCasingError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── segment: ${this.segment ? this.segment.treeInspect() : "∅"}\n`; return output; } } export interface SerializedTimeoutError { type: "TIMEOUT_ERROR"; message: string; location: SerializedLocation; timeout_ms: any; // # } export interface TimeoutErrorProps { type: string; message: string; location: Location; timeout_ms: any; // # } export class TimeoutError extends HerbError { readonly timeout_ms: any; static from(data: SerializedTimeoutError): TimeoutError { return new TimeoutError({ type: data.type, message: data.message, location: Location.from(data.location), timeout_ms: data.timeout_ms, }) } constructor(props: TimeoutErrorProps) { super(props.type, props.message, props.location); this.timeout_ms = props.timeout_ms; } toJSON(): SerializedTimeoutError { return { ...super.toJSON(), type: "TIMEOUT_ERROR", timeout_ms: this.timeout_ms, }; } toMonacoDiagnostic(): MonacoDiagnostic { return { line: this.location.start.line, column: this.location.start.column, endLine: this.location.end.line, endColumn: this.location.end.column, message: this.message, severity: 'error' } } treeInspect(): string { let output = ""; output += `@ TimeoutError ${this.location.treeInspectWithLabel()}\n`; output += `├── message: "${this.message}"\n`; output += `└── timeout_ms: ${JSON.stringify(this.timeout_ms)}\n`; return output; } } export function fromSerializedError(error: SerializedHerbError): HerbError { switch (error.type) { case "UNEXPECTED_ERROR": return UnexpectedError.from(error as SerializedUnexpectedError); case "UNEXPECTED_TOKEN_ERROR": return UnexpectedTokenError.from(error as SerializedUnexpectedTokenError); case "MISSING_OPENING_TAG_ERROR": return MissingOpeningTagError.from(error as SerializedMissingOpeningTagError); case "MISSING_CLOSING_TAG_ERROR": return MissingClosingTagError.from(error as SerializedMissingClosingTagError); case "TAG_NAMES_MISMATCH_ERROR": return TagNamesMismatchError.from(error as SerializedTagNamesMismatchError); case "VOID_ELEMENT_CLOSING_TAG_ERROR": return VoidElementClosingTagError.from(error as SerializedVoidElementClosingTagError); case "UNCLOSED_ELEMENT_ERROR": return UnclosedElementError.from(error as SerializedUnclosedElementError); case "RUBY_PARSE_ERROR": return RubyParseError.from(error as SerializedRubyParseError); case "ERB_CONTROL_FLOW_SCOPE_ERROR": return ERBControlFlowScopeError.from(error as SerializedERBControlFlowScopeError); case "MISSING_ERB_END_TAG_ERROR": return MissingERBEndTagError.from(error as SerializedMissingERBEndTagError); case "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR": return ERBMultipleBlocksInTagError.from(error as SerializedERBMultipleBlocksInTagError); case "ERB_CASE_WITH_CONDITIONS_ERROR": return ERBCaseWithConditionsError.from(error as SerializedERBCaseWithConditionsError); case "CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR": return ConditionalElementMultipleTagsError.from(error as SerializedConditionalElementMultipleTagsError); case "CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR": return ConditionalElementConditionMismatchError.from(error as SerializedConditionalElementConditionMismatchError); case "INVALID_COMMENT_CLOSING_TAG_ERROR": return InvalidCommentClosingTagError.from(error as SerializedInvalidCommentClosingTagError); case "OMITTED_CLOSING_TAG_ERROR": return OmittedClosingTagError.from(error as SerializedOmittedClosingTagError); case "UNCLOSED_OPEN_TAG_ERROR": return UnclosedOpenTagError.from(error as SerializedUnclosedOpenTagError); case "UNCLOSED_CLOSE_TAG_ERROR": return UnclosedCloseTagError.from(error as SerializedUnclosedCloseTagError); case "UNCLOSED_QUOTE_ERROR": return UnclosedQuoteError.from(error as SerializedUnclosedQuoteError); case "MISSING_ATTRIBUTE_VALUE_ERROR": return MissingAttributeValueError.from(error as SerializedMissingAttributeValueError); case "UNCLOSED_ERB_TAG_ERROR": return UnclosedERBTagError.from(error as SerializedUnclosedERBTagError); case "STRAY_ERB_CLOSING_TAG_ERROR": return StrayERBClosingTagError.from(error as SerializedStrayERBClosingTagError); case "NESTED_ERB_TAG_ERROR": return NestedERBTagError.from(error as SerializedNestedERBTagError); case "RENDER_AMBIGUOUS_LOCALS_ERROR": return RenderAmbiguousLocalsError.from(error as SerializedRenderAmbiguousLocalsError); case "RENDER_MISSING_LOCALS_ERROR": return RenderMissingLocalsError.from(error as SerializedRenderMissingLocalsError); case "RENDER_NO_ARGUMENTS_ERROR": return RenderNoArgumentsError.from(error as SerializedRenderNoArgumentsError); case "RENDER_CONFLICTING_PARTIAL_ERROR": return RenderConflictingPartialError.from(error as SerializedRenderConflictingPartialError); case "RENDER_INVALID_AS_OPTION_ERROR": return RenderInvalidAsOptionError.from(error as SerializedRenderInvalidAsOptionError); case "RENDER_OBJECT_AND_COLLECTION_ERROR": return RenderObjectAndCollectionError.from(error as SerializedRenderObjectAndCollectionError); case "RENDER_LAYOUT_WITHOUT_BLOCK_ERROR": return RenderLayoutWithoutBlockError.from(error as SerializedRenderLayoutWithoutBlockError); case "STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR": return StrictLocalsPositionalArgumentError.from(error as SerializedStrictLocalsPositionalArgumentError); case "STRICT_LOCALS_BLOCK_ARGUMENT_ERROR": return StrictLocalsBlockArgumentError.from(error as SerializedStrictLocalsBlockArgumentError); case "STRICT_LOCALS_SPLAT_ARGUMENT_ERROR": return StrictLocalsSplatArgumentError.from(error as SerializedStrictLocalsSplatArgumentError); case "STRICT_LOCALS_MISSING_PARENTHESIS_ERROR": return StrictLocalsMissingParenthesisError.from(error as SerializedStrictLocalsMissingParenthesisError); case "STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR": return StrictLocalsDuplicateDeclarationError.from(error as SerializedStrictLocalsDuplicateDeclarationError); case "VOID_ELEMENT_CONTENT_ERROR": return VoidElementContentError.from(error as SerializedVoidElementContentError); case "DOT_NOTATION_CASING_ERROR": return DotNotationCasingError.from(error as SerializedDotNotationCasingError); case "TIMEOUT_ERROR": return TimeoutError.from(error as SerializedTimeoutError); default: throw new Error(`Unknown node type: ${error.type}`); } }