lib/plurimath/latex/parse.rb in plurimath-0.3.3 vs lib/plurimath/latex/parse.rb in plurimath-0.3.4
- old
+ new
@@ -88,11 +88,11 @@
str('"').as(:symbol) |
symbol_class_commands |
(slash >> math_operators_classes) |
match["a-zA-Z"].as(:symbols) |
match(/\d+(\.[0-9]+)|\d/).repeat(1).as(:number) |
- str("\\\\").as("\\\\") >> match(/\s/).repeat |
+ (str("\\\\").as("\\\\") >> match(/\s/).repeat) |
str("\\ ").as(:space)
end
rule(:intermediate_exp) do
(lparen.as(:left_paren) >> expression.maybe.as(:expression) >> rparen.as(:right_paren)).as(:intermediate_exp) |
@@ -138,14 +138,14 @@
str("\\left").as(:left) >> (left_parens | str(".").maybe) >>
(
(expression.repeat.as(:dividend) >> str("\\over") >> expression.repeat.as(:divisor)) |
expression.as(:expression).maybe
) >>
- (
- str("\\right").as(:right).maybe >> (right_parens | str(".").maybe)
- )
- )
+ (
+ str("\\right").as(:right).maybe >> (right_parens | str(".").maybe)
+ )
+ )
end
rule(:over_class) do
(
(str("{") >> expression.repeat.as(:dividend) >> str("\\over") >> expression.repeat.as(:divisor) >> str("}")) |
@@ -154,11 +154,11 @@
).as(:over)
end
rule(:iteration) do
(sequence.as(:sequence) >> iteration.as(:expression)) |
- sequence >> expression.maybe
+ (sequence >> expression.maybe)
end
rule(:expression) do
(iteration >> expression) |
iteration |
@@ -202,10 +202,10 @@
(slashed_value(first_value, :underover) >> intermediate_exp.maybe.as(:first_value) >> dynamic_power_base) |
(slashed_value(first_value, :underover))
when :binary
(slashed_value(first_value, :binary) >> intermediate_exp.as(:first_value) >> intermediate_exp.as(:second_value)).as(:binary)
when :text
- (slashed_value(first_value, :text) >> (str("{") >> (match("[^\}]").repeat).as(:first_value) >> str("}")))
+ (slashed_value(first_value, :text) >> (str("{") >> match("[^}]").repeat.as(:first_value) >> str("}")))
end
end
def slashed_value(first_value, name = nil)
(slash >> first_value.as(name))