make functions in RubyAlgebra::Parser self.* functions
This commit is contained in:
@@ -57,7 +57,7 @@ module RubyAlgebra
|
||||
end
|
||||
end
|
||||
|
||||
def tokenize(e)
|
||||
def self.tokenize(e)
|
||||
i = 0
|
||||
add_implicit_mul = false
|
||||
while i < e.length
|
||||
@@ -123,7 +123,7 @@ module RubyAlgebra
|
||||
yield EndToken.new
|
||||
end
|
||||
|
||||
def parse(expr)
|
||||
def self.parse(expr)
|
||||
operators = []
|
||||
out_stack = []
|
||||
tokenize(expr) do |token|
|
||||
@@ -158,7 +158,7 @@ module RubyAlgebra
|
||||
out_stack[0]
|
||||
end
|
||||
|
||||
def _parse_make_op(operators, out_stack)
|
||||
def self._parse_make_op(operators, out_stack)
|
||||
oper = operators.pop
|
||||
unless (oper.type == :op && out_stack.length >= 2) || (oper.type == :unary_op && out_stack.length >= 1)
|
||||
raise Exception.new
|
||||
@@ -187,7 +187,7 @@ module RubyAlgebra
|
||||
end
|
||||
end
|
||||
|
||||
def _parse_op_prio(op_token)
|
||||
def self._parse_op_prio(op_token)
|
||||
case op_token.op
|
||||
when :add, :sub
|
||||
1
|
||||
|
||||
Reference in New Issue
Block a user