nexus_parser 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/nexus_parser.rb +0 -2
- data/lib/parser.rb +3 -1
- data/lib/tokens.rb +5 -0
- data/nexus_parser.gemspec +4 -5
- data/test/test_nexus_parser.rb +9 -0
- metadata +10 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.4
|
data/lib/nexus_parser.rb
CHANGED
data/lib/parser.rb
CHANGED
@@ -127,7 +127,8 @@ class NexusParser::Parser
|
|
127
127
|
break
|
128
128
|
else
|
129
129
|
@lexer.pop(NexusParser::Tokens::Title) if @lexer.peek(NexusParser::Tokens::Title) # not used at present
|
130
|
-
|
130
|
+
@lexer.pop(NexusParser::Tokens::LinkLine) if @lexer.peek(NexusParser::Tokens::LinkLine) # trashing these for now
|
131
|
+
|
131
132
|
parse_dimensions if @lexer.peek(NexusParser::Tokens::Dimensions)
|
132
133
|
parse_format if @lexer.peek(NexusParser::Tokens::Format)
|
133
134
|
|
@@ -137,6 +138,7 @@ class NexusParser::Parser
|
|
137
138
|
|
138
139
|
# handle "\s*OPTIONS MSTAXA = UNCERTAIN;\s\n" within a characters block (sticks in an infinite loop right now)
|
139
140
|
|
141
|
+
|
140
142
|
@lexer.pop(NexusParser::Tokens::MesquiteIDs) if @lexer.peek(NexusParser::Tokens::MesquiteIDs) # trashing these for now
|
141
143
|
@lexer.pop(NexusParser::Tokens::MesquiteBlockID) if @lexer.peek(NexusParser::Tokens::MesquiteBlockID) # trashing these for now
|
142
144
|
|
data/lib/tokens.rb
CHANGED
@@ -87,6 +87,10 @@ module NexusParser::Tokens
|
|
87
87
|
@regexp = Regexp.new(/\A\s*(characters\s*;)\s*/i)
|
88
88
|
end
|
89
89
|
|
90
|
+
class LinkLine < Token
|
91
|
+
@regexp = Regexp.new(/\A\s*(link.*\s*;)\s*\n*/i)
|
92
|
+
end
|
93
|
+
|
90
94
|
# note we grab EOL and ; here
|
91
95
|
class ValuePair < Token
|
92
96
|
@regexp = Regexp.new(/\A\s*([\w\d\_\&]+\s*=\s*((\'[^\']+\')|(\(.*\))|(\"[^\"]+\")|([^\s\n\t;]+)))[\s\n\t;]+/i) # returns key => value hash for tokens like 'foo=bar' or foo = 'b a ar'
|
@@ -261,6 +265,7 @@ module NexusParser::Tokens
|
|
261
265
|
NexusParser::Tokens::RBracket,
|
262
266
|
NexusParser::Tokens::Label, # must be before RowVec
|
263
267
|
NexusParser::Tokens::RowVec,
|
268
|
+
NexusParser::Tokens::LinkLine,
|
264
269
|
NexusParser::Tokens::ID # need to trash this
|
265
270
|
]
|
266
271
|
end
|
data/nexus_parser.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{nexus_parser}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["mjy"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-04-12}
|
13
13
|
s.description = %q{A full featured and extensible Nexus file parser in Ruby. }
|
14
14
|
s.email = %q{diapriid@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -42,17 +42,16 @@ Gem::Specification.new do |s|
|
|
42
42
|
s.homepage = %q{http://github.com/mjy/nexus_parser}
|
43
43
|
s.rdoc_options = ["--charset=UTF-8"]
|
44
44
|
s.require_paths = ["lib"]
|
45
|
-
s.rubygems_version = %q{1.3
|
45
|
+
s.rubygems_version = %q{1.5.3}
|
46
46
|
s.summary = %q{A Nexus file format (phylogenetic inference) parser in Ruby.}
|
47
47
|
s.test_files = [
|
48
48
|
"test/test_nexus_parser.rb"
|
49
49
|
]
|
50
50
|
|
51
51
|
if s.respond_to? :specification_version then
|
52
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
53
52
|
s.specification_version = 3
|
54
53
|
|
55
|
-
if Gem::Version.new(Gem::
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
55
|
else
|
57
56
|
end
|
58
57
|
else
|
data/test/test_nexus_parser.rb
CHANGED
@@ -930,5 +930,14 @@ class Test_Parser < Test::Unit::TestCase
|
|
930
930
|
assert true, foo
|
931
931
|
end
|
932
932
|
|
933
|
+
def test_misc
|
934
|
+
|
935
|
+
assert nf = File.read(File.expand_path(File.join(File.dirname(__FILE__), '../test/Aptostichus.nex')) )
|
936
|
+
foo = parse_nexus_file(nf)
|
937
|
+
assert true, foo
|
938
|
+
end
|
939
|
+
|
940
|
+
|
941
|
+
|
933
942
|
end
|
934
943
|
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexus_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
9
|
+
- 4
|
10
|
+
version: 1.1.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- mjy
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-04-12 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -59,23 +60,27 @@ rdoc_options:
|
|
59
60
|
require_paths:
|
60
61
|
- lib
|
61
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
62
64
|
requirements:
|
63
65
|
- - ">="
|
64
66
|
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
65
68
|
segments:
|
66
69
|
- 0
|
67
70
|
version: "0"
|
68
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
69
73
|
requirements:
|
70
74
|
- - ">="
|
71
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
72
77
|
segments:
|
73
78
|
- 0
|
74
79
|
version: "0"
|
75
80
|
requirements: []
|
76
81
|
|
77
82
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.3
|
83
|
+
rubygems_version: 1.5.3
|
79
84
|
signing_key:
|
80
85
|
specification_version: 3
|
81
86
|
summary: A Nexus file format (phylogenetic inference) parser in Ruby.
|