Method: QDA::Backend::NPReader#parse

Defined in:
lib/weft/backend/n6.rb

#parse(string) ⇒ Object

Parse the data contained in the string and return the reference to the top level group.



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/weft/backend/n6.rb', line 335

def parse (string)
		
		@curgroup = nil
		@top = nil

		string.each_byte { |byte|
 
 ch = byte.chr

 if ( ch == '(' ) then
@curgroup = NPNode.new(@curgroup)
if ( @top == nil ) then 
  @top = @curgroup
end

 elsif ( ch == ')' ) then
@curgroup.close
@curgroup = @curgroup.parent

 else
if ( @curgroup != nil ) then
  @curgroup.push(ch)
end

 end
		}

		return @top
end