nexus_parser 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/parser.rb +16 -3
- data/nexus_parser.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
data/lib/parser.rb
CHANGED
@@ -84,7 +84,11 @@ class NexusParser::Parser
|
|
84
84
|
# need to not ignore to test against
|
85
85
|
parse_dimensions if @lexer.peek(NexusParser::Tokens::Dimensions)
|
86
86
|
|
87
|
+
inf = 0
|
87
88
|
while true
|
89
|
+
inf += 1
|
90
|
+
raise (ParserError,"Either you have a gazillion taxa or more likely the parser is caught in an infinite loop trying to parser taxon labels. Check for double single quotes in this block.") if inf > 100000
|
91
|
+
|
88
92
|
if @lexer.peek(NexusParser::Tokens::EndBlk)
|
89
93
|
@lexer.pop(NexusParser::Tokens::EndBlk)
|
90
94
|
break
|
@@ -113,7 +117,12 @@ class NexusParser::Parser
|
|
113
117
|
end
|
114
118
|
|
115
119
|
def parse_characters_blk
|
120
|
+
|
121
|
+
inf = 0
|
116
122
|
while true
|
123
|
+
inf += 1
|
124
|
+
raise (ParserError,"Either you have a gazillion characters or more likely the parser is caught in an infinite loop trying to parser character data. Check for double single quotes in this block.") if inf > 100000
|
125
|
+
|
117
126
|
if @lexer.peek(NexusParser::Tokens::EndBlk) # we're at the end of the block, exit after geting rid of the semi-colon
|
118
127
|
break
|
119
128
|
else
|
@@ -171,8 +180,12 @@ class NexusParser::Parser
|
|
171
180
|
|
172
181
|
def parse_chr_state_labels
|
173
182
|
@lexer.pop(NexusParser::Tokens::CharStateLabels)
|
174
|
-
|
183
|
+
|
184
|
+
inf = 0
|
175
185
|
while true
|
186
|
+
inf += 1
|
187
|
+
raise (ParserError,"Either you have a gazillion character state labels or more likely the parser is caught in an infinite loop while trying to parser character state labels. Check for double single quotes in this block.") if inf > 100000
|
188
|
+
|
176
189
|
if @lexer.peek(NexusParser::Tokens::SemiColon)
|
177
190
|
break
|
178
191
|
else
|
@@ -232,10 +245,10 @@ class NexusParser::Parser
|
|
232
245
|
# IMPORTANT - we don't parse the (CM <note>), we just strip the "(CM" ... ")" bit for now in NexusParser::Note
|
233
246
|
|
234
247
|
@vars = {}
|
235
|
-
inf = 0
|
248
|
+
inf = 0 # a crude iteration checker
|
236
249
|
while true
|
237
250
|
inf += 1
|
238
|
-
raise "Either you have a gazillion notes or more likely parser is caught in an infinite loop inside
|
251
|
+
raise (ParserError,"Either you have a gazillion notes or more likely parser is caught in an infinite loop inside the Begin Notes block. Check for double single quotes in this block.") if inf > 100000
|
239
252
|
if @lexer.peek(NexusParser::Tokens::EndBlk)
|
240
253
|
@lexer.pop(NexusParser::Tokens::EndBlk)
|
241
254
|
@builder.add_note(@vars) # one still left to add
|
data/nexus_parser.gemspec
CHANGED