token

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ILLEGAL = "ILLEGAL"
	EOF     = "EOF"

	// Language idents
	IDENT   = "IDENT"
	INT     = "INT"
	STRING  = "STRING"
	FLOAT   = "FLOAT"
	RTIME   = "RTIME"
	COMMENT = "COMMENT"
	TRUE    = "TRUE"
	FALSE   = "FALSE"
	PERCENT = "PERCENT"
	LF      = "LF" // "\n"

	// Operators
	// https://developer.fastly.com/reference/vcl/operators/
	EQUAL              = "EQUAL"              // "=="
	NOT_EQUAL          = "NOTEQUAL"           // "!="
	REGEX_MATCH        = "REGEX"              // "~"
	NOT_REGEX_MATCH    = "NOT_REGEX_MATCH"    // "!~"
	GREATER_THAN       = "GREATER_THAN"       // ">"
	LESS_THAN          = "LESS_THAN"          // "<"
	GREATER_THAN_EQUAL = "GREATER_THAN_EQUAL" // >="
	LESS_THAN_EQUAL    = "LESS_THAN_EQUAL"    // <="
	AND                = "AND"                // "&&"
	OR                 = "OR"                 // "||"

	// Assignment Operators
	// https://developer.fastly.com/reference/vcl/operators/#assignment-operators
	ASSIGN         = "ASSIGN"         // "="
	ADDITION       = "ADDITION"       // "+="
	SUBTRACTION    = "SUBTRACTION"    // "-="
	MULTIPLICATION = "MULTIPLICATION" // "*="
	DIVISION       = "DIVISION"       // "/="
	REMAINDER      = "REMAINDER"      // "%="
	BITWISE_OR     = "BITWISE_OR"     // "|="
	BITWISE_AND    = "BITWISE_AND"    // "&="
	BITWISE_XOR    = "BITWISE_XOR"    // "^="
	LEFT_SHIFT     = "LEFT_SHIFT"     // "<<="
	RIGHT_SHIFT    = "RIGHT_SHIFT"    // ">>="
	LEFT_ROTATE    = "LEFT_ROTATE"    // "rol="
	RIGHT_ROTATE   = "RIGHT_ROTATE"   // "ror="
	LOGICAL_AND    = "LOGICAL_AND"    // "&&="
	LOGICAL_OR     = "LOGICAL_OR"     // "||="

	// Punctuation
	// https://developer.fastly.com/reference/vcl/operators/#reserved-punctuation
	LEFT_BRACE    = "LEFT_BRACE"    // "{"
	RIGHT_BRACE   = "RIGHT_BRACE"   // "}"
	LEFT_PAREN    = "LEFT_PAREN"    // "("
	RIGHT_PAREN   = "RIGHT_PAREN"   // ")"
	LEFT_BRACKET  = "LEFT_BRACKET"  // "["
	RIGHT_BRACKET = "RIGHT_BRACKET" // "]"
	COMMA         = "COMMA"         // ","
	SLASH         = "SLASH"         // "/"
	SEMICOLON     = "SEMICOLON"     // ";"
	DOT           = "DOT"           // "."
	NOT           = "NOT"           // "!"
	COLON         = "COLON"         // ":"
	PLUS          = "PLUS"          // "+"
	MINUS         = "MINUS"         // "-"

	// Keywords
	ACL              = "ACL"              // acl
	DIRECTOR         = "DIRECTOR"         // director
	BACKEND          = "BACKEND"          // backend
	TABLE            = "TABLE"            // table
	SUBROUTINE       = "SUBROUTINE"       // sub
	ADD              = "ADD"              // add
	CALL             = "CALL"             // call
	DECLARE          = "DECLARE"          // declare
	ERROR            = "ERROR"            // error
	ESI              = "ESI"              // esi
	INCLUDE          = "INCLUDE"          // include
	IMPORT           = "IMPORT"           // import
	LOG              = "LOG"              // log"
	REMOVE           = "REMOVE"           // remove
	RESTART          = "RESTART"          // restart
	RETURN           = "RETURN"           // return
	SET              = "SET"              // set
	SYNTHETIC        = "SYNTHETIC"        // synthetic
	SYNTHETIC_BASE64 = "SYNTHETIC_BASE64" // synthetic.base64
	UNSET            = "UNSET"            // unset
	IF               = "IF"               // if
	ELSE             = "ELSE"             // else
	ELSEIF           = "ELSEIF"           // elseif
	ELSIF            = "ELSIF"            // elsif
	PENALTYBOX       = "PENALTYBOX"       // penaltybox
	RATECOUNTER      = "RATECOUNTER"      // ratecounter
	GOTO             = "GOTO"             // goto
	SWITCH           = "SWITCH"           // switch
	CASE             = "CASE"             // case
	DEFAULT          = "DEFAULT"          // default
	BREAK            = "BREAK"            // break
	FALLTHROUGH      = "FALLTHROUGH"      // fallthrough

	// Fastly Generated control syntaxes
	// Fastly automatically generates some control syntaxes like "pragma".
	// falco should lex them
	PRAGMA         = "PRAGMA"
	FASTLY_CONTROL = "CONTROL" // Presents as "C!" or "W!" character
)

Variables

View Source
var Null = Token{
	Type:    ILLEGAL,
	Literal: "NULL",
}

Functions

This section is empty.

Types

type Token

type Token struct {
	Type     TokenType
	Literal  string
	Line     int
	Position int
	Offset   int    // for print problem
	File     string // for print problem
	Snippet  bool
}

func (Token) String

func (t Token) String() string

type TokenType

type TokenType string

func Custom added in v1.10.0

func Custom(name string) TokenType

func LookupIdent

func LookupIdent(ident string) TokenType

Jump to

Keyboard shortcuts

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