2021-03-06 22:30:32 +03:00
|
|
|
package unilex
|
|
|
|
|
|
|
|
// Lexem represents part of parsed string.
|
|
|
|
type Lexem struct {
|
|
|
|
Type LexType // Type of Lexem.
|
|
|
|
Value string // Value of Lexem.
|
|
|
|
Start int // Start position at input string.
|
|
|
|
End int // End position at input string.
|
|
|
|
}
|
|
|
|
|
|
|
|
// LexType represents type of current lexem.
|
2021-03-10 00:47:58 +03:00
|
|
|
type LexType int
|
2021-03-06 22:30:32 +03:00
|
|
|
|
|
|
|
// Some std lexem types
|
|
|
|
const (
|
|
|
|
// LEOF represents end of input.
|
2021-03-10 00:47:58 +03:00
|
|
|
LexEOF LexType = -1
|
|
|
|
// LError represents lexing error.
|
|
|
|
LexError LexType = -2
|
2021-03-06 22:30:32 +03:00
|
|
|
)
|