module AsciiMath::AST

Public Instance Methods

binary(operator, e1, e2) click to toggle source
# File lib/asciimath/ast.rb, line 38
def binary(operator, e1, e2)
  BinaryOp.new(operator, e1, e2)
end
color(r, g, b, text) click to toggle source
# File lib/asciimath/ast.rb, line 66
def color(r, g, b, text)
  Color.new(r, g, b, text)
end
expression(*e) click to toggle source
# File lib/asciimath/ast.rb, line 3
def expression(*e)
  case e.length
    when 0
      nil
    when 1
      e[0]
    else
      Sequence.new(e)
  end
end
group(lparen, e, rparen) click to toggle source
# File lib/asciimath/ast.rb, line 18
def group(lparen, e, rparen)
  Group.new(lparen, e, rparen)
end
identifier(value) click to toggle source
# File lib/asciimath/ast.rb, line 58
def identifier(value)
  Identifier.new(value)
end
infix(e1, operator, e2) click to toggle source
# File lib/asciimath/ast.rb, line 42
def infix(e1, operator, e2)
  InfixOp.new(operator, e1, e2)
end
matrix(lparen, rows, rparen) click to toggle source
# File lib/asciimath/ast.rb, line 62
def matrix(lparen, rows, rparen)
  Matrix.new(lparen, rows, rparen)
end
number(value) click to toggle source
# File lib/asciimath/ast.rb, line 50
def number(value)
  Number.new(value)
end
paren(lparen, e, rparen) click to toggle source
# File lib/asciimath/ast.rb, line 14
def paren(lparen, e, rparen)
  Paren.new(lparen, e, rparen)
end
sub(e, sub) click to toggle source
# File lib/asciimath/ast.rb, line 26
def sub(e, sub)
  SubSup.new(e, sub, nil)
end
subsup(e, sub, sup) click to toggle source
# File lib/asciimath/ast.rb, line 22
def subsup(e, sub, sup)
  SubSup.new(e, sub, sup)
end
sup(e, sup) click to toggle source
# File lib/asciimath/ast.rb, line 30
def sup(e, sup)
  SubSup.new(e, nil, sup)
end
symbol(symbol, text) click to toggle source
# File lib/asciimath/ast.rb, line 54
def symbol(symbol, text)
  Symbol.new(symbol, text)
end
text(value) click to toggle source
# File lib/asciimath/ast.rb, line 46
def text(value)
  Text.new(value)
end
unary(operator, e) click to toggle source
# File lib/asciimath/ast.rb, line 34
def unary(operator, e)
  UnaryOp.new(operator, e)
end