rust_grammar

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(filePath string) (*language.FileInfo, error)

Types

type File

type File struct {
	Statements []*Statement `(@@ | ANY | ALL | String | Punct | PathSep | Ident)*`
	Path       string
	// contains filtered or unexported fields
}

func (File) Loc added in v0.17.4

func (f File) Loc() int

func (File) Size added in v0.17.4

func (f File) Size() int

type FlattenUse

type FlattenUse struct {
	Pub        bool
	PathSlices []string
	All        bool
	Name       Name
}

type Ident added in v0.17.6

type Ident string

func (*Ident) Capture added in v0.17.6

func (i *Ident) Capture(values []string) error

type Mod

type Mod struct {
	Pub   bool  `@"pub"? ("(" (Ident | PathSep)* ")")? "mod"`
	Name  Ident `@Ident`
	Local bool  `@"{"?`
}

type Name

type Name struct {
	Original Ident `@Ident`
	Alias    Ident `("as" @Ident)?`
}

type Pub

type Pub struct {
	Name Ident `` /* 129-byte string literal not displayed */
}

type Statement

type Statement struct {
	Mod *Mod `@@`
	Use *Use `| @@`
	Pub *Pub `| @@`
}

type Use

type Use struct {
	Pub     bool     `@"pub"? ("(" (Ident | PathSep)* ")")?`
	UsePath *UsePath `"use" @@ ";"`
}

func (*Use) Flatten

func (u *Use) Flatten() []FlattenUse

type UsePath

type UsePath struct {
	PathSlices []Ident    `(@Ident PathSep)*`
	All        bool       `(@ALL |`
	Name       *Name      `      @@ |`
	UsePaths   []*UsePath `         "{" @@ ("," @@)* "}" )`
}

Jump to

Keyboard shortcuts

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