Documentation
¶
Index ¶
- type Checkpoint
- type Error
- type Scanner
- func (s *Scanner) AdvanceIfByteEquals(b byte) bool
- func (s *Scanner) Checkpoint() Checkpoint
- func (s *Scanner) ConsumeByte() byte
- func (s *Scanner) ConsumeRune() rune
- func (s *Scanner) Next()
- func (s *Scanner) NextByte() (byte, bool)
- func (s *Scanner) NextRune() (rune, bool)
- func (s *Scanner) NextTemplatePart()
- func (s *Scanner) Offset() ast.Idx
- func (s *Scanner) ParseRegExp() (string, string, string)
- func (s *Scanner) PeekByte() (byte, bool)
- func (s *Scanner) PeekRune() (rune, bool)
- func (s *Scanner) ReadTemplateLiteral(sub, tail token.Token) token.Token
- func (s *Scanner) Rewind(c Checkpoint)
- type Source
- func (s *Source) AdvanceIfByteEquals(b byte) (matched bool)
- func (s *Source) EOF() bool
- func (s *Source) EndOffset() ast.Idx
- func (s *Source) FromPositionToCurrent(pos ast.Idx) string
- func (s *Source) NextByte() (byte, bool)
- func (s *Source) NextByteUnchecked() byte
- func (s *Source) NextRune() (rune, bool)
- func (s *Source) Offset() ast.Idx
- func (s *Source) PeekByte() (byte, bool)
- func (s *Source) PeekByteUnchecked() byte
- func (s *Source) PeekRune() (rune, bool)
- func (s *Source) PeekTwoBytes() ([2]byte, bool)
- func (s *Source) ReadPosition(pos ast.Idx) byte
- func (s *Source) SetPosition(pos ast.Idx)
- func (s *Source) Slice(from, to ast.Idx) string
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checkpoint ¶
type Checkpoint struct {
// contains filtered or unexported fields
}
type Scanner ¶
type Scanner struct {
Token Token
EscapedStr string // escape-processed string for current token
// contains filtered or unexported fields
}
func NewScanner ¶
func (*Scanner) AdvanceIfByteEquals ¶
func (*Scanner) Checkpoint ¶
func (s *Scanner) Checkpoint() Checkpoint
func (*Scanner) ConsumeByte ¶
func (*Scanner) ConsumeRune ¶
func (*Scanner) NextTemplatePart ¶
func (s *Scanner) NextTemplatePart()
func (*Scanner) ParseRegExp ¶
ParseRegExp re-tokenizes the current `/` or `/=` as a regular expression.
func (*Scanner) ReadTemplateLiteral ¶
ReadTemplateLiteral scans the body of a template literal. The opening delimiter (` or }) must already have been consumed by the caller. sub is the Token to return when encountering ${, tail is for closing `.
func (*Scanner) Rewind ¶
func (s *Scanner) Rewind(c Checkpoint)
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
func (*Source) AdvanceIfByteEquals ¶
func (*Source) NextByteUnchecked ¶
func (*Source) PeekByteUnchecked ¶
func (*Source) PeekTwoBytes ¶
func (*Source) SetPosition ¶
type Token ¶
func (Token) TemplateLiteral ¶
TemplateLiteral returns the raw source text of a template literal element (without the surrounding delimiters).
func (Token) TemplateParsed ¶
TemplateParsed returns the escape-processed content of a template literal element. If no escapes were present, returns the same as TemplateLiteral.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.