QuotedScalar
| 329 | |
| 330 | // QuotedScalar |
| 331 | void Scanner::ScanQuotedScalar() { |
| 332 | std::string scalar; |
| 333 | |
| 334 | // peek at single or double quote (don't eat because we need to preserve (for |
| 335 | // the time being) the input position) |
| 336 | char quote = INPUT.peek(); |
| 337 | bool single = (quote == '\''); |
| 338 | |
| 339 | // setup the scanning parameters |
| 340 | ScanScalarParams params; |
| 341 | RegEx end = (single ? RegEx(quote) & !Exp::EscSingleQuote() : RegEx(quote)); |
| 342 | params.end = &end; |
| 343 | params.eatEnd = true; |
| 344 | params.escape = (single ? '\'' : '\\'); |
| 345 | params.indent = 0; |
| 346 | params.fold = FOLD_FLOW; |
| 347 | params.eatLeadingWhitespace = true; |
| 348 | params.trimTrailingSpaces = false; |
| 349 | params.chomp = CLIP; |
| 350 | params.onDocIndicator = THROW; |
| 351 | |
| 352 | // insert a potential simple key |
| 353 | InsertPotentialSimpleKey(); |
| 354 | |
| 355 | Mark mark = INPUT.mark(); |
| 356 | |
| 357 | // now eat that opening quote |
| 358 | INPUT.get(); |
| 359 | |
| 360 | // and scan |
| 361 | scalar = ScanScalar(INPUT, params); |
| 362 | m_simpleKeyAllowed = false; |
| 363 | m_canBeJSONFlow = true; |
| 364 | |
| 365 | Token token(Token::NON_PLAIN_SCALAR, mark); |
| 366 | token.value = scalar; |
| 367 | m_tokens.push(token); |
| 368 | } |
| 369 | |
| 370 | // BlockScalarToken |
| 371 | // . These need a little extra processing beforehand. |