struct C0::Tokenizer

Overview

High-performance zero-copy tokenizer for C0DATA.

Scans a byte buffer for control codes (< 0x20) and emits tokens as offsets into the original buffer. No allocation for data values.

The hot loop is a single comparison: byte < 0x20.

Defined in:

c0/tokenizer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(buf : Bytes) #

[View source]

Instance Method Detail

def each(& : Token -> ) : Nil #

Yields each token to the block. This is the primary interface for streaming consumption.


[View source]
def to_a : Array(Token) #

Collects all tokens into an array. Convenience method for non-streaming use. Prefer #each for performance.


[View source]