token

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

func (*File) Base

func (f *File) Base() int

func (*File) Name

func (f *File) Name() string

func (*File) Offset

func (f *File) Offset(p Pos) int

func (*File) Pos

func (f *File) Pos(offset int) Pos

func (*File) Position

func (f *File) Position(p Pos) (pos Position)

Position returns the Position value for the given file position p. Calling f.Position(p) is equivalent to calling f.PositionFor(p, true).

func (*File) PositionFor

func (f *File) PositionFor(p Pos, adjusted bool) (pos 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) Size

func (f *File) Size() int

type FileSet

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

func NewFileSet

func NewFileSet() *FileSet

func (*FileSet) AddFile

func (s *FileSet) AddFile(filename string, base, size int) *File

type Pos

type Pos int
const NoPos Pos = 0

func (Pos) IsValid

func (p Pos) IsValid() bool

type Position

type Position struct {
	Filename string // filename, if any
	Offset   int    // offset, starting at 0
	Line     int    // line number, starting at 1
	Column   int    // column number, starting at 1 (byte count)
}

func (*Position) IsValid

func (pos *Position) IsValid() bool

func (Position) String

func (pos Position) String() string

type Token

type Token int

Token is the set of lexical tokens of the coco3.

const (
	// Special tokens
	ILLEGAL Token = iota
	EOF

	IDENT  // main
	STRING // 'abc'

	LPAREN // (
	RPAREN // )

	REDIRIN  // <
	REDIROUT // >

	PIPE // |

	SEMICOLON // ;

)

The list of tokens.

func (Token) IsLiteral

func (tok Token) IsLiteral() bool

func (Token) IsOperator

func (tok Token) IsOperator() bool

func (Token) String

func (tok Token) String() string

Jump to

Keyboard shortcuts

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