class TopDown::Parser::SyntaxError

Overview

Exception raised by the parser during Parser#parse and all instantiation of Parser.parse!.

Contains #source and #location information, which are displayed when the error is dump.

Use Parser#raise_syntax_error to raise a SyntaxError directly at parser location.

Defined in:

parser/syntax_error.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(message : String, source : String, location : Location, end_location : Location = location) #

[View source]

Instance Method Detail

def end_location : TopDown::Location #

[View source]
def end_location=(end_location : TopDown::Location) #

[View source]
def inspect_with_backtrace(io) #

Displays #message with backtrace and shows in #source the range begin_location:#location.


[View source]
def location : TopDown::Location #

[View source]
def location=(location : TopDown::Location) #

[View source]
def message : String? #

[View source]
def message=(message) #

[View source]
def source : String #

[View source]
def source=(source : String) #

[View source]
def to_s(io) #

Displays #message and shows in #source the range #location:#end_location.


[View source]