diff options
author | Mathias Stearn <mathias@10gen.com> | 2010-01-20 13:41:39 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2010-01-20 13:42:39 -0500 |
commit | 9cde296ca6bdaf968396de9be2c65bf067771187 (patch) | |
tree | ef79ad35160ffd35f390779bed2c3d22a82133be /db/json.cpp | |
parent | b617df5a1a48fe5ac6f7d5cb653832d09bc99ad2 (diff) | |
download | mongo-9cde296ca6bdaf968396de9be2c65bf067771187.tar.gz |
Support more escapes in JSON strings SERVER-552
Diffstat (limited to 'db/json.cpp')
-rw-r--r-- | db/json.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/db/json.cpp b/db/json.cpp index e5a7fef843d..b55ddb17c61 100644 --- a/db/json.cpp +++ b/db/json.cpp @@ -156,6 +156,9 @@ namespace mongo { case 't': o = '\t'; break; + case 'v': + o = '\v'; + break; default: assert( false ); } @@ -456,28 +459,32 @@ public: // NOTE We use range_p rather than cntrl_p, because the latter is locale dependent. str = lexeme_d[ ch_p( '"' )[ chClear( self.b ) ] >> *( ( ch_p( '\\' ) >> - ( ch_p( '"' )[ chE( self.b ) ] | - ch_p( '\\' )[ chE( self.b ) ] | - ch_p( '/' )[ chE( self.b ) ] | + ( ch_p( 'b' )[ chE( self.b ) ] | ch_p( 'f' )[ chE( self.b ) ] | ch_p( 'n' )[ chE( self.b ) ] | ch_p( 'r' )[ chE( self.b ) ] | ch_p( 't' )[ chE( self.b ) ] | - ( ch_p( 'u' ) >> ( repeat_p( 4 )[ xdigit_p ][ chU( self.b ) ] ) ) ) ) | + ch_p( 'v' )[ chE( self.b ) ] | + ( ch_p( 'u' ) >> ( repeat_p( 4 )[ xdigit_p ][ chU( self.b ) ] ) ) | + ( ~ch_p('x') & (~range_p('0','9'))[ ch( self.b ) ] ) // hex and octal aren't supported + ) + ) | ( ~range_p( 0x00, 0x1f ) & ~ch_p( '"' ) & ( ~ch_p( '\\' ) )[ ch( self.b ) ] ) ) >> '"' ]; singleQuoteStr = lexeme_d[ ch_p( '\'' )[ chClear( self.b ) ] >> *( ( ch_p( '\\' ) >> - ( ch_p( '\'' )[ chE( self.b ) ] | - ch_p( '\\' )[ chE( self.b ) ] | - ch_p( '/' )[ chE( self.b ) ] | + ( ch_p( 'b' )[ chE( self.b ) ] | ch_p( 'f' )[ chE( self.b ) ] | ch_p( 'n' )[ chE( self.b ) ] | ch_p( 'r' )[ chE( self.b ) ] | ch_p( 't' )[ chE( self.b ) ] | - ( ch_p( 'u' ) >> ( repeat_p( 4 )[ xdigit_p ][ chU( self.b ) ] ) ) ) ) | + ch_p( 'v' )[ chE( self.b ) ] | + ( ch_p( 'u' ) >> ( repeat_p( 4 )[ xdigit_p ][ chU( self.b ) ] ) ) | + ( ~ch_p('x') & (~range_p('0','9'))[ ch( self.b ) ] ) // hex and octal aren't supported + ) + ) | ( ~range_p( 0x00, 0x1f ) & ~ch_p( '\'' ) & ( ~ch_p( '\\' ) )[ ch( self.b ) ] ) ) >> '\'' ]; // real_p accepts numbers with nonsignificant zero prefixes, which |