mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
Added quoted scalars (with escaping).
Refactored some common whitespace-parsing code in scanning both scalars. Implemented the flow collection tokens.
This commit is contained in:
parent
a224c7818b
commit
49a75b2d78
9 changed files with 307 additions and 54 deletions
14
exp.h
14
exp.h
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "regex.h"
|
||||
#include <string>
|
||||
#include <ios>
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
|
@ -13,6 +15,8 @@ namespace YAML
|
|||
const RegEx Blank = RegEx(' ') || RegEx('\t');
|
||||
const RegEx Break = RegEx('\n');
|
||||
const RegEx BlankOrBreak = Blank || Break;
|
||||
const RegEx Digit = RegEx('0', '9');
|
||||
const RegEx Hex = Digit || RegEx('A', 'F') || RegEx('a', 'f');
|
||||
|
||||
// actual tags
|
||||
|
||||
|
@ -30,11 +34,17 @@ namespace YAML
|
|||
// . Can never start with any of , [ ] { } # & * ! | > \' \" % @ `
|
||||
// . In the block context - ? : must be not be followed with a space.
|
||||
// . In the flow context ? : are illegal and - must not be followed with a space.
|
||||
const RegEx PlainScalar = !(BlankOrBreak || RegEx(",[]{}#&*!|>\'\"%@`", REGEX_OR) || (RegEx("-?:") + Blank)),
|
||||
const RegEx PlainScalar = !(BlankOrBreak || RegEx(",[]{}#&*!|>\'\"%@`", REGEX_OR) || (RegEx("-?:", REGEX_OR) + Blank)),
|
||||
PlainScalarInFlow = !(BlankOrBreak || RegEx("?:,[]{}#&*!|>\'\"%@`", REGEX_OR) || (RegEx('-') + Blank));
|
||||
const RegEx IllegalColonInScalar = RegEx(':') + !BlankOrBreak;
|
||||
const RegEx EndScalar = RegEx(':') + BlankOrBreak,
|
||||
EndScalarInFlow = (RegEx(':') + BlankOrBreak) || RegEx(",:?[]{}");
|
||||
EndScalarInFlow = (RegEx(':') + BlankOrBreak) || RegEx(",:?[]{}", REGEX_OR);
|
||||
|
||||
const RegEx EscSingleQuote = RegEx("\'\'");
|
||||
const RegEx EscBreak = RegEx('\\') + Break;
|
||||
|
||||
// and some functions
|
||||
std::string Escape(std::istream& in, int& length);
|
||||
}
|
||||
|
||||
namespace Keys
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue