rubylexer 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/History.txt +55 -0
  2. data/Manifest.txt +67 -0
  3. data/README.txt +103 -0
  4. data/Rakefile +24 -0
  5. data/howtouse.txt +9 -6
  6. data/{assert.rb → lib/assert.rb} +11 -11
  7. data/{rubylexer.rb → lib/rubylexer.rb} +645 -342
  8. data/lib/rubylexer/0.6.2.rb +39 -0
  9. data/lib/rubylexer/0.6.rb +5 -0
  10. data/lib/rubylexer/0.7.0.rb +2 -0
  11. data/{charhandler.rb → lib/rubylexer/charhandler.rb} +4 -2
  12. data/{charset.rb → lib/rubylexer/charset.rb} +4 -3
  13. data/{context.rb → lib/rubylexer/context.rb} +48 -18
  14. data/{rubycode.rb → lib/rubylexer/rubycode.rb} +5 -3
  15. data/{rulexer.rb → lib/rubylexer/rulexer.rb} +180 -102
  16. data/{symboltable.rb → lib/rubylexer/symboltable.rb} +10 -1
  17. data/{token.rb → lib/rubylexer/token.rb} +72 -20
  18. data/{tokenprinter.rb → lib/rubylexer/tokenprinter.rb} +39 -16
  19. data/lib/rubylexer/version.rb +3 -0
  20. data/{testcode → test/code}/deletewarns.rb +0 -0
  21. data/test/code/dl_all_gems.rb +43 -0
  22. data/{testcode → test/code}/dumptokens.rb +12 -9
  23. data/test/code/locatetest +30 -0
  24. data/test/code/locatetest.rb +49 -0
  25. data/test/code/rubylexervsruby.rb +173 -0
  26. data/{testcode → test/code}/tokentest.rb +62 -51
  27. data/{testcode → test/code}/torment +8 -8
  28. data/test/code/unpack_all_gems.rb +15 -0
  29. data/{testdata → test/data}/1.rb.broken +0 -0
  30. data/{testdata → test/data}/23.rb +0 -0
  31. data/test/data/__end__.rb +2 -0
  32. data/test/data/__end__2.rb +3 -0
  33. data/test/data/and.rb +5 -0
  34. data/test/data/blockassigntest.rb +23 -0
  35. data/test/data/chunky.plain.rb +75 -0
  36. data/test/data/chunky_bacon.rb +112 -0
  37. data/test/data/chunky_bacon2.rb +112 -0
  38. data/test/data/chunky_bacon3.rb +112 -0
  39. data/test/data/chunky_bacon4.rb +112 -0
  40. data/test/data/for.rb +45 -0
  41. data/test/data/format.rb +6 -0
  42. data/{testdata → test/data}/g.rb +0 -0
  43. data/test/data/gemlist.txt +280 -0
  44. data/test/data/heart.rb +7 -0
  45. data/test/data/if.rb +6 -0
  46. data/test/data/jarh.rb +369 -0
  47. data/test/data/lbrace.rb +4 -0
  48. data/test/data/lbrack.rb +4 -0
  49. data/{testdata → test/data}/newsyntax.rb +0 -0
  50. data/{testdata → test/data}/noeolatend.rb +0 -0
  51. data/test/data/p-op.rb +8 -0
  52. data/{testdata → test/data}/p.rb +671 -79
  53. data/{testdata → test/data}/pleac.rb.broken +0 -0
  54. data/{testdata → test/data}/pre.rb +0 -0
  55. data/{testdata → test/data}/pre.unix.rb +0 -0
  56. data/{testdata → test/data}/regtest.rb +0 -0
  57. data/test/data/rescue.rb +35 -0
  58. data/test/data/s.rb +186 -0
  59. data/test/data/strinc.rb +2 -0
  60. data/{testdata → test/data}/tokentest.assert.rb.can +0 -0
  61. data/test/data/untermed_here.rb.broken +2 -0
  62. data/test/data/untermed_string.rb.broken +1 -0
  63. data/{testdata → test/data}/untitled1.rb +0 -0
  64. data/{testdata → test/data}/w.rb +0 -0
  65. data/{testdata → test/data}/wsdlDriver.rb +0 -0
  66. data/testing.txt +6 -4
  67. metadata +163 -59
  68. data/README +0 -134
  69. data/Rantfile +0 -37
  70. data/io.each_til_charset.rb +0 -247
  71. data/require.rb +0 -103
  72. data/rlold.rb +0 -12
  73. data/testcode/locatetest +0 -12
  74. data/testcode/rubylexervsruby.rb +0 -104
  75. data/testcode/rubylexervsruby.sh +0 -51
  76. data/testresults/placeholder +0 -0
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,35 @@
1
+ begin
2
+ 1 rescue 2
3
+ rescue; 2
4
+ end
5
+
6
+ def foo
7
+
8
+ 1 rescue 2
9
+ rescue; 2
10
+
11
+ end
12
+
13
+
14
+ class Foo
15
+
16
+ 1 rescue 2
17
+ rescue; 2
18
+
19
+ end
20
+
21
+
22
+ module Moo
23
+
24
+ 1 rescue 2
25
+ rescue; 2
26
+
27
+ end
28
+
29
+
30
+ class <<Foo
31
+
32
+ 1 rescue 2
33
+ rescue; 2
34
+
35
+ end
data/test/data/s.rb ADDED
@@ -0,0 +1,186 @@
1
+ #string content tokens move around in this file; its not really a problem
2
+
3
+ if false
4
+ t=0
5
+ t ?'t':0
6
+ "#{t ?'t':0}"
7
+
8
+ e.hour %= 12; ( downcase == 'p')
9
+ e.hour %= 12; begin downcase == 'p'; end
10
+ e.hour %= 12; if downcase == 'p'; end
11
+ e.hour %= 12; (downcase)
12
+ e.hour %= 12; if downcase; end
13
+
14
+ proc do <<EOD
15
+ [#{dqname}]
16
+ EOD
17
+ end
18
+
19
+ proc do <<-EOD
20
+ [#{dqname}]
21
+ EOD
22
+ end
23
+
24
+ proc do|x| <<-EOD
25
+ [#{dqname}]
26
+ EOD
27
+ end
28
+
29
+ proc do|| <<-EOD
30
+ [#{dqname}]
31
+ EOD
32
+ end
33
+
34
+ proc { <<-EOD
35
+ [#{dqname}]
36
+ EOD
37
+ }
38
+
39
+ proc {|x| <<-EOD
40
+ [#{dqname}]
41
+ EOD
42
+ }
43
+
44
+ p <<-EOD
45
+ [#{dqname}]
46
+ EOD
47
+
48
+
49
+
50
+
51
+ proc do "
52
+ [#{dqname}]
53
+ "
54
+ end
55
+
56
+ proc do `
57
+ [#{dqname}]
58
+ `
59
+ end
60
+
61
+ proc do /
62
+ [#{dqname}]
63
+ /
64
+ end
65
+
66
+ proc do '
67
+ [#{dqname}]
68
+ '
69
+ end
70
+
71
+ proc do %Q{
72
+ [#{dqname}]
73
+ }
74
+ end
75
+
76
+ proc do %{
77
+ [#{dqname}]
78
+ }
79
+ end
80
+
81
+ end
82
+
83
+ def SelfReferencing
84
+ #old name alias
85
+ end
86
+
87
+ def SelfReferencing #old name alias
88
+ end
89
+
90
+ def SelfReferencing#old name alias
91
+ end
92
+
93
+ def SelfReferencing;end#old name alias
94
+
95
+ p ?a
96
+ p :a
97
+ p :@a
98
+ p :@@a
99
+ p :$a
100
+ p :A
101
+ p :+
102
+ p :`#`
103
+ p ? p : 0
104
+
105
+ if false
106
+ O=0
107
+ false ? 2:O
108
+ false ? 2: O
109
+ false ? 2 :O
110
+ false ? 2 : O
111
+
112
+ eof??n
113
+ eof? ?n
114
+
115
+ eof??nil:true
116
+ eof? ?nil:true
117
+ eof?? nil:true
118
+ eof? ? nil:true
119
+
120
+ eof??nil:true
121
+ eof??nil :true
122
+ eof??nil: true
123
+ eof??nil : true
124
+
125
+ eof!?nil:true
126
+ eof! ?nil:true
127
+ eof!? nil:true
128
+ eof! ? nil:true
129
+
130
+ eof!?nil:true
131
+ eof!?nil :true
132
+ eof!?nil: true
133
+ eof!?nil : true
134
+
135
+ end
136
+
137
+ p <<'FOO'.gsub(" ","\n")
138
+ BAR#{BAZ}
139
+ FOO
140
+
141
+ p "\
142
+ #{foo}"
143
+
144
+ p <<end
145
+ #{compile_body}\
146
+ #{outvar}
147
+ end
148
+
149
+
150
+
151
+
152
+ p "#{<<foobar3}"
153
+ bim
154
+ baz
155
+ bof
156
+ foobar3
157
+
158
+ p "#{<<foobar2
159
+ bim
160
+ baz
161
+ bof
162
+ foobar2
163
+ }"
164
+
165
+
166
+ p <<one ; p "#{<<two}"
167
+ 1111111111111111
168
+ fdsgdfgdsfffff
169
+ one
170
+ 2222222222222222
171
+ sdfasdfasdfads
172
+ two
173
+
174
+ p "#{<<foobar1.each('|'){|s| '\nthort: '+s}
175
+ jbvd|g4543ghb|!@G$dfsd|fafr|e
176
+ |s4e5rrwware|BBBBB|*&^(*&^>"PMK:njs;d|
177
+
178
+ foobar1
179
+ }"
180
+
181
+
182
+ p <<""
183
+ foo
184
+
185
+
186
+ bar
@@ -0,0 +1,2 @@
1
+ "fooo#{33}fsfd"
2
+
File without changes
@@ -0,0 +1,2 @@
1
+ <<here
2
+ blah, blah blah
@@ -0,0 +1 @@
1
+ "blah, blah
File without changes
File without changes
File without changes
data/testing.txt CHANGED
@@ -1,8 +1,10 @@
1
1
 
2
2
  Running the tests:
3
- the simplest thing to do is run testcode/locatetest. this will use locate to find as much ruby
4
- code on your system and test each specimen to see if it can be tokenized correctly (by feeding it
5
- to testcode/rubylexervsruby.rb, the operation of which is outlined below under 'testing strategy').
3
+ the simplest thing to do is run "ruby -Ilib test/code/locatetest.rb".
4
+ this will use locate to find as much ruby code on your system and test
5
+ each specimen to see if it can be tokenized correctly (by feeding it to
6
+ testcode/rubylexervsruby.rb, the operation of which is outlined below
7
+ under 'testing strategy').
6
8
 
7
9
  Interpreting the output of rubylexervsruby.rb (and locatetest):
8
10
  in rubylexervsruby, i've tried to follow the philosophy that the test program
@@ -127,4 +129,4 @@ thinks should be 2 tokens. and in fact, this is the case with strings: ruby divi
127
129
  string into string open, string body, and string close tokens with option interpolations,
128
130
  whereas rubylexer has just a single string token (with subtokens, if interpolations are
129
131
  present.) this difference in handling accounts in part for rubylexer's inability
130
- to correctly lex certain very complicated strings.
132
+ to correctly lex certain very complicated strings.
metadata CHANGED
@@ -1,76 +1,180 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.10
2
+ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rubylexer
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.6.2
7
- date: 2005-06-03
8
- summary: lexer of ruby in ruby
6
+ version: 0.7.0
7
+ date: 2008-02-17 00:00:00 +00:00
8
+ summary: RubyLexer is a lexer library for Ruby, written in Ruby.
9
9
  require_paths:
10
- - "."
11
- email:
12
- homepage:
10
+ - lib
11
+ email: rubylexer-owner @at@ inforadical .dot. net
12
+ homepage: http://rubylexer.rubyforge.org/
13
13
  rubyforge_project: rubylexer
14
- description:
14
+ description: RubyLexer is a lexer library for Ruby, written in Ruby. Rubylexer is meant as a lexer for Ruby that's complete and correct; all legal Ruby code should be lexed correctly by RubyLexer as well. Just enough parsing capability is included to give RubyLexer enough context to tokenize correctly in all cases. (This turned out to be more parsing than I had thought or wanted to take on at first.) RubyLexer handles the hard things like complicated strings, the ambiguous nature of some punctuation characters and keywords in ruby, and distinguishing methods and local variables.
15
15
  autorequire:
16
16
  default_executable:
17
- bindir: bin
18
- has_rdoc: false
17
+ bindir: ""
18
+ has_rdoc: true
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
- -
22
- - ">"
23
- - !ruby/object:Gem::Version
24
- version: 0.0.0
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
25
24
  version:
26
25
  platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
27
29
  authors:
28
- - Caleb Clausen
30
+ - Caleb Clausen
29
31
  files:
30
- - rubylexer.rb
31
- - assert.rb
32
- - context.rb
33
- - rlold.rb
34
- - rulexer.rb
35
- - tokenprinter.rb
36
- - charhandler.rb
37
- - io.each_til_charset.rb
38
- - rubycode.rb
39
- - symboltable.rb
40
- - charset.rb
41
- - require.rb
42
- - token.rb
43
- - COPYING
44
- - README
45
- - Rantfile
46
- - howtouse.txt
47
- - testing.txt
48
- - testresults/placeholder
49
- - testcode/deletewarns.rb
50
- - testcode/dumptokens.rb
51
- - testcode/locatetest
52
- - testcode/rubylexervsruby.rb
53
- - testcode/rubylexervsruby.sh
54
- - testcode/tokentest.rb
55
- - testcode/torment
56
- - testdata/1.rb.broken
57
- - testdata/23.rb
58
- - testdata/g.rb
59
- - testdata/newsyntax.rb
60
- - testdata/noeolatend.rb
61
- - testdata/p.rb
62
- - testdata/pleac.rb.broken
63
- - testdata/pre.rb
64
- - testdata/pre.unix.rb
65
- - testdata/regtest.rb
66
- - testdata/tokentest.assert.rb.can
67
- - testdata/untitled1.rb
68
- - testdata/w.rb
69
- - testdata/wsdlDriver.rb
70
- test_files: []
71
- rdoc_options: []
72
- extra_rdoc_files: []
32
+ - COPYING
33
+ - README.txt
34
+ - Manifest.txt
35
+ - Rakefile
36
+ - howtouse.txt
37
+ - History.txt
38
+ - testing.txt
39
+ - lib/rubylexer/rubycode.rb
40
+ - lib/rubylexer/context.rb
41
+ - lib/rubylexer/token.rb
42
+ - lib/rubylexer/0.6.rb
43
+ - lib/rubylexer/0.6.2.rb
44
+ - lib/rubylexer/0.7.0.rb
45
+ - lib/rubylexer/version.rb
46
+ - lib/rubylexer/rulexer.rb
47
+ - lib/rubylexer/tokenprinter.rb
48
+ - lib/rubylexer/charset.rb
49
+ - lib/rubylexer/symboltable.rb
50
+ - lib/rubylexer/charhandler.rb
51
+ - lib/assert.rb
52
+ - lib/rubylexer.rb
53
+ - test/data/gemlist.txt
54
+ - test/data/blockassigntest.rb
55
+ - test/data/for.rb
56
+ - test/data/chunky_bacon.rb
57
+ - test/data/and.rb
58
+ - test/data/pre.unix.rb
59
+ - test/data/untermed_string.rb.broken
60
+ - test/data/__end__2.rb
61
+ - test/data/w.rb
62
+ - test/data/if.rb
63
+ - test/data/pre.rb
64
+ - test/data/jarh.rb
65
+ - test/data/regtest.rb
66
+ - test/data/chunky_bacon4.rb
67
+ - test/data/__end__.rb
68
+ - test/data/strinc.rb
69
+ - test/data/lbrace.rb
70
+ - test/data/p.rb
71
+ - test/data/chunky.plain.rb
72
+ - test/data/noeolatend.rb
73
+ - test/data/g.rb
74
+ - test/data/23.rb
75
+ - test/data/lbrack.rb
76
+ - test/data/untitled1.rb
77
+ - test/data/rescue.rb
78
+ - test/data/tokentest.assert.rb.can
79
+ - test/data/pleac.rb.broken
80
+ - test/data/heart.rb
81
+ - test/data/s.rb
82
+ - test/data/wsdlDriver.rb
83
+ - test/data/p-op.rb
84
+ - test/data/1.rb.broken
85
+ - test/data/untermed_here.rb.broken
86
+ - test/data/newsyntax.rb
87
+ - test/data/chunky_bacon3.rb
88
+ - test/data/chunky_bacon2.rb
89
+ - test/data/format.rb
90
+ - test/code/locatetest.rb
91
+ - test/code/rubylexervsruby.rb
92
+ - test/code/dl_all_gems.rb
93
+ - test/code/unpack_all_gems.rb
94
+ - test/code/tokentest.rb
95
+ - test/code/dumptokens.rb
96
+ - test/code/torment
97
+ - test/code/locatetest
98
+ - test/code/deletewarns.rb
99
+ test_files:
100
+ - test/code/locatetest.rb
101
+ - test/code/rubylexervsruby.rb
102
+ - test/code/dl_all_gems.rb
103
+ - test/code/unpack_all_gems.rb
104
+ - test/code/tokentest.rb
105
+ - test/code/dumptokens.rb
106
+ - test/code/torment
107
+ - test/code/locatetest
108
+ - test/code/deletewarns.rb
109
+ - test/data/blockassigntest.rb
110
+ - test/data/for.rb
111
+ - test/data/chunky_bacon.rb
112
+ - test/data/and.rb
113
+ - test/data/pre.unix.rb
114
+ - test/data/untermed_string.rb.broken
115
+ - test/data/__end__2.rb
116
+ - test/data/w.rb
117
+ - test/data/if.rb
118
+ - test/data/pre.rb
119
+ - test/data/jarh.rb
120
+ - test/data/regtest.rb
121
+ - test/data/chunky_bacon4.rb
122
+ - test/data/__end__.rb
123
+ - test/data/strinc.rb
124
+ - test/data/lbrace.rb
125
+ - test/data/p.rb
126
+ - test/data/chunky.plain.rb
127
+ - test/data/noeolatend.rb
128
+ - test/data/g.rb
129
+ - test/data/23.rb
130
+ - test/data/lbrack.rb
131
+ - test/data/untitled1.rb
132
+ - test/data/rescue.rb
133
+ - test/data/tokentest.assert.rb.can
134
+ - test/data/pleac.rb.broken
135
+ - test/data/heart.rb
136
+ - test/data/s.rb
137
+ - test/data/wsdlDriver.rb
138
+ - test/data/p-op.rb
139
+ - test/data/1.rb.broken
140
+ - test/data/untermed_here.rb.broken
141
+ - test/data/newsyntax.rb
142
+ - test/data/chunky_bacon3.rb
143
+ - test/data/chunky_bacon2.rb
144
+ - test/data/format.rb
145
+ - test/results/
146
+ rdoc_options:
147
+ - --main
148
+ - README.txt
149
+ extra_rdoc_files:
150
+ - README.txt
151
+ - Manifest.txt
152
+ - howtouse.txt
153
+ - History.txt
154
+ - testing.txt
155
+ - test/data/gemlist.txt
73
156
  executables: []
157
+
74
158
  extensions: []
159
+
75
160
  requirements: []
76
- dependencies: []
161
+
162
+ dependencies:
163
+ - !ruby/object:Gem::Dependency
164
+ name: sequence
165
+ version_requirement:
166
+ version_requirements: !ruby/object:Gem::Version::Requirement
167
+ requirements:
168
+ - - ">"
169
+ - !ruby/object:Gem::Version
170
+ version: 0.0.0
171
+ version:
172
+ - !ruby/object:Gem::Dependency
173
+ name: hoe
174
+ version_requirement:
175
+ version_requirements: !ruby/object:Gem::Version::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: 1.5.0
180
+ version: