libexpr: Deprecate CR and CRLF line endings
They are broken beyond repair, and barring a language version revision this is our only option besides doing nothing about it. Change-Id: I25fa4f032ca9b5ca67356946bcd889289583592e
This commit is contained in:
@@ -215,6 +215,13 @@ public:
|
||||
template<typename Rule>
|
||||
struct BuildAST : grammar::v1::nothing<Rule> {};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::t::eol::deprecated_cr_crlf> {
|
||||
static void apply(const auto & in, auto &, State & ps) {
|
||||
if (!ps.featureSettings.isEnabled(Dep::CRLineEndings))
|
||||
ps.badLineEndingFound(ps.at(in), true);
|
||||
}
|
||||
};
|
||||
|
||||
struct SimpleLambdaState : SubexprState {
|
||||
using SubexprState::SubexprState;
|
||||
|
||||
@@ -552,9 +559,12 @@ template<typename... Content> struct BuildAST<grammar::v1::string::literal<Conte
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::string::cr_lf> {
|
||||
template<> struct BuildAST<grammar::v1::string::cr_crlf> {
|
||||
static void apply(const auto & in, StringState & s, State & ps) {
|
||||
s.append(ps.at(in), in.string_view()); // FIXME compat with old parser
|
||||
if (!ps.featureSettings.isEnabled(Dep::CRLineEndings))
|
||||
ps.badLineEndingFound(ps.at(in), false);
|
||||
else
|
||||
s.append(ps.at(in), in.string_view()); // FIXME compat with old parser
|
||||
}
|
||||
};
|
||||
|
||||
@@ -620,6 +630,13 @@ template<> struct BuildAST<grammar::v1::ind_string::has_content> {
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::ind_string::cr> {
|
||||
static void apply(const auto & in, IndStringState & s, State & ps) {
|
||||
if (!ps.featureSettings.isEnabled(Dep::CRLineEndings))
|
||||
ps.badLineEndingFound(ps.at(in), false);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::v1::ind_string> : change_head<IndStringState> {
|
||||
static void success(const auto & in, IndStringState & s, ExprState & e, State & ps) {
|
||||
e.pushExpr(noPos, ps.stripIndentation(ps.at(in), std::move(s.lines)));
|
||||
|
||||
Reference in New Issue
Block a user