Class: Plurimath::Asciimath::Parse
- Inherits:
-
Parslet::Parser
- Object
- Parslet::Parser
- Plurimath::Asciimath::Parse
- Defined in:
- lib/plurimath/asciimath/parse.rb
Instance Method Summary collapse
Instance Method Details
#arr_to_expression(arr, name = nil) ⇒ Object
72 73 74 75 76 77 |
# File 'lib/plurimath/asciimath/parse.rb', line 72 def arr_to_expression(arr, name = nil) arr.reduce do |expression, expr_string| expression = str(expression).as(name || expression) if expression.is_a?(Symbol) expression | str(expr_string).as(name || expr_string) end end |
#read_text ⇒ Object
79 80 81 82 83 84 |
# File 'lib/plurimath/asciimath/parse.rb', line 79 def read_text dynamic do |_sour, context| rparen = Constants::PARENTHESIS[context.captures[:paren].to_sym] match("[^#{rparen}]").repeat.as(:text) end end |