init_parsers(skip_blanks, field_size_limit, liberal_parsing)
private
Pre-compiles parsers and stores them by name for access during reads.
# File lib/csv.rb, line 2105
def init_parsers(skip_blanks, field_size_limit, liberal_parsing)
# store the parser behaviors
@skip_blanks = skip_blanks
@field_size_limit = field_size_limit
@liberal_parsing = liberal_parsing
# prebuild Regexps for faster parsing
esc_row_sep = escape_re(@row_sep)
esc_quote = escape_re(@quote_char)
@parsers = {
# for detecting parse errors
quote_or_nl: encode_re("[", esc_quote, "\r\n]"),
nl_or_lf: encode_re("[\r\n]"),
stray_quote: encode_re( "[^", esc_quote, "]", esc_quote,
"[^", esc_quote, "]" ),
# safer than chomp!()
line_end: encode_re(esc_row_sep, "\\z"),
# illegal unquoted characters
return_newline: encode_str("\r\n")
}
end