abstract class Ven::Parselet::Nud

Overview

A parser that is invoked by a null-denotated token.

Direct Known Subclasses

Defined in:

ven/parselet/nud.cr

Constructors

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(precedence : UInt8 = 0_u8) #

Makes a nud with precedence precedence.


[View source]

Instance Method Detail

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

Reads a block under the jurisdiction of this nud. Returns the statements of this block. If opening is false, the opening paren won't be read.


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

Dies of read error with message, which should explain why the error happened.


[View source]
def led(precedence : Precedence) #

Reads a led under the jurisdiction of this nud and with the precedence of this nud.


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

Reads a led under the jurisdiction of this nud and with the precedence of this nud.


[View source]
abstract def parse(tag : QTag, token : Word) #

Performs the parsing.


[View source]
def parse!(parser : Ven::Reader, tag : QTag, token : Ven::Word) #

Performs the parsing


[View source]
def semicolon : Bool #

Whether a semicolon must follow this nud.


[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]