Module: Aspen::CustomGrammar

Defined in:
lib/aspen/custom_grammar.rb,
lib/aspen/custom_grammar/ast.rb,
lib/aspen/custom_grammar/lexer.rb,
lib/aspen/custom_grammar/parser.rb,
lib/aspen/custom_grammar/grammar.rb,
lib/aspen/custom_grammar/matcher.rb,
lib/aspen/custom_grammar/compiler.rb,
lib/aspen/custom_grammar/ast/nodes/bare.rb,
lib/aspen/custom_grammar/ast/nodes/content.rb,
lib/aspen/custom_grammar/ast/nodes/expression.rb,
lib/aspen/custom_grammar/ast/nodes/capture_segment.rb

Defined Under Namespace

Modules: AST Classes: Compiler, Grammar, Lexer, Matcher, Parser

Class Method Summary collapse

Class Method Details

.compile(expression) ⇒ Object



12
13
14
15
16
# File 'lib/aspen/custom_grammar.rb', line 12

def self.compile(expression)
  tokens = Aspen::CustomGrammar::Lexer.tokenize(expression)
  ast = Aspen::CustomGrammar::Parser.parse(tokens)
  Aspen::CustomGrammar::Compiler.compile(ast)
end

.compile_pattern(expression) ⇒ Object



18
19
20
# File 'lib/aspen/custom_grammar.rb', line 18

def self.compile_pattern(expression)
  self.compile(expression)[:pattern]
end