scriptreserved

package
v1.134.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package scriptreserved answers one question about a Starlark parse error: is it a reserved word used as a name, and if so which word (#1823)?

The parser's message at "def load(...)" is "not an identifier", reported at the token after the word, which is true and names neither the word nor the mistake. This package finds the word from the error and the source line, so the validator can say which word it was and what to do about it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Misused

func Misused(source string, e syntax.Error) (string, bool)

Misused reports the reserved word a parse error is about, or false when the error is about something else.

There are three shapes: the word where a name is declared (a def, a parameter, an attribute), where the parser says "not an identifier" at the token after it; the word where a value is read, which the parser names; and "load" at the start of an assignment, which the parser takes for the load statement and answers with the parenthesis it wanted.

func Words

func Words() []string

Words returns the reserved words in sorted order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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