vblexer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package vblexer implements a VBScript lexer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lex

type Lex struct {
	Filename string
	Line     int
	// contains filtered or unexported fields
}

Lex uses a scanner to read and classify VBScript tokens

func (*Lex) Init

func (lex *Lex) Init(src io.Reader, fname string, initialMode vbscanner.Mode)

Init prepares the lexer for use.

func (*Lex) Lex

func (lex *Lex) Lex() (TokenType, interface{}, string)

Lex returns the next token in the steam and classifies it. The values returned are the token type, the converted value, and the raw value as a string.

type TokenType

type TokenType int

TokenType describes the type of token read by the scanner

const (
	EOF                 TokenType = iota // end of file
	STATEMENT                            // language statements (reserved words)
	FUNCTION                             // builtin functions
	KEYWORD                              // keywords - nothing, null, empty
	KEYWORD_BOOL                         // boolean keywords - true and false
	COLOR_CONSTANT                       // constants for colors, like vbRed
	COMPARE_CONSTANT                     // constants to specify binary or text comparison
	DATE_CONSTANT                        // constants relating to dates, like vbSunday
	DATEFORMAT_CONSTANT                  // constants for specifying date formats
	MISC_CONSTANT                        // miscellaenous constants
	MSGBOX_CONSTANT                      // constants for message boxes like MbOk
	STRING_CONSTANT                      // constant strings like vbCrLf
	TRISTATE_CONSTANT                    // constants for tristate use
	VARTYPE_CONSTANT                     // constants for variant types
	IDENTIFIER                           // identifiers
	STRING                               // string literals
	INT                                  // integer literals
	FLOAT                                // float literals
	DATE                                 // date literals
	COMMENT                              // comments
	HTML                                 // HTML fragments in the ASP
	CHAR                                 // random characters
	EOL                                  // end of line
	OP                                   // operator
	CONTINUATION                         // continuation character (underscore)
	FILE_INCLUDE                         // file include
	VIRTUAL_INCLUDE                      // virtual include
	LIST_SEP                             // list separator (comma)
	PAREN_OPEN                           // function invoke, array index, grouping (parens)
	PAREN_CLOSE                          // function invoke, array index, grouping (parens)
	FIELD_SEP                            // field separator (dot) - usually part of identifier except after parens
)

Token types

func (TokenType) String

func (i TokenType) String() string

Jump to

Keyboard shortcuts

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