Provides a low-level interface to the go/scanner package.
Package scanner implements a scanner for Go source text.
It takes a byte as source which can then be tokenized
through repeated calls to the Scan method.
ConstantsConstants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.
return comments as COMMENT tokens
Functions, Macros, and Special Forms
(PrintError w err)
PrintError is a utility function that prints a list of errors to w,
one error per line, if the err parameter is an ErrorList. Otherwise
it prints the err string.
Go input arguments: (w io.Writer, err error)
Joker input arguments: [^go.std.io/Writer w, ^Error err]
*ErrorConcrete GoType v1.0
*ErrorHandlerConcrete GoType v1.0
*ErrorListConcrete GoType v1.0
*ModeConcrete GoType v1.0
*ScannerConcrete GoType v1.0
ScanReceiver for *Scanner v1.0
Scan scans the next token and returns the token position, the token,
and its literal string if applicable. The source end is indicated by
If the returned token is a literal (token.IDENT, token.INT, token.FLOAT,
token.IMAG, token.CHAR, token.STRING) or token.COMMENT, the literal string
has the corresponding value.
If the returned token is a keyword, the literal string is the keyword.
If the returned token is token.SEMICOLON, the corresponding
literal string is ";" if the semicolon was present in the source,
and "\n" if the semicolon was inserted because of a newline or
If the returned token is token.ILLEGAL, the literal string is the
In all other cases, Scan returns an empty literal string.
For more tolerant parsing, Scan will return a valid token if
possible even if a syntax error was encountered. Thus, even
if the resulting token sequence contains no illegal tokens,
a client may not assume that no error occurred. Instead it
must check the scanner's ErrorCount or the number of calls
of the error handler, if there was one installed.
Scan adds line information to the file added to the file
set with Init. Token positions are relative to that file
and thus relative to the file set.
ErrorConcrete GoType v1.0
In an ErrorList, an error is represented by an *Error.
The position Pos, if valid, points to the beginning of
the offending token, and the error condition is described
ErrorReceiver for Error v1.0
Error implements the error interface.
ErrorHandlerConcrete GoType v1.0
An ErrorHandler may be provided to Scanner.Init. If a syntax error is
encountered and a handler was installed, the handler is called with a
position and an error message. The position points to the beginning of
the offending token.
ErrorListConcrete GoType v1.0
ErrorList is a list of *Errors.
The zero value for an ErrorList is an empty ErrorList ready to use.
ErrReceiver for ErrorList v1.0
Err returns an error equivalent to this error list.
If the list is empty, Err returns nil.
ErrorReceiver for ErrorList v1.0
An ErrorList implements the error interface.
LenReceiver for ErrorList v1.0
ErrorList implements the sort Interface.
LessReceiver for ErrorList v1.0
ModeConcrete GoType v1.0
A mode value is a set of flags (or 0).
They control scanner behavior.
ScannerConcrete GoType v1.0
A Scanner holds the scanner's internal state while processing
a given text. It can be allocated as part of another data
structure but must be initialized via Init before use.