mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 16:31:28 +12:00
Refactored common scalar scanning code (from plain, quoted, and block) to one function.
This commit is contained in:
parent
6c193d6fbd
commit
0d5a97bffe
6 changed files with 306 additions and 188 deletions
10
exp.cpp
10
exp.cpp
|
@ -62,7 +62,7 @@ namespace YAML
|
|||
}
|
||||
|
||||
// Escape
|
||||
// . Escapes the sequence starting 'in' (it must begin with a '\')
|
||||
// . Escapes the sequence starting 'in' (it must begin with a '\' or single quote)
|
||||
// and returns the result.
|
||||
// . Fills 'length' with how many characters we ate.
|
||||
// . Throws if it's an unknown escape character.
|
||||
|
@ -72,10 +72,16 @@ namespace YAML
|
|||
length = 2;
|
||||
|
||||
// eat slash
|
||||
in.get();
|
||||
char escape = in.get();
|
||||
|
||||
// switch on escape character
|
||||
char ch = in.get();
|
||||
|
||||
// first do single quote, since it's easier
|
||||
if(escape == '\'' && ch == '\'')
|
||||
return "\'";
|
||||
|
||||
// now do the slash (we're not gonna check if it's a slash - you better pass one!)
|
||||
switch(ch) {
|
||||
case '0': return "\0";
|
||||
case 'a': return "\x07";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue