Scanners
Norg.Scanners.NORG_LINE_ENDING
Norg.Scanners.NORG_PUNCTUATION
Norg.Scanners.TOKENKIND_PARSING_ORDER
Norg.Scanners.ScanResult
Norg.Scanners.scan
Norg.Scanners.scan
Norg.Scanners
— ModuleProvides the scanners for the tokenizer.
The role of a scanner is to recognize a sequence of characters and to produce a ScanResult
.
Norg.Scanners.NORG_LINE_ENDING
— ConstantAll the UTF-8 characters that Norg specifies as a whitespace.
Norg.Scanners.NORG_PUNCTUATION
— ConstantAll the UTF-8 characters that are punctuation in Norg specification. See the norg specification
Norg.Scanners.TOKENKIND_PARSING_ORDER
— ConstantAll the registered Kinds.Kind
that Scanners.scan
will try when consuming entries.
Norg.Scanners.ScanResult
— TypeStores the result of a scanning operation. If length
is 0 that means that no matching token was found.
Norg.Scanners.scan
— Functionscan(pattern, input)
Scan the given input
for the given pattern
.
It will produce a Scanners.ScanResult
.
If pattern
is given, then try to fit the given patter at the start of input
. If pattern
is :
- a
ScanStrategy
subtype : scan with the given strategy (e.g.Word
orWhitespace
) - a
Kind
: parse for the given kind. - an
AbstractString
:input
muststartswith
pattern
. - an
AbstractArray
: callscan
on each element ofpattern
until one matches. - a
Set{Char}
: first character must be included inpattern
.
Norg.Scanners.scan
— Methodscan(input; line=0, charnum=0)
Scan the given input
for Scanners.TOKENKIND_PARSING_ORDER
until one returns a successful Scanners.ScanResult
or throw an error if none succeed.
This will return a Tokens.Token
.