// NOTE: This file is generated by the templates/template.rb script and should not // be modified manually. See templates/javascript/packages/core/src/parser-options.ts.erb export interface LexOptions { /** ERB tag openers recognized in addition to the built-in ones, written without the leading `<%`. */ erb_openers?: string[] } export interface ParseOptions extends LexOptions { /** Whether ActionView tag helper transformation was enabled during parsing. */ action_view_helpers?: boolean /** Whether analysis was performed during parsing. */ analyze?: boolean /** Whether dot-notation component tags (e.g. Dialog.Button) are parsed as HTML elements. */ dot_notation_tags?: boolean /** Whether `<%# herb: %>` directive nodes were parsed during parsing. */ herb_directives?: boolean /** Whether HTML tag parsing is enabled during parsing. When false, HTML-like content is treated as literal text. */ html?: boolean /** Whether iteration nodes were parsed during parsing. */ iteration_nodes?: boolean /** Maximum number of errors to report. nil/null means unlimited. */ max_errors?: number | null /** Whether Prism node serialization was enabled during parsing. */ prism_nodes?: boolean /** Whether deep Prism node serialization was enabled during parsing. */ prism_nodes_deep?: boolean /** Whether the full Prism ProgramNode was serialized on the DocumentNode. */ prism_program?: boolean /** Whether ActionView render call detection was enabled during parsing. */ render_nodes?: boolean /** Ruby version whose syntax Prism parses the ERB content with, such as `"3.4"`. Defaults to the latest released Ruby. */ ruby_version?: string | null /** Whether strict mode was enabled during parsing. */ strict?: boolean /** Whether strict locals analysis was enabled during parsing. */ strict_locals?: boolean /** Parse timeout in milliseconds. 0 disables the timeout. */ timeout?: number /** Whether `location` and `range` were materialized during parsing. */ track_locations?: boolean /** Whether whitespace tracking was enabled during parsing. */ track_whitespace?: boolean /** Whether postfix conditional transformation was enabled during parsing. */ transform_conditionals?: boolean } export type SerializedParserOptions = Required export const DEFAULT_PARSER_OPTIONS: SerializedParserOptions = { action_view_helpers: false, analyze: true, dot_notation_tags: false, erb_openers: [], herb_directives: false, html: true, iteration_nodes: false, max_errors: 25, prism_nodes: false, prism_nodes_deep: false, prism_program: false, render_nodes: false, ruby_version: "4.0", strict: true, strict_locals: false, timeout: 1000, track_locations: true, track_whitespace: false, transform_conditionals: false, } /** * Represents the parser options used during parsing. */ export class ParserOptions { /** Whether ActionView tag helper transformation was enabled during parsing. */ readonly action_view_helpers: boolean /** Whether analysis was performed during parsing. */ readonly analyze: boolean /** Whether dot-notation component tags (e.g. Dialog.Button) are parsed as HTML elements. */ readonly dot_notation_tags: boolean /** ERB tag openers recognized in addition to the built-in ones, written without the leading `<%`. */ readonly erb_openers: string[] /** Whether `<%# herb: %>` directive nodes were parsed during parsing. */ readonly herb_directives: boolean /** Whether HTML tag parsing is enabled during parsing. When false, HTML-like content is treated as literal text. */ readonly html: boolean /** Whether iteration nodes were parsed during parsing. */ readonly iteration_nodes: boolean /** Maximum number of errors to report. nil/null means unlimited. */ readonly max_errors: number | null /** Whether Prism node serialization was enabled during parsing. */ readonly prism_nodes: boolean /** Whether deep Prism node serialization was enabled during parsing. */ readonly prism_nodes_deep: boolean /** Whether the full Prism ProgramNode was serialized on the DocumentNode. */ readonly prism_program: boolean /** Whether ActionView render call detection was enabled during parsing. */ readonly render_nodes: boolean /** Ruby version whose syntax Prism parses the ERB content with, such as `"3.4"`. Defaults to the latest released Ruby. */ readonly ruby_version: string | null /** Whether strict mode was enabled during parsing. */ readonly strict: boolean /** Whether strict locals analysis was enabled during parsing. */ readonly strict_locals: boolean /** Parse timeout in milliseconds. 0 disables the timeout. */ readonly timeout: number /** Whether `location` and `range` were materialized during parsing. */ readonly track_locations: boolean /** Whether whitespace tracking was enabled during parsing. */ readonly track_whitespace: boolean /** Whether postfix conditional transformation was enabled during parsing. */ readonly transform_conditionals: boolean static from(options: SerializedParserOptions): ParserOptions { return new ParserOptions(options) } constructor(options: ParseOptions = {}) { this.action_view_helpers = options.action_view_helpers ?? DEFAULT_PARSER_OPTIONS.action_view_helpers this.analyze = options.analyze ?? DEFAULT_PARSER_OPTIONS.analyze this.dot_notation_tags = options.dot_notation_tags ?? DEFAULT_PARSER_OPTIONS.dot_notation_tags this.erb_openers = options.erb_openers ?? DEFAULT_PARSER_OPTIONS.erb_openers this.herb_directives = options.herb_directives ?? DEFAULT_PARSER_OPTIONS.herb_directives this.html = options.html ?? DEFAULT_PARSER_OPTIONS.html this.iteration_nodes = options.iteration_nodes ?? DEFAULT_PARSER_OPTIONS.iteration_nodes this.max_errors = options.max_errors ?? DEFAULT_PARSER_OPTIONS.max_errors this.prism_nodes = options.prism_nodes ?? DEFAULT_PARSER_OPTIONS.prism_nodes this.prism_nodes_deep = options.prism_nodes_deep ?? DEFAULT_PARSER_OPTIONS.prism_nodes_deep this.prism_program = options.prism_program ?? DEFAULT_PARSER_OPTIONS.prism_program this.render_nodes = options.render_nodes ?? DEFAULT_PARSER_OPTIONS.render_nodes this.ruby_version = options.ruby_version ?? DEFAULT_PARSER_OPTIONS.ruby_version this.strict = options.strict ?? DEFAULT_PARSER_OPTIONS.strict this.strict_locals = options.strict_locals ?? DEFAULT_PARSER_OPTIONS.strict_locals this.timeout = options.timeout ?? DEFAULT_PARSER_OPTIONS.timeout this.track_locations = options.track_locations ?? DEFAULT_PARSER_OPTIONS.track_locations this.track_whitespace = options.track_whitespace ?? DEFAULT_PARSER_OPTIONS.track_whitespace this.transform_conditionals = options.transform_conditionals ?? DEFAULT_PARSER_OPTIONS.transform_conditionals } }