Documentation ¶
Index ¶
- Constants
- func IsIdentifier(name string) bool
- func IsKeyword(tok string) bool
- func IsPostfixOperator(tok Token) bool
- type File
- func (f *File) AddLine(offset int)
- func (f *File) Base() int
- func (f *File) GetPosition(line, column int) (pos Position)
- func (f *File) Line(p Pos) int
- func (f *File) LineCount() int
- func (f *File) LineStart(line int) Pos
- func (f *File) Lines() []int
- func (s *File) Mutex() *sync.Mutex
- func (f *File) Offset(p Pos) int
- func (f *File) Pos(offset int) Pos
- func (f *File) Position(p Pos) (pos Position)
- func (f *File) Scheme() string
- func (f *File) SetLinesForContent(content []byte)
- func (f *File) Size() int
- func (f *File) Specifier() string
- type FileSet
- func (s *FileSet) AddFile(specifier string, base, size int) *File
- func (s *FileSet) Base() int
- func (s *FileSet) File(filename string) *File
- func (s *FileSet) GetPosition(specifier string, line, column int) Position
- func (s *FileSet) Mutex() *sync.Mutex
- func (s *FileSet) Pos(position Position) Pos
- func (s *FileSet) Position(pos Pos) Position
- type Lockable
- type Pos
- type Position
- type Token
Constants ¶
const ( PrecedenceLowest = 0 PrecedenceUnary = 9 PrecedenceHighest = 10 )
Variables ¶
This section is empty.
Functions ¶
func IsIdentifier ¶
func IsPostfixOperator ¶
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) GetPosition ¶
GetPosition returns the Position value for the specified file, line, and column.
func (*File) Line ¶
Line returns the line number for the given file position p; p must be a Pos value in that file or NoPos.
func (*File) Offset ¶
Offset returns the offset for the given file position p; p must be a valid Pos value in that file. f.Offset(f.Pos(offset)) == offset.
func (*File) Pos ¶
Pos returns the Pos value for the given file offset; the offset must be <= f.Size(). f.Pos(f.Offset(p)) == p.
func (*File) Position ¶
PositionFor returns the Position value for the given file position p. If adjusted is set, the position may be adjusted by position-altering //line comments; otherwise those comments are ignored. p must be a Pos value in f or NoPos.
func (*File) SetLinesForContent ¶
SetLinesForContent sets the line offsets for the given file content. It ignores position-altering //line comments.
type FileSet ¶
type FileSet struct {
// contains filtered or unexported fields
}
func NewFileSet ¶
func NewFileSet() *FileSet
func (*FileSet) GetPosition ¶
type Token ¶
type Token int
const ( Illegal Token = iota EOF Comment LiteralStart Ident Int // int64 Float // float64 StringStart StringMid StringInterpIdent StringInterpExprStart StringInterpExprEnd StringEnd Null True False LiteralEnd OperatorStart Assign OverloadAllowedStart Add Sub Mul Quo Rem Pow Gt Lt Lte Gte Inc Dec Question BitShl BitShr BitNot BitAnd BitOr BitXor Eq Neq Spaceship OverloadAllowedEnd AddAssign SubAssign MulAssign QuoAssign RemAssign PowAssign LogAnd LogOr LogNot LogNull LogAndAssign LogOrAssign LogNullAssign BitAndAssign BitOrAssign BitXorAssign BitShlAssign BitShrAssign LParen RParen LBracket RBracket LBrace RBrace Colon Semi Comma Period Arrow Ellipsis HashLBracket Bind MatchBind EOL OperatorEnd KeywordStart Let Const Symbol If Then Else Repeat While Forever Times For In Break Continue Func End Return Memo Import Export As Show Generator Yield To Step Struct Init Operator Try Catch Finally Throw Do Async Await Native Match When Frozen Is KeywordEnd None )