sequence 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/COPYING CHANGED
File without changes
data/GPL CHANGED
File without changes
@@ -1,10 +1,18 @@
1
- === 0.2.2 / 2009-08-05
1
+ === 0.2.3 / 21dec2009
2
+ * 3 Minor Bugfixes:
3
+ * use Array#join instead of Array#to_s for 1.9 compatibility
4
+ * set thread's last_match in #index and #rindex
5
+ * set last_match to nil on #match or #matchback failure
6
+ * 1 Minor Enhancements:
7
+ * reworked build scripts slightly
8
+
9
+ === 0.2.2 / 5aug2009
2
10
  * 3 Minor Enhancements:
3
11
  * mostly works in ruby 1.9, but still some bizarre unit test failures
4
12
  * should now work in windows without a problem
5
13
  * replaced (no longer working) Hoe/Rakefile with Makefile/gemspec
6
14
 
7
- === 0.2.1 / 2009-01-07
15
+ === 0.2.1 / 7jan2009
8
16
  * 1 Minor Enhancement:
9
17
  * WeakRefSet now conforms to Set's api and tests more closely.
10
18
 
@@ -12,7 +20,7 @@
12
20
  * fixed errors in MatchData when matching against a Regexp with an
13
21
  optional capture that didn't capture anything .
14
22
 
15
- === 0.2.0 / 2008-08-28
23
+ === 0.2.0 / 28aug2008
16
24
 
17
25
  * 2 Major Enhancements:
18
26
  * all tests now pass
@@ -24,7 +32,7 @@
24
32
  * more List test data created by wrapping existing data in List(s)
25
33
  * enabled some tests which had been failing
26
34
 
27
- === 0.1.0 / 2006-10-05
35
+ === 0.1.0 / 5oct2006
28
36
 
29
37
  * 1 major enhancement
30
38
 
data/Makefile CHANGED
@@ -1,3 +1,12 @@
1
+ name=Sequence
2
+ lname=sequence
3
+ gemname=sequence
4
+
5
+ #everything after this line is generic
6
+
7
+ version=$(shell ruby -r ./lib/$(lname)/version.rb -e "puts $(name)::VERSION")
8
+ filelist=$(shell git ls-files)
9
+
1
10
  .PHONY: all test docs gem tar pkg email
2
11
  all: test
3
12
 
@@ -10,23 +19,25 @@ docs:
10
19
  pkg: gem tar
11
20
 
12
21
  gem:
13
- gem build sequence.gemspec
22
+ gem build $(lname).gemspec
14
23
 
15
24
  tar:
16
- tar czf sequence-`ruby -r ./lib/sequence/version.rb -e 'puts Sequence::VERSION'`.tar.gz `git ls-files`
25
+ tar cf - $(filelist) | ( mkdir $(gemname)-$(version); cd $(gemname)-$(version); tar xf - )
26
+ tar czf $(gemname)-$(version).tar.gz $(gemname)-$(version)
27
+ rm -rf $(gemname)-$(version)
17
28
 
18
29
  email: README.txt History.txt
19
30
  ruby -e ' \
20
31
  require "rubygems"; \
21
- load "./sequence.gemspec"; \
22
- spec= Gem::Specification.list.find{|x| x.name=="sequence"}; \
32
+ load "./$(lname).gemspec"; \
33
+ spec= Gem::Specification.list.find{|x| x.name=="$(gemname)"}; \
23
34
  puts "\
24
- Subject: [ANN] Sequence #{spec.version} Released \
25
- \n\nSequence version #{spec.version} has been released! \n\n\
35
+ Subject: [ANN] $(name) #{spec.version} Released \
36
+ \n\n$(name) version #{spec.version} has been released! \n\n\
26
37
  #{Array(spec.homepage).map{|url| " * #{url}\n" }} \
27
38
  \n\
28
- #{Sequence::Description} \
39
+ #{$(name)::Description} \
29
40
  \n\nChanges:\n\n \
30
- #{Sequence::Latest_changes} \
41
+ #{$(name)::Latest_changes} \
31
42
  "\
32
43
  '
@@ -64,7 +64,7 @@ class Sequence
64
64
  end
65
65
  blocks<<block
66
66
  end
67
- return blocks.to_s
67
+ return blocks.join
68
68
  end
69
69
 
70
70
 
@@ -101,8 +101,11 @@ class Sequence
101
101
  matchdata=match_fast(newrex,true,len)
102
102
  #fail if any ^ or \A matched at begin of buffer,
103
103
  #but buffer isn't begin of file
104
- return if !matchdata or #not actually a match
104
+ if !matchdata or #not actually a match
105
105
  addedgroups.find{|i| matchdata.end(i)==0 } && !nearbegin
106
+ self.last_match=Thread.current[:last_match]=nil
107
+ return
108
+ end
106
109
 
107
110
  matchpos=pos-len
108
111
  matchpos>=0 or matchpos=0
@@ -129,9 +132,12 @@ class Sequence
129
132
  newrex=nearend(len)? rex : group_anchors(rex,false,false).first
130
133
 
131
134
  #do the match against what input we have
132
- matchdata=match_fast(newrex,false,len) or return
135
+ matchdata=match_fast(newrex,false,len)
133
136
 
134
- anchored and matchdata.begin(0).nonzero? and return
137
+ if !matchdata or anchored && matchdata.begin(0).nonzero?
138
+ self.last_match=Thread.current[:last_match]=nil
139
+ return
140
+ end
135
141
  posi=position;posi.move matchdata.end(0)
136
142
  result=fixup_match_result(matchdata,[],pos,:post) { posi.subseq(posi.pos..-1) }
137
143
  #note: post_match is a SubSeq
@@ -426,7 +432,7 @@ class Sequence
426
432
  range=0...m.begin(0)
427
433
  pre=subseq(range)
428
434
  m.set_pre_match_body { pre }
429
- self.last_match=m
435
+ self.last_match=Thread.current[:last_match]=m
430
436
  return m.begin(0) #return match and what preceded it
431
437
  end
432
438
  posi.move until_step_len
@@ -459,7 +465,7 @@ class Sequence
459
465
  range=m.end(0)+1..-1
460
466
  post=subseq(range)
461
467
  m.set_post_match_body { post }
462
- self.last_match=m
468
+ self.last_match=Thread.current[:last_match]=m
463
469
  posi.close
464
470
  return m.begin(0) #return match and what preceded it
465
471
  end
@@ -1,5 +1,5 @@
1
1
  # Copyright (C) 2006,2008 Caleb Clausen
2
2
  # Distributed under the terms of Ruby's license.
3
3
  class Sequence
4
- VERSION='0.2.2'
4
+ VERSION='0.2.3'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require './lib/sequence/version'
3
+ require "#{File.dirname(__FILE__)}/lib/sequence/version"
4
4
  Sequence::Description=open("README.txt"){|f| f.read[/^==+ ?description[^\n]*?\n *\n?(.*?\n *\n.*?)\n *\n/im,1] }
5
5
  Sequence::Latest_changes="###"+open("History.txt"){|f| f.read[/\A===(.*?)(?====)/m,1] }
6
6
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.files = `git ls-files`.split
17
17
  s.has_rdoc = true
18
18
  s.homepage = %{http://github.com/coatl/sequence}
19
- s.rdoc_options = %w[--inline-source --main README.txt]
19
+ s.rdoc_options = %w[--main README.txt]
20
20
  s.require_paths = ["lib"]
21
21
  s.rubyforge_project = %q{sequence}
22
22
  s.rubygems_version = %q{1.3.0}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Caleb Clausen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-05 00:00:00 -07:00
12
+ date: 2010-01-03 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -30,7 +30,6 @@ files:
30
30
  - Makefile
31
31
  - Manifest.txt
32
32
  - README.txt
33
- - Rakefile
34
33
  - lib/assert.rb
35
34
  - lib/sequence.rb
36
35
  - lib/sequence/arraylike.rb
@@ -67,7 +66,6 @@ has_rdoc: true
67
66
  homepage: http://github.com/coatl/sequence
68
67
  post_install_message:
69
68
  rdoc_options:
70
- - --inline-source
71
69
  - --main
72
70
  - README.txt
73
71
  require_paths:
data/Rakefile DELETED
@@ -1,41 +0,0 @@
1
- # Copyright (C) 2006 Caleb Clausen
2
- # Distributed under the terms of Ruby's license.
3
- require 'rubygems'
4
- require 'hoe'
5
- require './lib/sequence/version.rb'
6
- require 'test/unit'
7
-
8
- if $*==["test"]
9
- gem 'test-unit'
10
- require 'test/unit'
11
- #hack to get 'rake test' to stay in one process
12
- #which keeps netbeans happy
13
- $:<<"lib"
14
- require "./test/test_all.rb"
15
- Test::Unit::AutoRunner.run
16
- exit
17
- end
18
-
19
- Hoe.new("sequence", Sequence::VERSION) do |_|
20
-
21
- _.author = "Caleb Clausen"
22
- _.email = "sequence-owner @at@ inforadical .dot. net"
23
- _.url = [ "http://sequence.rubyforge.org/", "http://rubyforge.org/projects/sequence"]
24
- _.summary = "A single api for reading and writing sequential data types."
25
- _.description = <<-END
26
- A unified wrapper api for accessing data in Strings, Arrays, Files, IOs,
27
- and Enumerations. Each sequence encapsulates some data and a current position
28
- within it. There are methods for moving the position, reading and writing data
29
- (with or without moving the position) forward or backward from the current
30
- position (or anywhere at all), scanning for patterns (like StringScanner, but
31
- it works in Files too, among others), and saving a position that will remain
32
- valid even after data is deleted or inserted elsewhere within the sequence.
33
-
34
- There are also some utility classes for making sequences reversed or
35
- circular, turning one-way sequences into two-way, buffering, and making
36
- sequences that are subsets or aggregations of existing sequences.
37
- END
38
- end
39
-
40
- # add other tasks here
41
-