regexp_debugger 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +57 -0
- data/README +4 -0
- data/Rakefile +53 -0
- data/bin/regexp_debugger +10 -0
- data/lib/regexp_debugger.rb +92 -0
- metadata +83 -0
data/LICENSE
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
== regexp_debugger
|
2
|
+
|
3
|
+
You can redistribute it and/or modify it under either the terms of the GPL
|
4
|
+
version 2 (see the file GPL), or the conditions below:
|
5
|
+
|
6
|
+
1. You may make and give away verbatim copies of the source form of the
|
7
|
+
software without restriction, provided that you duplicate all of the
|
8
|
+
original copyright notices and associated disclaimers.
|
9
|
+
|
10
|
+
2. You may modify your copy of the software in any way, provided that
|
11
|
+
you do at least ONE of the following:
|
12
|
+
|
13
|
+
a) place your modifications in the Public Domain or otherwise
|
14
|
+
make them Freely Available, such as by posting said
|
15
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
16
|
+
the author to include your modifications in the software.
|
17
|
+
|
18
|
+
b) use the modified software only within your corporation or
|
19
|
+
organization.
|
20
|
+
|
21
|
+
c) give non-standard binaries non-standard names, with
|
22
|
+
instructions on where to get the original software distribution.
|
23
|
+
|
24
|
+
d) make other distribution arrangements with the author.
|
25
|
+
|
26
|
+
3. You may distribute the software in object code or binary form,
|
27
|
+
provided that you do at least ONE of the following:
|
28
|
+
|
29
|
+
a) distribute the binaries and library files of the software,
|
30
|
+
together with instructions (in the manual page or equivalent)
|
31
|
+
on where to get the original distribution.
|
32
|
+
|
33
|
+
b) accompany the distribution with the machine-readable source of
|
34
|
+
the software.
|
35
|
+
|
36
|
+
c) give non-standard binaries non-standard names, with
|
37
|
+
instructions on where to get the original software distribution.
|
38
|
+
|
39
|
+
d) make other distribution arrangements with the author.
|
40
|
+
|
41
|
+
4. You may modify and include the part of the software into any other
|
42
|
+
software (possibly commercial). But some files in the distribution
|
43
|
+
are not written by the author, so that they are not under these terms.
|
44
|
+
|
45
|
+
For the list of those files and their copying conditions, see the
|
46
|
+
file LEGAL.
|
47
|
+
|
48
|
+
5. The scripts and library files supplied as input to or produced as
|
49
|
+
output from the software do not automatically fall under the
|
50
|
+
copyright of the software, but belong to whomever generated them,
|
51
|
+
and may be sold commercially, and may be aggregated with this
|
52
|
+
software.
|
53
|
+
|
54
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
55
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
56
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
57
|
+
PURPOSE.
|
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#
|
2
|
+
# To change this template, choose Tools | Templates
|
3
|
+
# and open the template in the editor.
|
4
|
+
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'rake'
|
8
|
+
require 'rake/clean'
|
9
|
+
require 'rake/gempackagetask'
|
10
|
+
require 'rake/rdoctask'
|
11
|
+
require 'rake/testtask'
|
12
|
+
require 'spec/rake/spectask'
|
13
|
+
|
14
|
+
spec = Gem::Specification.new do |s|
|
15
|
+
s.name = 'regexp_debugger'
|
16
|
+
s.version = '0.0.1'
|
17
|
+
s.has_rdoc = true
|
18
|
+
s.homepage = "https://yuzhenpin-nemo.googlecode.com/svn/trunk/regexp_debugger"
|
19
|
+
s.extra_rdoc_files = ['README', 'LICENSE']
|
20
|
+
s.summary = 'a regexp debugger GUI'
|
21
|
+
s.description = s.summary
|
22
|
+
s.author = 'YuZhenpin'
|
23
|
+
s.email = 'yuzhenpin@126.com'
|
24
|
+
s.executables = ['regexp_debugger']
|
25
|
+
s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
|
26
|
+
s.require_path = "lib"
|
27
|
+
s.bindir = "bin"
|
28
|
+
s.add_dependency(%q<wxruby>, [">= 0"])
|
29
|
+
end
|
30
|
+
|
31
|
+
Rake::GemPackageTask.new(spec) do |p|
|
32
|
+
p.gem_spec = spec
|
33
|
+
p.need_tar = true
|
34
|
+
p.need_zip = true
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
files =['README', 'LICENSE', 'lib/**/*.rb']
|
39
|
+
rdoc.rdoc_files.add(files)
|
40
|
+
rdoc.main = "README" # page to start on
|
41
|
+
rdoc.title = "regexp_debugger Docs"
|
42
|
+
rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
|
43
|
+
rdoc.options << '--line-numbers'
|
44
|
+
end
|
45
|
+
|
46
|
+
Rake::TestTask.new do |t|
|
47
|
+
t.test_files = FileList['test/**/*.rb']
|
48
|
+
end
|
49
|
+
|
50
|
+
Spec::Rake::SpecTask.new do |t|
|
51
|
+
t.spec_files = FileList['spec/**/*.rb']
|
52
|
+
t.libs << Dir["lib"]
|
53
|
+
end
|
data/bin/regexp_debugger
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
require 'wx'
|
9
|
+
|
10
|
+
class RegexpDebuggerFrame < Wx::Frame
|
11
|
+
|
12
|
+
def initialize(title, pos, size, style = Wx::DEFAULT_FRAME_STYLE)
|
13
|
+
super(nil,-1,title,pos,size,style)
|
14
|
+
|
15
|
+
Wx::StaticText.new(self, -1, "/", Wx::Point.new(20, 0))
|
16
|
+
Wx::StaticText.new(self, -1, "/", Wx::Point.new(440, 0))
|
17
|
+
|
18
|
+
@reg = Wx::TextCtrl.new( self, -1, "",
|
19
|
+
Wx::Point.new(30,0), Wx::Size.new(400,-1))
|
20
|
+
|
21
|
+
@exp = Wx::TextCtrl.new( self, -1, "",
|
22
|
+
Wx::Point.new(450,0), Wx::Size.new(80,-1))
|
23
|
+
|
24
|
+
@txt = Wx::StyledTextCtrl.new( self, -1,
|
25
|
+
Wx::Point.new(30, 30), Wx::Size.new(500,300))
|
26
|
+
|
27
|
+
@btn = Wx::Button.new(
|
28
|
+
self,
|
29
|
+
Wx::ID_HIGHEST + 1,
|
30
|
+
" Test ",
|
31
|
+
Wx::Point.new(405, 340)
|
32
|
+
)
|
33
|
+
evt_button( Wx::ID_HIGHEST + 1) {|event| on_test(event)}
|
34
|
+
|
35
|
+
@out = []
|
36
|
+
9.times do |i|
|
37
|
+
|
38
|
+
Wx::StaticText.new(self, -1, "$#{i + 1}", Wx::Point.new(10,380 + 30 * i))
|
39
|
+
|
40
|
+
@out << Wx::TextCtrl.new( self, -1, "",
|
41
|
+
Wx::Point.new(30,380 + 30 * i), Wx::Size.new(500,-1))
|
42
|
+
end
|
43
|
+
|
44
|
+
create_status_bar(1, Wx::ST_SIZEGRIP)
|
45
|
+
set_status_text("Welcome to the Regexp Debugger!")
|
46
|
+
end
|
47
|
+
|
48
|
+
def on_test(event)
|
49
|
+
regexp = eval("/" + @reg.get_value + "/" + @exp.get_value)
|
50
|
+
|
51
|
+
match = @txt.get_text.match(regexp)
|
52
|
+
if match
|
53
|
+
set_status_text("match!")
|
54
|
+
@out.each_with_index {|out, index|
|
55
|
+
out.set_value(match[index + 1].to_s)
|
56
|
+
}
|
57
|
+
@btn.set_label(" test(match!) ")
|
58
|
+
@btn.set_background_colour(Wx::BLUE)
|
59
|
+
else
|
60
|
+
set_status_text("dismatch!!!")
|
61
|
+
@btn.set_label("test(dismatch!!!)")
|
62
|
+
@btn.set_background_colour(Wx::RED)
|
63
|
+
end
|
64
|
+
puts @btn.methods.sort
|
65
|
+
rescue Exception => excep
|
66
|
+
dlg = Wx::MessageDialog.new(
|
67
|
+
self,
|
68
|
+
excep.to_s,
|
69
|
+
'Find String Not Found in Demo File',
|
70
|
+
Wx::OK | Wx::ICON_ERROR
|
71
|
+
)
|
72
|
+
dlg.show_modal
|
73
|
+
dlg.destroy
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class RegexpDebuggerApp < Wx::App
|
78
|
+
def on_init
|
79
|
+
frame = RegexpDebuggerFrame.new(
|
80
|
+
"Regexp Debugger",
|
81
|
+
Wx::DEFAULT_POSITION,
|
82
|
+
Wx::Size.new(570, 750)
|
83
|
+
)
|
84
|
+
|
85
|
+
frame.show(true)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
if $0 == __FILE__
|
90
|
+
demo = RegexpDebuggerApp.new
|
91
|
+
demo.main_loop
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: regexp_debugger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- YuZhenpin
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-05-01 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: wxruby
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
description: a regexp debugger GUI
|
35
|
+
email: yuzhenpin@126.com
|
36
|
+
executables:
|
37
|
+
- regexp_debugger
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files:
|
41
|
+
- README
|
42
|
+
- LICENSE
|
43
|
+
files:
|
44
|
+
- LICENSE
|
45
|
+
- README
|
46
|
+
- Rakefile
|
47
|
+
- bin/regexp_debugger
|
48
|
+
- lib/regexp_debugger.rb
|
49
|
+
homepage: https://yuzhenpin-nemo.googlecode.com/svn/trunk/regexp_debugger
|
50
|
+
licenses: []
|
51
|
+
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.8.22
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: a regexp debugger GUI
|
82
|
+
test_files: []
|
83
|
+
|