js_grammar

package
v0.19.9 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 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 AliasedName

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

type AllImport

type AllImport struct {
	Alias string `ALL ("as" @Ident)?`
}

type DeclarationExport

type DeclarationExport struct {
	Name string `"export" "async"? ("let"|"const"|"var"|"function"|"class"|"type"|"interface"|"enum") ALL? @Ident`
}

type DefaultExport

type DefaultExport struct {
	Default bool `"export" @"default"`
}

type DynamicImport

type DynamicImport struct {
	Path string `"import" "(" @String ")"`
}

type ExportDeconstruction

type ExportDeconstruction struct {
	Names []AliasedName `"{" @@ ("," @@)* ","? "}"`
}

type File

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

type ImportDeconstruction

type ImportDeconstruction struct {
	Names []string `"{" "type"? @Ident ("as" Ident)? ("," ("type"? @Ident ("as" Ident)?)?)* "}"`
}

type Imported

type Imported struct {
	Default         bool             `(@Ident? ","?`
	SelectionImport *SelectionImport ` @@?)!`
}

type ListExport

type ListExport struct {
	ExportDeconstruction *ExportDeconstruction `"export" @@`
}

type ProxyExport

type ProxyExport struct {
	ExportDeconstruction *ExportDeconstruction `"export" (@@`
	ExportAll            bool                  `             | (@ALL`
	ExportAllAlias       string                `                     ("as" @Ident)?)) `
	From                 string                `"from" @String`
}

type Require added in v0.17.5

type Require struct {
	Names []string `(("const"|"let"|"var") ( "{" @Ident (":" Ident)? ("," (@Ident (":" Ident)?)?)* "}"`
	Alias string   `                                                                                 | @Ident ) "=")?`
	Path  string   `"require" "(" @String ")"`
}

type SelectionImport

type SelectionImport struct {
	AllImport      *AllImport            `(@@?`
	Deconstruction *ImportDeconstruction ` @@?)!`
}

type Statement

type Statement struct {
	// imports.
	DynamicImport *DynamicImport `  @@`
	StaticImport  *StaticImport  `| @@`
	Require       *Require       `| @@`
	// exports.
	DeclarationExport *DeclarationExport `| @@`
	DefaultExport     *DefaultExport     `| @@`
	ProxyExport       *ProxyExport       `| @@`
	ListExport        *ListExport        `| @@`
}

type StaticImport

type StaticImport struct {
	Imported *Imported `"import" "type"? (@@ "from")?`
	Path     string    `@String`
}

Jump to

Keyboard shortcuts

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