Documentation
¶
Index ¶
- type Item
- type ItemType
- type LexMode
- type Lexer
- func (lexer *Lexer) AllItems() []Item
- func (lexer *Lexer) Backtrack()
- func (lexer *Lexer) BacktrackCount(count int)
- func (lexer *Lexer) Emit(itemType ItemType)
- func (lexer *Lexer) EmitWithMessage(itemType ItemType, message string)
- func (lexer *Lexer) Ignore()
- func (lexer *Lexer) Next() rune
- func (lexer *Lexer) NextItem() Item
- func (lexer *Lexer) NextNonWhitespaceItem(includeNewline bool) Item
- func (lexer *Lexer) NextString(text string) bool
- func (lexer *Lexer) Peek() rune
- type Position
- type Range
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct {
// Type is the type of the lexical item
Type ItemType
// Value is the string value of the token
Value string
// Message is an optional string for the token
Message string
Range Range
}
func (Item) DebugString ¶
type ItemType ¶
type ItemType int
const ( // Meta ItemStartOfInput ItemType = iota ItemEndOfInput ItemError // Operators ItemAddition ItemAdditionAssign ItemSubtraction ItemSubtractionAssign ItemMultiplication ItemMultiplicationAssign ItemDivision ItemDivisionAssign ItemAssignment ItemLooseAssignment ItemEquals ItemNot ItemNotEqual ItemLessThan ItemLessThanOrEqual ItemGreaterThan ItemGreaterThanOrEqual ItemAnd ItemOr ItemSpread ItemIncrement ItemDecrement ItemModulo ItemModuloAssign // Punctuation ItemLeftParentheses ItemRightParentheses ItemLeftBracket ItemRightBracket ItemLeftCurly ItemRightCurly ItemColon ItemColonColon ItemComma ItemDot ItemSubstitutionStart ItemSubstitutionEnd ItemDoubleQuote ItemBacktick // Keywords ItemKeywordPackage ItemKeywordImport ItemKeywordFunc ItemKeywordRule ItemKeywordExport ItemKeywordIf ItemKeywordFor ItemKeywordIn ItemKeywordElse ItemKeywordReturn ItemKeywordLet ItemKeywordShell ItemKeywordAlias ItemKeywordBreak // Identifiers ItemIdentifier // Whitespace ItemNewline ItemWhitespace // Strings etc. ItemStringPart // Numbers ItemInteger // Boleans ItemBoolean // Comments ItemComment )
type Lexer ¶
type Lexer struct {
Mode LexMode
// contains filtered or unexported fields
}
func (*Lexer) BacktrackCount ¶
func (*Lexer) EmitWithMessage ¶
func (*Lexer) NextNonWhitespaceItem ¶
func (*Lexer) NextString ¶
Click to show internal directories.
Click to hide internal directories.