From db1f56c8449d2ea3d158753fe37bac5a750a2566 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 29 Nov 2015 14:18:52 -0800 Subject: 2611 --- html/054dilated_reagent.cc.html | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'html/054dilated_reagent.cc.html') diff --git a/html/054dilated_reagent.cc.html b/html/054dilated_reagent.cc.html index 4f107a15..02f714e4 100644 --- a/html/054dilated_reagent.cc.html +++ b/html/054dilated_reagent.cc.html @@ -15,11 +15,13 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } .traceContains { color: #008000; } .cSpecial { color: #008000; } +.PreProc { color: #c000c0; } .Comment { color: #9090ff; } .Delimiter { color: #a04060; } .Special { color: #ff6060; } .Identifier { color: #804000; } .Constant { color: #00a0a0; } +.Error { color: #ffffff; background-color: #ff6060; padding-bottom: 1px; } --> @@ -42,26 +44,32 @@ recipe main [ ] +parse: product: {"1": "number", "foo": "bar"} +:(scenario load_trailing_space_after_curly_bracket) +recipe main [ + # line below has a space at the end + { +] +# successfully parsed + //: First augment next_word to group balanced brackets together. :(before "End next_word Special-cases") - if (in.peek() == '(') - return slurp_balanced_bracket(in); - // treat curlies mostly like parens, but don't mess up labels - if (start_of_dilated_reagent(in)) - return slurp_balanced_bracket(in); +if (in.peek() == '(') + return slurp_balanced_bracket(in); +// treat curlies mostly like parens, but don't mess up labels +if (start_of_dilated_reagent(in)) + return slurp_balanced_bracket(in); :(code) // A curly is considered a label if it's the last thing on a line. Dilated // reagents should remain all on one line. -// -// Side-effect: This might delete some whitespace after an initial '{'. bool start_of_dilated_reagent(istream& in) { if (in.peek() != '{') return false; + long long int pos = in.tellg(); in.get(); // slurp '{' skip_whitespace(in); char next = in.peek(); - in.putback('{'); + in.seekg(pos); return next != '\n'; } @@ -107,7 +115,7 @@ if (s.at(s); in >> std::noskipws; in.get(); // skip '{' - while (!in.eof()) { + while (has_data(in)) { string key = slurp_key(in); if (key.empty()) continue; if (key == "}") continue; -- cgit 1.4.1-2-gfad0