lib/asciimath/parser.rb in asciimath-2.0.1 vs lib/asciimath/parser.rb in asciimath-2.0.2
- old
+ new
@@ -439,10 +439,11 @@
b.add('bfr', :bold_fraktur, :unary)
b.add('sf', :sans_serif, :unary)
b.add('bsf', :bold_sans_serif, :unary)
b.add('sfi', :sans_serif_italic, :unary)
b.add('sfbi', :sans_serif_bold_italic, :unary)
+ b.add('rm', :roman, :unary)
# Greek letters
b.add('alpha', :alpha, :symbol)
b.add('Alpha', :Alpha, :symbol)
b.add('beta', :beta, :symbol)
@@ -610,16 +611,20 @@
nil
else
token_to_symbol(t1)
end
when :unary
- s = unwrap_paren(parse_simple_expression(tok, depth))
+ parse_simple_expression = parse_simple_expression(tok, depth)
+ s = unwrap_paren(parse_simple_expression)
+ s = identifier('') if s.nil?
s = convert_node(s, t1[:convert_operand])
unary(token_to_symbol(t1), s)
when :binary
s1 = unwrap_paren(parse_simple_expression(tok, depth))
+ s1 = identifier('') if s1.nil?
s2 = unwrap_paren(parse_simple_expression(tok, depth))
+ s2 = identifier('') if s2.nil?
s1 = convert_node(s1, t1[:convert_operand1])
s2 = convert_node(s2, t1[:convert_operand2])
binary(token_to_symbol(t1), s1, s2)
@@ -702,10 +707,9 @@
end
def convert_to_color(color_expression)
s = ""
append_color_text(s, color_expression)
- s
case s
when /#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i
color_value = {:r => $1.to_i(16), :g => $2.to_i(16), :b => $3.to_i(16), }
when /#([0-9a-f])([0-9a-f])([0-9a-f])/i