class RuboCop::AST::PrismPreparsed
such as in Ruby LSP, the Prism parsing process can be bypassed.
rather than parsing the source code. When the parse result is already available externally,
This class implements the ‘parse_lex` method to return a preparsed `Prism::ParseLexResult`
A `Prism` interface’s class that provides a fixed ‘Prism::ParseLexResult` instead of parsing.
def initialize(prism_result)
def initialize(prism_result) unless prism_result.is_a?(Prism::ParseLexResult) raise ArgumentError, <<~MESSAGE Expected a `Prism::ParseLexResult` object, but received `#{prism_result.class}`. MESSAGE end @prism_result = prism_result end
def parse_lex(_source, **_prism_options)
def parse_lex(_source, **_prism_options) @prism_result end