package tokens

import "github.com/open-policy-agent/opa/v1/ast/internal/tokens"

Index

Functions

func IsKeyword

func IsKeyword(tok Token) bool

IsKeyword returns if a token is a keyword

func Keywords

func Keywords() map[string]Token

Keywords returns a copy of the default string -> Token keyword map.

Types

type Token

type Token uint8

Token represents a single Rego source code token for use by the Parser.

const (
	Illegal Token = iota
	EOF
	Whitespace
	Ident
	Comment

	Package
	Import
	As
	Default
	Else
	Not
	Some
	With
	Null
	True
	False

	Number
	String

	LBrack
	RBrack
	LBrace
	RBrace
	LParen
	RParen
	Comma
	Colon

	Add
	Sub
	Mul
	Quo
	Rem
	And
	Or
	Unify
	Equal
	Assign
	In
	Neq
	Gt
	Lt
	Gte
	Lte
	Dot
	Semicolon

	Every
	Contains
	If
)

All tokens must be defined here

func (Token) String

func (t Token) String() string

Source Files

tokens.go

Version
v1.4.2 (latest)
Published
May 2, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
6 hours ago

Tools for package owners.