Closed
Description
If the source code contains any invalid use of \, then lintr::lint() will stop working:
col <- c("a", \)The case could be simplified to the following:
> parse(text = "\\")
Error in parse(text = "\\") : <text>:1:1: unexpected input
1: \
^
Backtrace:
1: parse(text = "\\")
> lintr::lint("\\\n")
Error in read_xml.raw(charToRaw(enc2utf8(x)), "UTF-8", ..., as_html = as_html, :
StartTag: invalid element name [68]
Backtrace:
1: read_xml.raw(charToRaw(enc2utf8(x)), "UTF-8", ..., as_html = as_html,
2: read_xml.character(xmlparsedata::xml_parse_data(pc))
3: xml2::read_xml(xmlparsedata::xml_parse_data(pc))
4: FUN(X[[i]], ...)
5: lapply(X = top_level_expressions(parsed_content), FUN = get_single_source_expression,
6: get_source_expressions(filename)
7: lintr::lint("\\\n")
Looks like it is caused by xmlparsedata writing invalid XML and lintr does not handle such case.
Before error occurs, pc got the following value:
line1 col1 line2 col2 id parent token terminal text
1 1 1 1 1 1 0 \\ FALSE \\
xmlparsedata::xml_parse_data(pc) produces the following XML with invalid tokens:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<exprlist>
<\ line1="1" col1="1" line2="1" col2="1" start="3" end="3">\
</\>
</exprlist>Metadata
Metadata
Assignees
Labels
No labels
Activity