Documentation ¶
Index ¶
- Variables
- type DirectivePredicator
- type Predicator
- func Directives(names ...string) Predicator
- func Every(predicators ...Predicator) Predicator
- func Not(p Predicator) Predicator
- func PortabilityDirectives(names ...string) Predicator
- func PredicatorBy(name string, fn func(string) bool) Predicator
- func Some(predicators ...Predicator) Predicator
- func Symbol(rs ...rune) Predicator
- func TokenType(typ Type) Predicator
- func UpperCase(v string) Predicator
- func Value(v string) Predicator
- type PredicatorImpl
- type Predicators
- type Token
- func NewToken(typ Type, text *[]rune, start, end *runes.Position) *Token
- func ProcessComment(c *runes.Cursor) *Token
- func ProcessDoubleSpecialSymbol(c *runes.Cursor) *Token
- func ProcessEof(c *runes.Cursor) *Token
- func ProcessNumeral(c *runes.Cursor) *Token
- func ProcessSingleSpecialSymbol(c *runes.Cursor) *Token
- func ProcessSpace(c *runes.Cursor) *Token
- func ProcessString(c *runes.Cursor) *Token
- func ProcessWord(c *runes.Cursor) *Token
- type TokeninzerFlag
- type Tokenizer
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var Directive = NewDirectivePredicator(directives)
View Source
var PortabilityDirective = NewDirectivePredicator(portabilityDirectives)
View Source
var SingleSpecialSymbols = map[rune]bool{ '#': true, '$': true, '&': true, '\'': true, '(': true, ')': true, '*': true, '+': true, ',': true, '-': true, '.': true, '/': true, ':': true, ';': true, '<': true, '=': true, '>': true, '@': true, '[': true, ']': true, '^': true, '{': true, '}': true, }
View Source
var TwoRunesSpecialSymbols = map[[2]rune]bool{ {'(', '.'}: true, {'.', ')'}: true, {'.', '.'}: true, {':', '='}: true, {'<', '='}: true, {'>', '='}: true, {'<', '>'}: true, }
View Source
var TypeNames = map[Type]string{ EOF: "EOF", Space: "space", Comment: "comment", SpecialSymbol: "special symbol", Identifier: "identifier", QualifiedIdentifier: "qualified identifier", ReservedWord: "reserved word", NumeralInt: "int", NumeralReal: "real", Label: "label", CharacterString: "character string", }
Functions ¶
This section is empty.
Types ¶
type DirectivePredicator ¶
type DirectivePredicator struct {
// contains filtered or unexported fields
}
func NewDirectivePredicator ¶
func NewDirectivePredicator(nameSet ext.StringSet) *DirectivePredicator
func (*DirectivePredicator) Name ¶
func (m *DirectivePredicator) Name() string
func (*DirectivePredicator) Predicate ¶
func (m *DirectivePredicator) Predicate(t *Token) bool
type Predicator ¶
func Directives ¶
func Directives(names ...string) Predicator
func Every ¶
func Every(predicators ...Predicator) Predicator
func Not ¶
func Not(p Predicator) Predicator
func PortabilityDirectives ¶
func PortabilityDirectives(names ...string) Predicator
func PredicatorBy ¶
func PredicatorBy(name string, fn func(string) bool) Predicator
func Some ¶
func Some(predicators ...Predicator) Predicator
func Symbol ¶
func Symbol(rs ...rune) Predicator
func TokenType ¶
func TokenType(typ Type) Predicator
func UpperCase ¶
func UpperCase(v string) Predicator
func Value ¶
func Value(v string) Predicator
type PredicatorImpl ¶
type PredicatorImpl struct {
// contains filtered or unexported fields
}
func (*PredicatorImpl) Name ¶
func (p *PredicatorImpl) Name() string
func (*PredicatorImpl) Predicate ¶
func (p *PredicatorImpl) Predicate(token *Token) bool
type Predicators ¶
type Predicators []Predicator
func (Predicators) Every ¶
func (s Predicators) Every(t *Token) bool
func (Predicators) Names ¶
func (s Predicators) Names() []string
func (Predicators) Some ¶
func (s Predicators) Some(t *Token) bool
type Token ¶
type Token struct { Type Type Start *runes.Position End *runes.Position // contains filtered or unexported fields }
func ProcessComment ¶
func ProcessEof ¶
func ProcessNumeral ¶
func ProcessSpace ¶
func ProcessString ¶
func ProcessWord ¶
func (*Token) Is ¶
func (t *Token) Is(pred Predicator) bool
type TokeninzerFlag ¶
type TokeninzerFlag uint
const ( LoadSpace TokeninzerFlag = 1 << iota LoadComment )
type Tokenizer ¶
func NewTokenizer ¶
func NewTokenizer(text *[]rune, flags TokeninzerFlag) *Tokenizer
Click to show internal directories.
Click to hide internal directories.