diff --git a/src/exp.h b/src/exp.h index f248802..ba82874 100644 --- a/src/exp.h +++ b/src/exp.h @@ -165,6 +165,15 @@ inline const RegEx& EndScalarInFlow() { return e; } +inline const RegEx& ScanScalarEndInFlow() { + static const RegEx e = (EndScalarInFlow() || (BlankOrBreak() + Comment())); + return e; +} + +inline const RegEx& ScanScalarEnd() { + static const RegEx e = EndScalar() || (BlankOrBreak() + Comment()); + return e; +} inline const RegEx& EscSingleQuote() { static const RegEx e = RegEx("\'\'"); return e; diff --git a/src/scantoken.cpp b/src/scantoken.cpp index 180ad00..79e7682 100644 --- a/src/scantoken.cpp +++ b/src/scantoken.cpp @@ -297,8 +297,8 @@ void Scanner::ScanPlainScalar() { // set up the scanning parameters ScanScalarParams params; - params.end = (InFlowContext() ? Exp::EndScalarInFlow() : Exp::EndScalar()) || - (Exp::BlankOrBreak() + Exp::Comment()); + params.end = + (InFlowContext() ? Exp::ScanScalarEndInFlow() : Exp::ScanScalarEnd()); params.eatEnd = false; params.indent = (InFlowContext() ? 0 : GetTopIndent() + 1); params.fold = FOLD_FLOW;