def parse_string(quote)
_, string_type, term, open = quote
space = false
func = string_type
paren = open
term_re = Regexp.escape term
qwords = (func & STR_FUNC_QWORDS) != 0
regexp = (func & STR_FUNC_REGEXP) != 0
expand = (func & STR_FUNC_EXPAND) != 0
unless func then
self.lineno = nil
return :tSTRING_END
end
space = true if qwords and src.scan(/\s+/)
if self.nest == 0 && src.scan(/#{term_re}/) then
if qwords then
quote[1] = nil
return :tSPACE
elsif regexp then
self.yacc_value = self.regx_options
self.lineno = nil
return :tREGEXP_END
else
self.yacc_value = term
self.lineno = nil
return :tSTRING_END
end
end
if space then
return :tSPACE
end
self.string_buffer = []
if expand
case
when src.scan(/#(?=[$@])/) then
return :tSTRING_DVAR
when src.scan(/#[{]/) then
return :tSTRING_DBEG
when src.scan(/#/) then
string_buffer << '#'
end
end
if tokadd_string(func, term, paren) == RubyLexer::EOF then
rb_compile_error "unterminated string meets end of file"
end
self.yacc_value = string_buffer.join
return :tSTRING_CONTENT
end