node/lib/metasm/metasm/preprocessor.rb
# reads an operator from the lexer, returns the corresponding symbol or nil
reads an operator from the lexer, returns the corresponding symbol or nil
reads an operator from the lexer returns the corresponding symbol or nil
def parse(lexer)
			opstack = []
			stack = []
			return if not e = parse_value(lexer)
			stack << e
			while op = readop(lexer)
				nil while ntok = lexer.readtok and ntok.type == :space
				lexer.unreadtok ntok
				until opstack.empty? or Expression::OP_PRIO[op.value][opstack.last]
					stack << Expression.new(opstack.pop, stack.pop, stack.pop)
				end
				opstack << op.value
				raise op, 'need rhs' if not e = parse_value(lexer)
				stack << e
			end
			until opstack.empty?
				stack << Expression.new(opstack.pop, stack.pop, stack.pop)
			end
			Expression[stack.first]
		end
def parse ( lexer ) opstack = [ ] stack = [ ] return if not e = parse_value ( lexer ) stack << e while op = readop ( lexer ) nil while ntok = lexer . readtok and ntok . type == :space lexer . unreadtok ntok until opstack . empty? or Expression :: OP_PRIO [ op . value ] [ opstack . last ] stack << Expression . new ( opstack . pop , stack . pop , stack . pop ) end opstack << op . value raise op , 'need rhs' if not e = parse_value ( lexer ) stack << e end until opstack . empty? stack << Expression . new ( opstack . pop , stack . pop , stack . pop ) end Expression [ stack . first ] end
reads an operator from the lexer, returns the corresponding symbol or nil
reads an operator from the lexer returns the corresponding symbol or nil
lexer