struct Novika::Classifier
- Novika::Classifier
- Struct
- Value
- Object
Overview
Classifier brings unclassified forms to life.
Classifier assigns types to fragments of Novika code
conveniently called unclassified forms: this
unclassified form is a decimal, this one is a word, that
one is a quote.
Unclassified forms are given to Classifier by Scissors,
an object dedicated to cutting a big blob of Novika code
into smaller fragments.
Scissors and Classifier are designed to work in
tandem. Separating one from the other is possible and will
work, but is not recommended unless you have read the source
code of both.
Defined in:
novika/classifier.crConstructors
-
.new(source : String, block : Novika::Block)
Initializes a classifier from the given source string and Novika block.
Instance Method Summary
-
#block : Novika::Block
Returns the block used by this classifier.
-
#bytes : Pointer(UInt8)
Returns the source code byte pointer used by this classifier.
-
#classify(start, count, dot) : Nil
Classifies the subrange starting at byte index start, and count bytes long.
-
#classify(start, count)
Classifies the subrange starting at byte index start, and count bytes long.
-
#end
Ends classification.
Constructor Detail
Initializes a classifier from the given source string and Novika block.
block is treated as the ceiling (toplevel) block for source, meaning you can't close it in source, and it doesn't need to be open.
Instance Method Detail
Classifies the subrange starting at byte index start,
and count bytes long. dot is the byte index of '.'.
These three arguments are assumed to come from Scissors#cut.
This method does practically no bounds checks, is unsafe and must be worked with carefully.
Classifies the subrange starting at byte index start, and count bytes long.