token

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pos

type Pos struct {
	Line, Column int
}

func (Pos) String

func (p Pos) String() string

type ScanError

type ScanError struct {
	Pos Pos
	Err error
}

func (*ScanError) Error

func (e *ScanError) Error() string

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(r io.Reader, php74Compat bool) *Scanner

func (*Scanner) Err

func (s *Scanner) Err() error

func (*Scanner) Next

func (s *Scanner) Next() (tok Token)

type Token

type Token struct {
	Type Type
	Text string
	Pos  Pos
}

func (Token) String

func (t Token) String() string

type Type

type Type uint
const (
	Illegal Type = iota
	EOF
	Whitespace
	Comment
	DocComment

	Ident
	Int
	Float
	String
	Var
	InlineHTML

	OpenTag   // <?php
	CloseTag  // ?>
	Dollar    // $
	Backslash // \
	Qmark     // ?
	Lparen    // (
	Rparen    // )
	Lbrack    // [
	Rbrack    // ]
	Lbrace    // {
	Rbrace    // }

	At     // @
	Hash   // #
	BitNot // ~

	Add      // +
	Sub      // -
	Mul      // *
	Quo      // /
	Rem      // %
	Pow      // **
	BitAnd   // &
	BitOr    // |
	BitXor   // ^
	BitShl   // <<
	BitShr   // >>
	Concat   // .
	Coalesce // ??

	AddAssign      // +=
	SubAssign      // -=
	MulAssign      // *=
	QuoAssign      // /=
	RemAssign      // %=
	PowAssign      // **=
	AndAssign      // &=
	OrAssign       // |=
	XorAssign      // ^=
	ShlAssign      // <<=
	ShrAssign      // >>=
	ConcatAssign   // .=
	CoalesceAssign // ??=

	And          // &&
	Or           // ||
	Inc          // ++
	Dec          // --
	Assign       // =
	Not          // !
	Lt           // <
	Gt           // >
	Leq          // <=
	Geq          // >=
	Eq           // ==
	Neq          // !=
	Identical    // ===
	NotIdentical // !==
	Comma        // ,
	Colon        // :
	DoubleColon  // ::
	Semicolon    // ;
	Ellipsis     // ...
	Arrow        // ->
	QmarkArrow   // ?->
	DoubleArrow  // =>
	Spaceship    // <=>

	Abstract   // abstract
	As         // as
	Break      // break
	Case       // case
	Catch      // catch
	Class      // class
	Clone      // clone
	Const      // const
	Continue   // continue
	Declare    // declare
	Default    // default
	Do         // do
	Echo       // echo
	Else       // else
	Enum       // enum
	Extends    // extends
	Final      // final
	Finally    // finally
	Fn         // fn
	For        // for
	Foreach    // foreach
	From       // from
	Function   // function
	Global     // global
	Goto       // goto
	If         // if
	Implements // implements
	Instanceof // instanceof
	Insteadof  // insteadof
	Interface  // interface
	Match      // match
	Namespace  // namespace
	New        // new
	Print      // print
	Private    // private
	Protected  // protected
	Public     // public
	Readonly   // readonly
	Return     // return
	Static     // static
	Switch     // switch
	Throw      // throw
	Trait      // trait
	Try        // try
	Use        // use
	While      // while
	Yield      // yield

	LowPrecAnd // and
	LowPrecOr  // or
	LowPrecXor // xor

)

func (Type) IsKeyword

func (t Type) IsKeyword() bool

func (Type) String

func (i Type) String() string

Jump to

Keyboard shortcuts

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