class Luce::TextParser

Overview

A parser to parse a segment of source text.

Direct Known Subclasses

Defined in:

luce/text_parser.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(source : String) #

Instance Method Detail

def [](range : Range) : String #

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


def advance : Nil #

Moves the read position one character ahead.


def advance_by(length : Int32) : Nil #

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


def char_at(position : Int32 | Nil = nil) : Int32 #

def done? : Bool #

Whether the read position has reached the end of #source.


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.


def pos : Int32 #

def size : Int32 #

The size of #source.


def source : String #