reg 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,76 @@
1
+ =begin copyright
2
+ reg - the ruby extended grammar
3
+ Copyright (C) 2005 Caleb Clausen
4
+
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public
7
+ License as published by the Free Software Foundation; either
8
+ version 2.1 of the License, or (at your option) any later version.
9
+
10
+ This library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this library; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ =end
19
+
20
+ module Reg
21
+ class Variable
22
+ include Reg,Multiple
23
+
24
+ def set!(areg)
25
+ #huh 'something like this...'
26
+ @to=areg
27
+ class <<self
28
+ #(there's a library for this kind of stuff...)
29
+ (instance_methods - ::Object.instance_methods).each do |m|
30
+ undef_method m.to_sym
31
+ end
32
+ def respond_to? msg
33
+ @to.respond_to? msg or super
34
+ end
35
+
36
+ def methods
37
+ @to.methods + super
38
+ end
39
+
40
+ def method_missing msg, *args, &block
41
+ @to.send msg, *args, &block
42
+ end
43
+ end
44
+ self
45
+ end
46
+ end
47
+
48
+ class Constant < Variable
49
+ def set!(areg)
50
+ super
51
+ class <<self
52
+ def set!
53
+ raise 'constant can only be set once'
54
+ end
55
+ end
56
+ freeze
57
+ self
58
+ end
59
+ end
60
+
61
+ class <<self
62
+ #Reg::Variable convenience constructor.
63
+ def variable
64
+ ::Reg::Variable.new
65
+ end
66
+ alias var variable
67
+
68
+ #Reg::Constant convenience constructor.
69
+ def constant
70
+ ::Reg::Constant.new
71
+ end
72
+ alias const constant
73
+ end
74
+
75
+
76
+ end
@@ -0,0 +1,45 @@
1
+ =begin copyright
2
+ reg - the ruby extended grammar
3
+ Copyright (C) 2005 Caleb Clausen
4
+
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public
7
+ License as published by the Free Software Foundation; either
8
+ version 2.1 of the License, or (at your option) any later version.
9
+
10
+ This library is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this library; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+ =end
19
+
20
+
21
+ module Kernel
22
+ private
23
+ def trace(traces)
24
+ if Proc===traces
25
+ handler=traces
26
+ traces=nil
27
+ else
28
+ handler=proc { |*stuff|
29
+ traces<<[stuff<<Thread.current] unless
30
+ %r'[/\\:]trace\.rb$'===file
31
+ }
32
+ end
33
+
34
+ #what does it return? inquiring minds want to know -- just the proc it was given!
35
+ set_trace_func handler
36
+ #there's no appearent way to get the previous trace handler... phooey
37
+ begin
38
+ result=yield
39
+ ensure
40
+ #attempt to remain debuggable while restoring the old trace func
41
+ set_trace_func((defined? DEBUGGER__ and (DEBUGGER__.context.method:trace_func).to_proc))
42
+ end
43
+ result
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: reg
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.4.6
7
+ date: 2005-11-18 00:00:00 -08:00
8
+ summary: The reg pattern matching/replacement language
9
+ require_paths:
10
+ - "."
11
+ email:
12
+ homepage:
13
+ rubyforge_project: reg
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ -
22
+ - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: ruby
27
+ signing_key:
28
+ cert_chain:
29
+ authors:
30
+ - Caleb Clausen
31
+ files:
32
+ - item_thattest.rb
33
+ - regbackref.rb
34
+ - regknows.rb
35
+ - regtest.rb
36
+ - numberset.rb
37
+ - regbind.rb
38
+ - reglogic.rb
39
+ - regvar.rb
40
+ - COPYING
41
+ - parser.txt
42
+ - regcase.rb
43
+ - reglookab.rb
44
+ - README
45
+ - regcore.rb
46
+ - regold.rb
47
+ - reg.gemspec
48
+ - reggrid.csv
49
+ - assert.rb
50
+ - philosophy.txt
51
+ - regdeferred.rb
52
+ - regpath.rb
53
+ - regposition.rb
54
+ - trace.rb
55
+ - calc.reg
56
+ - reg.rb
57
+ - regguide.txt
58
+ - regprogress.rb
59
+ - reghash.rb
60
+ - regreplace.rb
61
+ - forward_to.rb
62
+ - regarray.rb
63
+ - regarrayold.rb
64
+ - regitem_that.rb
65
+ - regsugar.rb
66
+ test_files: []
67
+ rdoc_options: []
68
+ extra_rdoc_files: []
69
+ executables: []
70
+ extensions: []
71
+ requirements:
72
+ - none
73
+ dependencies:
74
+ - !ruby/object:Gem::Dependency
75
+ name: cursor
76
+ version_requirement:
77
+ version_requirements: !ruby/object:Gem::Version::Requirement
78
+ requirements:
79
+ -
80
+ - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "0.9"
83
+ version: