class

Luce::TextParser

Inherits Reference < Object

A parser to parse a segment of source text.

Constructors

new(source : String)

Instance methods

[](range : Range) : String

Returns a substring using a Range's begin and end as character indicies.

advance

Moves the read position one character ahead.

advance_by(length : Int32) : Nil

Moves the read position for length characters. length can be negative.

char_at(position : Int32 | Nil = nil) : Int32
done?

Whether the read position has reached the end of source.

move_through_whitespace(multiline : Bool = false) : Int32

Walk the parser forward through any whitespace.

Set multiline to true to support multiline, otherwise it will stop before the line feed Charcode::LF.

pos
size

The size of source.

source