rust_grammar

package
v0.13.6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Statements []*Statement `(@@ | ANY | ALL | String | Punct | PathSep | Ident)*`
	Path       string
}

func Parse

func Parse(filePath string) (*File, error)

type FlattenUse

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

type Mod

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

type Name

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

type Pub

type Pub struct {
	Name string `` /* 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 []string   `(@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