Documentation ¶
Index ¶
Constants ¶
const ( LParen = 0 + iota RParen LBrace RBrace LBracket RBracket Comma Semicolon SymbolHash SymbolAt SymbolDollar EOL EOF UnaryOperator BinaryOperator SymbolArrow Identifier Number SingleQuotedString DoubleQuotedString KeywordIF KeywordELSE KeywordFOR KeywordUNTIL DirDeposit DirNumberFormat KeywordEnum KeywordOpcode DirError KeywordInclude GenericSeparator TokenCommand )
TokenType values
Variables ¶
var TokenTypeMap = map[string]TokenType{ "(": LParen, ")": RParen, "[": LBracket, "]": RBracket, "{": LBrace, "}": RBrace, ",": Comma, ";": Semicolon, "if": KeywordIF, "else": KeywordELSE, ".db": DirDeposit, ".dw": DirDeposit, ".dd": DirDeposit, ".opcode": KeywordOpcode, ".enum": KeywordEnum, ".number": DirNumberFormat, ".error": DirError, "->": SymbolArrow, "$": SymbolDollar, "#": SymbolHash, "@": SymbolAt, ".include": KeywordInclude, "for": KeywordFOR, "until": KeywordUNTIL, }
TokenTypeMap contains separators and keyword tokens
Functions ¶
This section is empty.
Types ¶
type SourceLine ¶
type SourceLine struct {
// contains filtered or unexported fields
}
SourceLine keep original strings with whitespaces, line number and source name
func NewSourceLine ¶
func NewSourceLine(words []string, lineNumber uint, sourceName string) *SourceLine
NewSourceLine create a new source line
func (*SourceLine) AllStrings ¶
func (line *SourceLine) AllStrings() []string
AllStrings return a slice with all strings in the line
func (*SourceLine) LineNumber ¶
func (line *SourceLine) LineNumber() uint
LineNumber return the line number
func (*SourceLine) RuneIndex ¶
func (line *SourceLine) RuneIndex(ui ui.UI, indexOfWord uint) uint
RuneIndex calculate the index of the first rune of the indexOfWord argument
func (*SourceLine) SourceName ¶
func (line *SourceLine) SourceName() string
SourceName return the source in which this line is found
func (*SourceLine) StringAt ¶
func (line *SourceLine) StringAt(i uint) string
StringAt return the string at i index
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token of parsing, extends lexing.Token adding a TokenType to the token
func NewInternalToken ¶
NewInternalToken create new token with internal identifier Testing only
func NewSpecialToken ¶
NewSpecialToken create a special token that have the same position of another one
func NewToken ¶
func NewToken(value string, tType TokenType, lineIndex uint, line *SourceLine) Token
NewToken create a new Token
func (Token) Position ¶
Position return the position of this token in the source (as collection of sources)