lib/asciimath/parser.rb in asciimath-1.0.3 vs lib/asciimath/parser.rb in asciimath-1.0.4
- old
+ new
@@ -36,10 +36,11 @@
# - :identifier a symbolic name or a bit of text without any further semantics
# - :text a bit of arbitrary text
# - :number a number
# - :operator a mathematical operator symbol
# - :unary a unary operator (e.g., sqrt, text, ...)
+ # - :font a unary font command (e.g., bb, cc, ...)
# - :infix an infix operator (e.g, /, _, ^, ...)
# - :binary a binary operator (e.g., frac, root, ...)
# - :accent an accent character
# - :eof indicates no more tokens are available
#
@@ -348,10 +349,16 @@
'hArr' => {:value => '⇔', :type => :operator},
# Other
'sqrt' => {:value => :sqrt, :type => :unary},
'text' => {:value => :text, :type => :unary},
+ 'bb' => {:value => :bold, :type => :font},
+ 'bbb' => {:value => :double_struck, :type => :font},
+ 'cc' => {:value => :script, :type => :font},
+ 'tt' => {:value => :monospace, :type => :font},
+ 'fr' => {:value => :fraktur, :type => :font},
+ 'sf' => {:value => :sans_serif, :type => :font},
'frac' => {:value => :frac, :type => :binary},
'root' => {:value => :root, :type => :binary},
'stackrel' => {:value => :over, :type => :binary},
'/' => {:value => :frac, :type => :infix},
'_' => {:value => :sub, :type => :infix},
@@ -479,12 +486,12 @@
end
end
when :accent
s = parse_simple_expression(tok, depth)
{:type => :binary, :s1 => s, :s2 => {:type => :operator, :c => t1[:value]}, :operator => t1[:position]}
- when :unary
+ when :unary, :font
s = parse_simple_expression(tok, depth)
- {:type => :unary, :s => s, :operator => t1[:value]}
+ {:type => t1[:type], :s => s, :operator => t1[:value]}
when :binary
s1 = parse_simple_expression(tok, depth)
s2 = parse_simple_expression(tok, depth)
{:type => :binary, :s1 => s1, :s2 => s2, :operator => t1[:value]}
when :eof