class Luce::TextParser
- Luce::TextParser
- Reference
- Object
Overview
A parser to parse a segment of source text.
Direct Known Subclasses
Defined in:
luce/text_parser.crConstructors
Instance Method Summary
-
#[](range : Range) : String
Returns a substring using a Range's begin and end as character indicies.
-
#advance : Nil
Moves the read position one character ahead.
-
#advance_by(length : Int32) : Nil
Moves the read position for length characters.
- #char_at(position : Int32 | Nil = nil) : Int32
-
#done? : Bool
Whether the read position has reached the end of
#source
. -
#move_through_whitespace(multiline : Bool = false) : Int32
Walk the parser forward through any whitespace.
- #pos : Int32
-
#size : Int32
The size of
#source
. - #source : String
Constructor Detail
Instance Method Detail
Returns a substring using a Range's begin and end as character indicies.
def advance_by(length : Int32) : Nil
#
Moves the read position for length characters. length can be negative.
def 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
.