abstract class Ven::Parselet::Share

Overview

Various methods and properties shared by the two parselet kinds, Nud and Led.

Direct Known Subclasses

Defined in:

ven/parselet/share.cr

Constructors

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(precedence : Ven::Precedence = Precedence::ZERO) #

Makes a parselet with precedence precedence.

NOTE Having precedence is experimental for nuds.


[View source]

Instance Method Detail

def block(opening = true, semicolon : Bool = false) #

Reads a block under the jurisdiction of this parselet.

Returns the statements of the block.

If opening is false, the opening paren won't be read.


[View source]
def die(message : String) #

Dies of ReadError given message, which should explain why the error happened.


[View source]
def led(precedence = @precedence) #

Reads a led under the jurisdiction of this parselet, with the precedence of this parselet.


[View source]
def precedence : Precedence #

The precedence of this parselet (experimental for nuds).


[View source]
def semicolon : Bool #

Whether a semicolon must follow this parselet.


[View source]
def symbol(tag, token = nil) : QSymbol #

Reads a symbol if token is nil (orelse uses the value of token) and creates the corresponding symbol quote.


[View source]

Macro Detail

macro if?(word, then consequtive, else alternative = nil) #

Evaluates consequtive if read word; otherwise, evaluates alternative.


[View source]
macro lexeme(token = token) #

Returns the lexeme of token.

token defaults to token, which is the standard name of the lead token in parse.


[View source]
macro type(token = token) #

Returns the type of token.

token defaults to token, which is the standard name of the lead token in parse.


[View source]