Cache scalar regexes

This improves performance on the test.yaml attached to #158 by about
35% on my machine (0.39s -> 0.25s), as measured by
`time build/util/parse < test.yaml > /dev/null`.
This commit is contained in:
Scott Wolchok
2016-01-07 15:02:38 -08:00
committed by Jesse Beder
parent 9e37409b4b
commit 8c35a8ffab
2 changed files with 11 additions and 2 deletions

View File

@@ -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;