# File nqxml/tokenizer.rb, line 847 def nextText text = '' while true text << textUpTo(BRACKET_OR_AMP_REGEX, true, false) # We are done if this is the end of this input stream or # if the next char is a '<'. NOTE: the check for eof must # come first because peekChar() will go beyond eof to the # next (popped) input stream. if eof?() || peekChar() == '<' return text.empty? ? nil : Text.new(text) end if peekChar() == '&' ref = textUpTo(';', false, true) # '&...' ref << nextChar() # ';' ref = NQXML.replaceCharacterRefs(ref) ref = NQXML.replacePredefinedEntityRefs(ref) if ref[0] == ?& && ref.length > 1 && @inputStack.last.replaceRefs # We are looking at an entity reference, and this # input wants to replace those. replacement = @internalEntities[ref[1..-2]] if replacement.nil? str = "entity reference '#{ref}' is undefined" raise ParserError.new(str, self) end # Before we create a new input object so we can # recursively parse the replacement text, let's # slurp up as much "simple" text as we can. replacement =~ /\[^<&]*/ text << $& replacement = $' if !replacement.empty? @currInput = Input.new(replacement, false, @currInput.uri) @inputStack.push(@currInput) moreText = nextText() text << moreText.text if moreText end else # append ref to text and move ion text << ref end end end end