parser

package
v0.3.29 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package parser implements TypeRB's handwritten recursive-descent and Pratt parsers. The syntax tree is independent from parser internals and retains source spans for diagnostics, formatting, and Ruby interoperability.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSXComponentIdentifierAt added in v0.3.2

func JSXComponentIdentifierAt(root token.Token, cursor int) (token.Token, bool)

JSXComponentIdentifierAt returns the component identifier under an editor cursor. JSX is lexed as one literal token, so semantic tooling uses the JSX parser's component-name boundaries instead of duplicating JSX syntax rules.

func NormalizeRubyNativeParameters added in v0.3.28

func NormalizeRubyNativeParameters(statements []ast.Statement)

NormalizeRubyNativeParameters applies Ruby's untyped keyword-parameter interpretation only after an explicit Ruby-native import has selected that syntax. Portable parsing remains deterministic and keeps the candidate metadata separate until this point.

func Parse

func Parse(source []byte) (*ast.Program, []diagnostic.Diagnostic)

func ParseJSXToken added in v0.3.15

func ParseJSXToken(root token.Token) (*ast.JSXElement, bool)

ParseJSXToken rebuilds the structured JSX node represented by one lossless lexer token. Tooling that prints token-preserving source can use the shared JSX grammar without duplicating it.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL