Documentation ¶
Overview ¶
Package scanner provides a scanner for WDTE tokens.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MacroMap ¶ added in v0.6.0
MacroMap specifies mappings of macro names to their definitions. For example, an entry with the key "example" would be available in scanned code as
@example[some input or another]
In this example, the string "some input or another" would be passed to the definition. The tokens returned by the macro are inserted raw into the token stream that is yielded by the scanner. Returned tokens of type Macro are reprocessed via the same map.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
A Scanner tokenizes runes from an io.Reader.
Example ¶
package main import ( "io" "github.com/DeedleFake/wdte/scanner" ) var r io.Reader func main() { s := scanner.New(r, nil) for s.Scan() { /* Do something with s.Tok(). */ } if err := s.Err(); err != nil { panic(err) } }
Output:
func New ¶
New returns a new Scanner that reads from r. macros, which may be nil, specifies mappings of macro names to their definitions.
func (*Scanner) Pos ¶
Pos returns the line and column of the input that the scanner is currently on.