keywords

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package keywords groups the lexer's reserved words and contextual words into the categories editor highlighting colours them by. Every editor surface reads its keyword lists from here, so they cannot drift from the lexer or from each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contextual

func Contextual(kind source.Kind) ([]string, error)

Contextual returns the words the parser reads as syntax positionally in a language without the lexer reserving them, in name order. It fails when one is also reserved: the two lists exist precisely to be disjoint, and that is what stops a contextual word leaking into source.Keywords().

func Introducers

func Introducers() ([]string, error)

Introducers returns the reserved words that are directly followed by the name a declaration introduces. It fails when one is no longer reserved.

Types

type Category

type Category string

Category is the kind of syntax a keyword group introduces.

const (
	Constant     Category = "constant"
	Declaration  Category = "declaration"
	Control      Category = "control"
	Modifier     Category = "modifier"
	Relationship Category = "relationship"
	Operator     Category = "operator"
	// Other holds every reserved word no group claims, so a new keyword is
	// highlighted without an editor change. It is absent while every keyword is
	// grouped.
	Other Category = "other"
)

The categories, in the order editors apply them.

type Group

type Group struct {
	Category Category
	Words    []string
}

Group is the reserved words of one category.

func Groups

func Groups() ([]Group, error)

Groups returns the keyword groups, each word in the order listed, followed by an Other group when some reserved word is in none of them. It fails when a group names a word the lexer does not reserve or two groups share a word.

Jump to

Keyboard shortcuts

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