struct CrystalRobots::Compiler::Parser::GrammarRule

Overview

  1. Start by matching the first Regex. If initially assigned Nil in creation, it should get assigned by the next argument (TokenDef).
  2. Next, use the TokenDef Hash to select a type. If the rule Regex is Nil, assign it using the TokenDef Regex. If the it TokenDef Hash doesn't have a value match, don't assign a type yet.
  3. Next, use the provided type to set a type. If it is Nil, keep the already assigned type. If that is Nil, error out.
  4. Finally, run the mapping function using the mapping type to set the final node parameters. If it is Nil, drop the token.

Defined in:

compiler/parser.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(regex : Regex, tokendef : TokenDef, type : Type | Nil, map : MappingType) #

def self.new(rs : Tuple(Regex | Nil, Array(Tuple(String, Type)) | Nil, Type | Nil, MappingType | Nil)) #

Instance Method Detail



def regex : Regex #

def regex=(regex : Regex) #


def tokendef=(tokendef : CrystalRobots::Compiler::Parser::TokenDef) #


def type=(type : CrystalRobots::Compiler::Type | Nil) #