rbx-trepanning 0.2.0-universal-rubinius-2.0 → 0.2.1-universal-rubinius-2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +2 -1
- data/.travis.yml +4 -0
- data/ChangeLog +119 -1
- data/Gemfile +16 -0
- data/NEWS +15 -8
- data/README.md +72 -0
- data/Rakefile +16 -13
- data/app/cmd_parse.kpeg +38 -40
- data/app/cmd_parse.rb +25 -20
- data/app/cmd_parser.rb +1030 -1036
- data/app/complete.rb +12 -12
- data/app/default.rb +6 -5
- data/app/options.rb +1 -1
- data/app/util.rb +17 -10
- data/lib/trepanning.rb +0 -1
- data/processor.rb +32 -32
- data/processor/command.rb +32 -13
- data/processor/command/base/submgr.rb +22 -14
- data/processor/command/base/subsubcmd.rb +11 -13
- data/processor/command/base/subsubmgr.rb +38 -19
- data/processor/command/disassemble.rb +11 -11
- data/processor/command/help.rb +24 -24
- data/processor/command/shell.rb +17 -17
- data/processor/help.rb +9 -11
- data/processor/load_cmds.rb +26 -16
- data/processor/mock.rb +8 -9
- data/processor/subcmd.rb +12 -12
- data/test/functional/fn_helper.rb +8 -7
- data/test/functional/test-recursive-bt.rb +26 -15
- data/test/integration/test-quit.rb +8 -2
- data/test/unit/cmd-helper.rb +2 -2
- data/test/unit/test-base-subcmd.rb +14 -3
- data/test/unit/test-io-tcpserver.rb +10 -5
- data/test/unit/test-proc-validate.rb +4 -4
- metadata +116 -110
- data/README.textile +0 -34
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDhhZTRhN2U4YmIwNjI1MzRmYjI4MmRiOTViZmJkODc5YTBhZmYxZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Nzk4MGZkMGRmYWRhNzkxODlhMDBhNWI1MTQ4MGNjYzY1YWU4ZTdhZQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGRhYzUxYjUxODU1OWJiZGQyY2JjMzdmMTZkNGI0MGI1YTE1NGRhNjU0OTM1
|
10
|
+
ZDc0MjNjMTVkNGRjZjY4YjIyYWQwMjdlNGFhODViMGM5ZmRkNzkwZmRmYjQz
|
11
|
+
ZjJhMjZiNTQxOWVkMDc3YmU3MmFhNjBhY2I5YTZhZjcxYjkxNzk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjY1OGQ1MDIyNmE2ZjRkNWFhZGE2ODQ1ZDE2M2E0YmY1YmVkZWY0ZDI5NTlk
|
14
|
+
YWJjMjdkNmE4OTM4MTlhMzU3OWUxNjIxMmQyNWE1ZDg2MzFhNGMyMzkzMjY1
|
15
|
+
OWMwYmFkNWRlYzNhZTExZWFmZWJlYTViYTk4NjczYTc0Nzk0ZGU=
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/ChangeLog
CHANGED
@@ -1,6 +1,124 @@
|
|
1
|
+
2013-07-18 rocky <rockyb@rubyforge.org>
|
2
|
+
|
3
|
+
* NEWS, app/options.rb: Get ready for release 0.2.1
|
4
|
+
|
5
|
+
2013-07-18 rocky <rockyb@rubyforge.org>
|
6
|
+
|
7
|
+
* README.md, README.textile: Update REAME
|
8
|
+
|
9
|
+
2013-07-18 rocky <rockyb@rubyforge.org>
|
10
|
+
|
11
|
+
* test/integration/test-quit.rb, test/unit/test-io-tcpserver.rb:
|
12
|
+
Make tests work in the presense of different environmental
|
13
|
+
conditions.
|
14
|
+
|
15
|
+
2013-07-18 rocky <rockyb@rubyforge.org>
|
16
|
+
|
17
|
+
* test/functional/fn_helper.rb,
|
18
|
+
test/functional/test-recursive-bt.rb, test/integration/test-quit.rb:
|
19
|
+
... And the last of the failing 1.9 tests are working! (This batch
|
20
|
+
was just about tests, not the debugger code)
|
21
|
+
|
22
|
+
2013-07-18 rocky <rockyb@rubyforge.org>
|
23
|
+
|
24
|
+
* app/cmd_parse.rb: Ruby 1.8/1.9 compatability. This one is
|
25
|
+
important and buried deep in there: resolving method/class objects.
|
26
|
+
|
27
|
+
2013-07-17 rocky <rockyb@rubyforge.org>
|
28
|
+
|
29
|
+
* processor/command/base/subsubcmd.rb, processor/help.rb: More
|
30
|
+
1.8/1.9 compatibility
|
31
|
+
|
32
|
+
2013-07-17 rocky <rockyb@rubyforge.org>
|
33
|
+
|
34
|
+
* : commit 7ae1a2e45c687ab388064cc7af4ea497aefc7d06 Author: rocky
|
35
|
+
<rockyb@rubyforge.org> Date: Wed Jul 17 16:44:18 2013 -0400
|
36
|
+
|
37
|
+
2013-07-17 rocky <rockyb@rubyforge.org>
|
38
|
+
|
39
|
+
* Gemfile, app/cmd_parser.rb: Update parser with kpeg version 0.10.0
|
40
|
+
|
41
|
+
2013-07-17 rocky <rockyb@rubyforge.org>
|
42
|
+
|
43
|
+
* app/util.rb, processor/command.rb,
|
44
|
+
processor/command/base/subsubmgr.rb, test/unit/test-base-subcmd.rb:
|
45
|
+
More 1.9/1.8 compatability
|
46
|
+
|
47
|
+
2013-07-16 rocky <rockyb@rubyforge.org>
|
48
|
+
|
49
|
+
* Rakefile, app/complete.rb, processor/command/base/submgr.rb,
|
50
|
+
processor/command/help.rb, processor/load_cmds.rb,
|
51
|
+
processor/mock.rb, processor/subcmd.rb: Deal with one more ruby 1.8
|
52
|
+
vs 1.9 incompatiblity
|
53
|
+
|
54
|
+
2013-07-16 rocky <rockyb@rubyforge.org>
|
55
|
+
|
56
|
+
* Gemfile, processor/load_cmds.rb, rbx-trepanning.gemspec: Start
|
57
|
+
using redcard to make this work on both rubinius 1.8 and 1.9
|
58
|
+
|
59
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
60
|
+
|
61
|
+
* app/cmd_parse.kpeg, app/cmd_parse.rb, lib/trepanning.rb,
|
62
|
+
processor.rb, processor/load_cmds.rb: Towards getting this to work
|
63
|
+
on the 1.9.3 dialect
|
64
|
+
|
65
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
66
|
+
|
67
|
+
* Rakefile, processor/mock.rb: Rakefile is now 1.9 compliant
|
68
|
+
|
69
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
70
|
+
|
71
|
+
* test/unit/test-proc-validate.rb: More aggressive setting of
|
72
|
+
:start_frame in mock debugger
|
73
|
+
|
74
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
75
|
+
|
76
|
+
* test/unit/cmd-helper.rb: More aggressive setting of :start_frame
|
77
|
+
in mock debugger
|
78
|
+
|
79
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
80
|
+
|
81
|
+
* processor/command/shell.rb: Remove stray spaces between "msg" and
|
82
|
+
before "("
|
83
|
+
|
84
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
85
|
+
|
86
|
+
* processor/command/disassemble.rb: Remove stray space betwein "msg"
|
87
|
+
and before "("
|
88
|
+
|
89
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
90
|
+
|
91
|
+
* app/default.rb, test/unit/cmd-helper.rb: Add default value for
|
92
|
+
"start_frame" setting
|
93
|
+
|
94
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
95
|
+
|
96
|
+
* Gemfile: Forgot columnize
|
97
|
+
|
98
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
99
|
+
|
100
|
+
* Gemfile: Travis wants rdoc in Gemfile
|
101
|
+
|
102
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
103
|
+
|
104
|
+
* Gemfile: Travis wants rake in Gemfile
|
105
|
+
|
106
|
+
2013-07-15 rocky <rockyb@rubyforge.org>
|
107
|
+
|
108
|
+
* .gitignore, Gemfile, rbx-trepanning.gemspec: Add a Bundler
|
109
|
+
Gemfile.
|
110
|
+
|
111
|
+
2013-07-14 rocky <rockyb@rubyforge.org>
|
112
|
+
|
113
|
+
* app/options.rb: Bump required gem versions
|
114
|
+
|
115
|
+
2013-07-14 rocky <rockyb@rubyforge.org>
|
116
|
+
|
117
|
+
* .travis.yml: Try travis
|
118
|
+
|
1
119
|
2013-07-14 rocky <rockyb@rubyforge.org>
|
2
120
|
|
3
|
-
* app/options.rb: Get ready for release 0.2.0
|
121
|
+
* ChangeLog, app/options.rb: Get ready for release 0.2.0
|
4
122
|
|
5
123
|
2013-07-14 rocky <rockyb@rubyforge.org>
|
6
124
|
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
gem 'rake'
|
3
|
+
gem 'redcard'
|
4
|
+
gem 'rdoc'
|
5
|
+
gem 'columnize'
|
6
|
+
gem 'rbx-require-relative', :require => 'require_relative'
|
7
|
+
gem 'rbx-linecache', :require => 'linecache'
|
8
|
+
gem 'coderay', '>=1.0'
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem 'diff-lcs'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :development do
|
15
|
+
gem 'kpeg'
|
16
|
+
end
|
data/NEWS
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
+
July 18, 2013 (0.2.1)
|
2
|
+
- Changes to make it work on 1.9 language dialect for 2.0rc1
|
3
|
+
|
4
|
+
July 14, 2013
|
5
|
+
- Changes to make it work on 1.8 language dialect for 2.0rc1
|
6
|
+
|
7
|
+
|
1
8
|
Oct 27, 2011 (0.1.0)
|
2
|
-
- Add debugger commands:
|
9
|
+
- Add debugger commands:
|
3
10
|
* info variables (is in ruby-debug)
|
4
11
|
* info locals as alternative to "info variables locals" (is in gdb)
|
5
12
|
|
@@ -38,7 +45,7 @@ June 12, 2011 (0.0.9) Fleetwood release
|
|
38
45
|
- Add options from ruby-debug:
|
39
46
|
* --cd
|
40
47
|
* --include
|
41
|
-
* --require
|
48
|
+
* --require
|
42
49
|
* --debug
|
43
50
|
- fix bugs, and improve help
|
44
51
|
|
@@ -50,10 +57,10 @@ March 15, 2011 (0.0.8)
|
|
50
57
|
* VM offsets are now specified via @ rather than o or O
|
51
58
|
* Filenames can be quoted and blanks and characters inside escaped
|
52
59
|
- Document command syntax by adding it as a new category with sub help
|
53
|
-
- More controlled parsing of method names
|
60
|
+
- More controlled parsing of method names
|
54
61
|
- improvements to "info files"
|
55
62
|
show if we have a compiled method object for the file
|
56
|
-
- eval? now strips more:
|
63
|
+
- eval? now strips more:
|
57
64
|
* leading "return" or "case", or "unless"
|
58
65
|
* trailing "then"
|
59
66
|
- Save and restore some debugger state across a restart
|
@@ -74,17 +81,17 @@ Feb 15, 2011 (0.0.6)
|
|
74
81
|
|
75
82
|
Feb 15, 2011 (0.0.5)
|
76
83
|
- "disassemble" command: allow disassembly of specified line numbers
|
77
|
-
- GNU Readline:
|
78
|
-
* Start GNU readline tab (command) completion.
|
84
|
+
- GNU Readline:
|
85
|
+
* Start GNU readline tab (command) completion.
|
79
86
|
* Save and restore command history
|
80
87
|
* add --readline and --no-readline options to trepanx
|
81
88
|
- Macros can return more than one command now
|
82
|
-
- help
|
89
|
+
- help
|
83
90
|
* "help macros" shows all macro names
|
84
91
|
* "help aliases" shows all alias names
|
85
92
|
* "help *" lists macros and aliases now
|
86
93
|
- start "info line"
|
87
|
-
- "info file" has/shows File::stat()'s mtime and ctime
|
94
|
+
- "info file" has/shows File::stat()'s mtime and ctime
|
88
95
|
- be able to pass --verbose to ruby to rake
|
89
96
|
|
90
97
|
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/rocky/rbx-trepanning.png)](https://travis-ci.org/rocky/rbx-trepanning)
|
2
|
+
|
3
|
+
## Summary trepanx
|
4
|
+
|
5
|
+
The trepanning debugger gdb-like debugger. As such, it is both a high-level and low-level debugger. It is a also a rewrite of *ruby-debug*.
|
6
|
+
|
7
|
+
## Installing
|
8
|
+
|
9
|
+
```console
|
10
|
+
gem install rbx-trepanning
|
11
|
+
```
|
12
|
+
|
13
|
+
If you want to run from git:
|
14
|
+
|
15
|
+
```console
|
16
|
+
$ git clone https://github.com/rocky/rbx-trepanning.git
|
17
|
+
$ cd rbx-trepanning
|
18
|
+
$ bundle install # load dependent packages
|
19
|
+
$ rake test # test it
|
20
|
+
$ rake install # install it
|
21
|
+
```
|
22
|
+
|
23
|
+
should get you going.
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
## Running
|
28
|
+
|
29
|
+
To run initially:
|
30
|
+
|
31
|
+
```console
|
32
|
+
$ trepanx my-ruby-program.rb
|
33
|
+
```
|
34
|
+
|
35
|
+
Or to call from inside your code:
|
36
|
+
|
37
|
+
```console
|
38
|
+
require 'trepanning'
|
39
|
+
debugger # Don't stop here...
|
40
|
+
work # but stop here.
|
41
|
+
```
|
42
|
+
|
43
|
+
If you want an immediate stop:
|
44
|
+
|
45
|
+
```console
|
46
|
+
debugger(:immediate=>true)
|
47
|
+
```
|
48
|
+
|
49
|
+
Finally, if you put in your _.trepanx_
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
Rubinius::Loader.debugger = proc {
|
53
|
+
require 'trepanning';
|
54
|
+
Trepan.start(:skip_loader => :Xdebug)
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
Then you can use the _-Xdebug_ option the Ruby, e.g.
|
59
|
+
|
60
|
+
```
|
61
|
+
rbx -Xdebug my-ruby-program.rb
|
62
|
+
```
|
63
|
+
|
64
|
+
## See Also
|
65
|
+
|
66
|
+
* There is extensive on-line help. Run `help` inside the debugger.
|
67
|
+
* There is a [google group mailing list](http://groups.google.com/group/ruby-debugger for Ruby debuggers.)
|
68
|
+
* The [Wiki](https://github.com/rocky/rbx-trepanning/wiki).
|
69
|
+
|
70
|
+
## Author
|
71
|
+
|
72
|
+
Rocky Bernstein
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
# -*- Ruby -*-
|
3
|
-
# Are we Rubinius? The right versions of it?
|
4
|
-
raise RuntimeError,
|
3
|
+
# Are we Rubinius? The right versions of it?
|
4
|
+
raise RuntimeError,
|
5
5
|
'This package is for Rubinius 1.2.[34] or 2.0.x only!' unless
|
6
|
-
Object.constants.include?('Rubinius') &&
|
7
|
-
Rubinius.constants.include?('VM') &&
|
6
|
+
Object.constants.include?('Rubinius') &&
|
7
|
+
Rubinius.constants.include?('VM') &&
|
8
8
|
Rubinius::VERSION =~ /1\.2\.[34]/ || Rubinius::VERSION =~ /2\.0/
|
9
9
|
|
10
10
|
require 'rubygems'
|
@@ -36,8 +36,9 @@ task :gem=>:gemspec do
|
|
36
36
|
two_filename = gemspec.dup.file_name.gsub(/1\.2/, '2.0')
|
37
37
|
FileUtils.cp("rbx-trepanning.gemspec", "rbx-trepanning-2.0.gemspec")
|
38
38
|
gemspec_filename2 = "rbx-trepanning-2.0.gemspec"
|
39
|
-
|
40
|
-
|
39
|
+
File.open(gemspec_filename2, 'w') do |f|
|
40
|
+
lines.each {|line| f.write(line)}
|
41
|
+
end
|
41
42
|
sh "gem build #{gemspec_filename2}"
|
42
43
|
FileUtils.mv("#{two_filename}", "pkg/")
|
43
44
|
end
|
@@ -64,14 +65,15 @@ task :check => :test
|
|
64
65
|
|
65
66
|
require 'rbconfig'
|
66
67
|
def RbConfig.ruby
|
67
|
-
File.join(RbConfig::CONFIG['bindir'],
|
68
|
-
RbConfig::CONFIG['RUBY_INSTALL_NAME'] +
|
68
|
+
File.join(RbConfig::CONFIG['bindir'],
|
69
|
+
RbConfig::CONFIG['RUBY_INSTALL_NAME'] +
|
69
70
|
RbConfig::CONFIG['EXEEXT'])
|
70
71
|
end unless defined? RbConfig.ruby
|
71
72
|
|
72
73
|
def run_standalone_ruby_files(list, opts={})
|
73
74
|
puts '*' * 40
|
74
75
|
list.each do |ruby_file|
|
76
|
+
puts ruby_file
|
75
77
|
system(RbConfig.ruby, ruby_file)
|
76
78
|
p $?.exitstatus
|
77
79
|
break if $?.exitstatus != 0 && !opts[:continue]
|
@@ -123,7 +125,7 @@ task :test do
|
|
123
125
|
e
|
124
126
|
end
|
125
127
|
end.compact
|
126
|
-
|
128
|
+
|
127
129
|
exceptions.each {|e| puts e;puts e.backtrace }
|
128
130
|
raise 'Test failures' unless exceptions.empty?
|
129
131
|
end
|
@@ -164,6 +166,7 @@ end
|
|
164
166
|
|
165
167
|
desc 'Run each processor Ruby file in standalone mode.'
|
166
168
|
task :'check:unit' do
|
169
|
+
# run_standalone_ruby_files(FileList['test/unit/**/test-*.rb'], :continue=>true)
|
167
170
|
run_standalone_ruby_files(FileList['test/unit/**/test-*.rb'])
|
168
171
|
end
|
169
172
|
|
@@ -181,8 +184,8 @@ desc 'Generate command parser.'
|
|
181
184
|
task :'cmd_parse' do
|
182
185
|
require 'tmpdir'
|
183
186
|
temp_file = File.join(Dir.tmpdir, "cmd_parser_#{$$}.rb")
|
184
|
-
sh("kpeg --name CmdParse --verbose --stand-alone " +
|
185
|
-
"#{File.join(ROOT_DIR, %w(app cmd_parse.kpeg))} " +
|
187
|
+
sh("kpeg --name CmdParse --verbose --stand-alone " +
|
188
|
+
"#{File.join(ROOT_DIR, %w(app cmd_parse.kpeg))} " +
|
186
189
|
"--output #{temp_file}")
|
187
190
|
end
|
188
191
|
|
@@ -214,7 +217,7 @@ Rake::RDocTask.new("rdoc") do |rdoc|
|
|
214
217
|
|
215
218
|
rdoc.rdoc_files.include(%w(lib/trepanning.rb processor/*.rb
|
216
219
|
processor/command/*.rb
|
217
|
-
app/*.rb intf/*.rb io/*.rb
|
220
|
+
app/*.rb intf/*.rb io/*.rb
|
218
221
|
))
|
219
222
|
end
|
220
223
|
|
@@ -240,5 +243,5 @@ task :rm_tilde_backups do
|
|
240
243
|
end
|
241
244
|
|
242
245
|
desc 'Remove built files'
|
243
|
-
task :clean => [:clobber_package, :clobber_rdoc, :rm_patch_residue,
|
246
|
+
task :clean => [:clobber_package, :clobber_rdoc, :rm_patch_residue,
|
244
247
|
:rm_tilde_backups]
|
data/app/cmd_parse.kpeg
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
# -*- Ruby -*-
|
2
|
-
|
3
1
|
%% {
|
4
|
-
#####################################################
|
2
|
+
#####################################################
|
5
3
|
# Structure to hold composite method names
|
6
4
|
SymbolEntry = Struct.new(:type, :name, :chain)
|
7
5
|
|
@@ -17,7 +15,7 @@
|
|
17
15
|
List = Struct.new(:position, :num)
|
18
16
|
|
19
17
|
DEFAULT_OPTS = {
|
20
|
-
:debug=>false,
|
18
|
+
:debug=>false,
|
21
19
|
:file_exists_proc => Proc.new{|filename|
|
22
20
|
File.readable?(filename) && !File.directory?(filename)
|
23
21
|
}
|
@@ -34,37 +32,37 @@
|
|
34
32
|
|
35
33
|
upcase_letter = /[A-Z]/
|
36
34
|
downcase_letter = /[a-z]/
|
37
|
-
suffix_letter = /[=!?]/
|
35
|
+
suffix_letter = /[=!?]/
|
38
36
|
letter = upcase_letter
|
39
37
|
| downcase_letter
|
40
38
|
id_symbol = letter | "_" | [0-9]
|
41
39
|
|
42
40
|
|
43
41
|
# An variable or a method identifier
|
44
|
-
# Examples:
|
42
|
+
# Examples:
|
45
43
|
# var1
|
46
|
-
# my_var?
|
44
|
+
# my_var?
|
47
45
|
# But not: Variable or @var
|
48
46
|
vm_identifier = < (downcase_letter | "_") id_symbol* suffix_letter? >
|
49
|
-
{
|
47
|
+
{
|
50
48
|
SymbolEntry.new(:variable, text)
|
51
49
|
}
|
52
50
|
|
53
|
-
# Examples:
|
51
|
+
# Examples:
|
54
52
|
# var1
|
55
|
-
# But not: my_var?, my_var!
|
53
|
+
# But not: my_var?, my_var!
|
56
54
|
variable_identifier = < (downcase_letter | "_") id_symbol* >
|
57
|
-
{
|
55
|
+
{
|
58
56
|
SymbolEntry.new(:variable, text)
|
59
57
|
}
|
60
58
|
|
61
|
-
# Examples:
|
59
|
+
# Examples:
|
62
60
|
# MY_CONSTANT
|
63
61
|
# MyConstant_01
|
64
62
|
# But not:
|
65
63
|
# MyConstant_01?
|
66
64
|
constant_identifier = < upcase_letter id_symbol* >
|
67
|
-
{
|
65
|
+
{
|
68
66
|
SymbolEntry.new(:constant, text)
|
69
67
|
}
|
70
68
|
|
@@ -76,14 +74,14 @@ global_identifier = < "$" (constant_identifier | variable_identifier) >
|
|
76
74
|
SymbolEntry.new(:global, text)
|
77
75
|
}
|
78
76
|
|
79
|
-
# Examples:
|
77
|
+
# Examples:
|
80
78
|
# Foo
|
81
79
|
# foo
|
82
80
|
# But not:
|
83
81
|
# foo!, @foo, Class.foo
|
84
82
|
local_internal_identifier = constant_identifier | variable_identifier
|
85
83
|
|
86
|
-
# Examples:
|
84
|
+
# Examples:
|
87
85
|
# Foo, foo, foo!
|
88
86
|
# foo
|
89
87
|
# But not:
|
@@ -94,29 +92,29 @@ local_identifier = constant_identifier | vm_identifier
|
|
94
92
|
instance_identifier = < '@' local_identifier >
|
95
93
|
{
|
96
94
|
SymbolEntry.new(:instance, text)
|
97
|
-
}
|
95
|
+
}
|
98
96
|
|
99
97
|
|
100
98
|
# Example: @@foo
|
101
99
|
classvar_identifier = ('@@' local_identifier:id )
|
102
100
|
{
|
103
101
|
SymbolEntry.new(:classvar, id)
|
104
|
-
}
|
102
|
+
}
|
105
103
|
|
106
|
-
identifier = global_identifier
|
107
|
-
| instance_identifier
|
108
|
-
| classvar_identifier
|
109
|
-
| local_identifier
|
104
|
+
identifier = global_identifier
|
105
|
+
| instance_identifier
|
106
|
+
| classvar_identifier
|
107
|
+
| local_identifier
|
110
108
|
|
111
109
|
id_separator = < '::'|'.' > { text }
|
112
110
|
|
113
111
|
# Like of class_module_chain *after* the first name. So we don't
|
114
112
|
# allow sigils in the initial id. That is we don't allow:
|
115
|
-
# Class.@name1.@@name2.$name3
|
113
|
+
# Class.@name1.@@name2.$name3
|
116
114
|
# But we do allow final sigils:
|
117
115
|
# class.name!, class.name=
|
118
|
-
internal_class_module_chain =
|
119
|
-
< local_internal_identifier:parent id_separator:sep
|
116
|
+
internal_class_module_chain =
|
117
|
+
< local_internal_identifier:parent id_separator:sep
|
120
118
|
internal_class_module_chain:child >
|
121
119
|
{
|
122
120
|
SymbolEntry.new(parent.type, text, [parent, child, sep])
|
@@ -125,14 +123,14 @@ internal_class_module_chain =
|
|
125
123
|
|
126
124
|
|
127
125
|
# I think strict Ruby rules are that once one goes from :: to .
|
128
|
-
# There is no going back. That is, A.B::C is invalid.
|
129
|
-
#
|
130
|
-
# Also I think method names can't be constants. But such
|
126
|
+
# There is no going back. That is, A.B::C is invalid.
|
127
|
+
#
|
128
|
+
# Also I think method names can't be constants. But such
|
131
129
|
# subtleties we'll handle when we process the final structure.
|
132
130
|
# Examples:
|
133
|
-
# Object, A::B, A.b @@foo.bar, $foo.bar.baz?
|
131
|
+
# Object, A::B, A.b @@foo.bar, $foo.bar.baz?
|
134
132
|
|
135
|
-
class_module_chain =
|
133
|
+
class_module_chain =
|
136
134
|
< identifier:parent id_separator:sep internal_class_module_chain:child >
|
137
135
|
{
|
138
136
|
SymbolEntry.new(parent.type, text, [parent, child, sep])
|
@@ -157,7 +155,7 @@ class_module_chain =
|
|
157
155
|
dbl_seq = < /[^\\"]+/ > { text }
|
158
156
|
dbl_not_quote = (dbl_escapes | dbl_seq)+:ary { ary }
|
159
157
|
dbl_string = "\"" dbl_not_quote:ary "\"" { ary.join }
|
160
|
-
not_space_colon = escapes
|
158
|
+
not_space_colon = escapes
|
161
159
|
| < /[^ \t\n:]/ > { text }
|
162
160
|
not_space_colons = ( not_space_colon )+:ary { ary.join }
|
163
161
|
filename = dbl_string | not_space_colons
|
@@ -174,14 +172,14 @@ vm_offset = '@' integer:int
|
|
174
172
|
# Examples:
|
175
173
|
# @43
|
176
174
|
# 5
|
177
|
-
position =
|
178
|
-
vm_offset
|
179
|
-
| line_number:l {
|
180
|
-
Position.new(nil, nil, :line, l)
|
175
|
+
position =
|
176
|
+
vm_offset
|
177
|
+
| line_number:l {
|
178
|
+
Position.new(nil, nil, :line, l)
|
181
179
|
}
|
182
180
|
|
183
|
-
file_colon_line = file_no_colon:file &{ File.exist?(file) } ':' position:pos {
|
184
|
-
Position.new(:file, file, pos.position_type, pos.position)
|
181
|
+
file_colon_line = file_no_colon:file &{ File.exist?(file) } ':' position:pos {
|
182
|
+
Position.new(:file, file, pos.position_type, pos.position)
|
185
183
|
}
|
186
184
|
|
187
185
|
# Examples:
|
@@ -190,8 +188,8 @@ file_colon_line = file_no_colon:file &{ File.exist?(file) } ':' position:pos {
|
|
190
188
|
# Myclass.fn 5 # line number 5 of fn
|
191
189
|
# Note: Myclass.fn could be either a filename or a method name
|
192
190
|
|
193
|
-
# The below ordering is important.
|
194
|
-
# 1. Numbers can't be method names they are first. If there's a
|
191
|
+
# The below ordering is important.
|
192
|
+
# 1. Numbers can't be method names they are first. If there's a
|
195
193
|
# file with that name, later we'll allow quoting to indicate filename.
|
196
194
|
# 2. filename:position can't also be a method so that's next
|
197
195
|
# 3. It is possible a filename can be a method name, but we
|
@@ -201,8 +199,8 @@ file_colon_line = file_no_colon:file &{ File.exist?(file) } ':' position:pos {
|
|
201
199
|
# without a position, else we would stop early before handling
|
202
200
|
# the position.
|
203
201
|
|
204
|
-
location =
|
205
|
-
position
|
202
|
+
location =
|
203
|
+
position
|
206
204
|
| <filename>:file &{ @file_exists_proc.call(file) } file_pos_sep position:pos {
|
207
205
|
Position.new(:file, file, pos.position_type, pos.position)
|
208
206
|
}
|