Skip to content

Commit

Permalink
Made some changes to the Rust code to make it compatible with Ruby 1.…
Browse files Browse the repository at this point in the history
…9.1.
  • Loading branch information
lokorin committed Oct 10, 2010
1 parent 488b166 commit 08784a8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 25 deletions.
72 changes: 48 additions & 24 deletions vendor/rust/rust/class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,37 +275,61 @@ def raw_call(nparam = nil)
# 1: pre 2: mid 3: post 4: mixed
def position(nparam)
case @name
when "+": (nparam.zero? ? 1 : 3)
when "-": 3
when "*": (nparam.zero? ? 1 : 3)
when "/": 3
when /\[\s*\]=/: 4
when /\[\s*\]/: 2
when "==": 3
when "!=": 3
when "<<": 3
when ">>": 3
when "!": 1
when "()": 2
when "+"
(nparam.zero? ? 1 : 3)
when "-"
3
when "*"
(nparam.zero? ? 1 : 3)
when "/"
3
when /\[\s*\]=/
4
when /\[\s*\]/
2
when "=="
3
when "!="
3
when "<<"
3
when ">>"
3
when "!"
1
when "()"
2
else
3
end
end

def valid_name
case @name
when "+": "plusop"
when "-": "minusop"
when "*": "multop"
when "/": "divop"
when /\[\s*\]=/: "ateqop"
when /\[\s*\]/: "atop"
when "==": "equalop"
when "!=": "notequalop"
when "<<": "outstream"
when ">>": "intstream"
when "!": "notop"
when "()": "parenthesisop"
when "+"
"plusop"
when "-"
"minusop"
when "*"
"multop"
when "/"
"divop"
when /\[\s*\]=/
"ateqop"
when /\[\s*\]/
"atop"
when "=="
"equalop"
when "!="
"notequalop"
when "<<"
"outstream"
when ">>"
"intstream"
when "!"
"notop"
when "()"
"parenthesisop"
else
"undefop_#{@name[0].chr.to_i}#{rand(1024)}"
end
Expand Down
2 changes: 1 addition & 1 deletion vendor/rust/rust/function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def initialize(value)
@value = value
end

private :conversion, :index_conversion, :argname, :type
private :conversion, :index_conversion, :argname
end

attr_reader :varname, :name, :parameters, :optional_count
Expand Down

0 comments on commit 08784a8

Please sign in to comment.