123456789_123456789_123456789_123456789_123456789_

Class: Prism::Translation::Parser34

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Parser, Parser::Base
Instance Chain:
self, Parser, Parser::Base
Inherits: Prism::Translation::Parser
Defined in: lib/prism/translation/parser34.rb

Overview

This class is the entry-point for Ruby 3.4 of Parser.

Constant Summary

Parser - Inherited

Diagnostic, Racc_debug_parser

Instance Method Summary

Parser - Inherited

#default_encoding

The default encoding for Ruby files is UTF-8.

#parse

Parses a source buffer and returns the AST.

#parse_with_comments

Parses a source buffer and returns the AST and the source code comments.

#tokenize

Parses a source buffer and returns the AST, the source code comments, and the tokens emitted by the lexer.

#try_declare_numparam

Since prism resolves num params for us, we don’t need to support this kind of logic here.

#build_ast

Build the parser gem AST from the prism AST.

#build_comments

Build the parser gem comments from the prism comments.

#build_offset_cache

::Prism deals with offsets in bytes, while the parser gem deals with offsets in characters.

#build_range

Build a range from a prism location.

#build_tokens

Build the parser gem tokens from the prism tokens.

#convert_for_prism

Converts the version format handled by Parser to the format handled by ::Prism.

#error_diagnostic

Build a diagnostic from the given prism parse error.

#unwrap

If there was a error generated during the parse, then raise an appropriate syntax error.

#valid_error?

This is a hook to allow consumers to disable some errors if they don’t want them to block creating the syntax tree.

#valid_warning?

This is a hook to allow consumers to disable some warnings if they don’t want them to block creating the syntax tree.

#warning_diagnostic

Build a diagnostic from the given prism parse warning.

#version, #yyerror

Instance Method Details

#version

This method is for internal use only.
[ GitHub ]

  
# File 'lib/prism/translation/parser34.rb', line 7

def version # :nodoc:
  34
end