mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
tool/ruby_vm support for pre-2.1 BASERUBY
as requested by devs, support for BASERUBY prior to 2.1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
069e9ff52c
commit
8a72c77c79
13 changed files with 121 additions and 112 deletions
|
|
@ -41,7 +41,7 @@ grammar = %r'
|
|||
'x
|
||||
|
||||
until scanner.eos? do
|
||||
next if scanner.scan(/#{grammar}\g<ws>+/o)
|
||||
next if scanner.scan(/\G#{grammar}\g<ws>+/o)
|
||||
split = -> (v) {
|
||||
case v when /\Avoid\z/ then
|
||||
[]
|
||||
|
|
@ -50,14 +50,14 @@ until scanner.eos? do
|
|||
end
|
||||
}
|
||||
|
||||
l1 = scanner.scan!(/#{grammar}\g<insn>/o)
|
||||
l1 = scanner.scan!(/\G#{grammar}\g<insn>/o)
|
||||
name = scanner["insn:name"]
|
||||
ope = split.(scanner["insn:opes"])
|
||||
pop = split.(scanner["insn:pops"])
|
||||
ret = split.(scanner["insn:rets"])
|
||||
|
||||
attrs = []
|
||||
while l2 = scanner.scan(/#{grammar}\g<pragma>/o) do
|
||||
while l2 = scanner.scan(/\G#{grammar}\g<pragma>/o) do
|
||||
attrs << {
|
||||
location: [path, l2],
|
||||
name: scanner["pragma:name"],
|
||||
|
|
@ -66,7 +66,7 @@ until scanner.eos? do
|
|||
}
|
||||
end
|
||||
|
||||
l3 = scanner.scan!(/#{grammar}\g<block>/o)
|
||||
l3 = scanner.scan!(/\G#{grammar}\g<block>/o)
|
||||
json << {
|
||||
name: name,
|
||||
location: [path, l1],
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ json = []
|
|||
scanner = RubyVM::Scanner.new '../../../defs/opt_insn_unif.def'
|
||||
path = scanner.__FILE__
|
||||
until scanner.eos? do
|
||||
next if scanner.scan(/ ^ (?: \#.* )? \n /x)
|
||||
break if scanner.scan(/ ^ __END__ $ /x)
|
||||
next if scanner.scan(/\G ^ (?: \#.* )? \n /x)
|
||||
break if scanner.scan(/\G ^ __END__ $ /x)
|
||||
|
||||
pos = scanner.scan!(/(?<series> (?: [\ \t]* \w+ )+ ) \n /mx)
|
||||
pos = scanner.scan!(/\G (?<series> (?: [\ \t]* \w+ )+ ) \n /mx)
|
||||
json << {
|
||||
location: [path, pos],
|
||||
signature: scanner["series"].strip.split
|
||||
|
|
|
|||
|
|
@ -29,18 +29,17 @@ grammar = %r/
|
|||
/mx
|
||||
|
||||
until scanner.eos? do
|
||||
break if scanner.scan(/ ^ __END__ $ /x)
|
||||
next if scanner.scan(/#{grammar} \g<ws>+ /ox)
|
||||
break if scanner.scan(/\G ^ __END__ $ /x)
|
||||
next if scanner.scan(/\G#{grammar} \g<ws>+ /ox)
|
||||
|
||||
line = scanner.scan!(/#{grammar} \g<decl> /mox)
|
||||
line = scanner.scan!(/\G#{grammar} \g<decl> /mox)
|
||||
insn = scanner["insn"]
|
||||
args = scanner["args"]
|
||||
ary = []
|
||||
until args.strip.empty? do
|
||||
tmp = StringScanner.new args
|
||||
tmp.scan(/#{grammar} \g<args> /mox)
|
||||
ary << tmp["arg"]
|
||||
args = tmp["remain"]
|
||||
md = /\G#{grammar} \g<args> /mox.match(args)
|
||||
ary << md["arg"]
|
||||
args = md["remain"]
|
||||
break unless args
|
||||
end
|
||||
json << {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ grammar = %r/
|
|||
(?<ws> \u0020 ){0}
|
||||
(?<key> \w+ ){0}
|
||||
(?<value> 0|1 ){0}
|
||||
(?<define> \#define \g<ws>+ OPT_\g<key> \g<ws>+ \g<value> \g<ws>*\n )
|
||||
(?<define> \G \#define \g<ws>+ OPT_\g<key> \g<ws>+ \g<value> \g<ws>*\n )
|
||||
/mx
|
||||
|
||||
until scanner.eos? do
|
||||
if scanner.scan grammar then
|
||||
json[scanner['key']] = ! scanner['value'].to_i.zero? # not nonzero?
|
||||
else
|
||||
scanner.scan(/.*\n/)
|
||||
scanner.scan(/\G.*\n/)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue