Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

When UnquotedKeys is Enable /all/ keys must be unquoted #31

Open
thomasdelbert opened this issue Mar 15, 2014 · 3 comments
Open

When UnquotedKeys is Enable /all/ keys must be unquoted #31

thomasdelbert opened this issue Mar 15, 2014 · 3 comments

Comments

@thomasdelbert
Copy link

Would like to be able to accept both quoted and unquoted keys.

{ item1: 'value1',
"item2": "value2"
}

With UnquotedKeys enabled, only item1 loads, when UnquotedKeys is disabled, this example fails to parse.

@thomasdelbert
Copy link
Author

I have a fix - can you please give me access to commit?
jsonxx.cc

285,288c285,295
<             if (!parse_identifier(input, key)) {
<                 if (Parser == Permissive) {
<                     if (input.peek() == '}')
<                         break;
---
>             while(true) {
>                 // need to burn off comments and white space.  We can't use the match() method because we don't
>                 // know what character to look for.
>                 input >> std::ws;
>                 char peek = input.peek();
>                 if(peek == '/') {
>                     std::cout << "Burning comment \n";
>                     if(!parse_comment(input)) {
>                         // not a valid comment
>                         return false;
>                     }
290c297,321
<                 return false;
---
>                 else if(!isspace(peek)) {
>                     break;
>                 }
>                 else if(input.eof()) {
>                     break;
>                 }
>             }
>             char peek = input.peek();
>             if(peek == '"' || peek == '\'') {
>                 if (!parse_string(input, key)) {
>                     if (Parser == Permissive) {
>                         if (input.peek() == '}')
>                             break;
>                     }
>                     return false;
>                 }
>             }
>             else {
>                 if (!parse_identifier(input, key)) {
>                     if (Parser == Permissive) {
>                         if (input.peek() == '}')
>                             break;
>                     }
>                     return false;
>                 } 

@Rapptz
Copy link
Contributor

Rapptz commented Mar 16, 2014

Just make a pull request like every one else does.

https://help.github.com/articles/creating-a-pull-request

@r-lyeh-archived
Copy link
Contributor

if you're new to this proceed as follows:

  • go to the jsonxx main page and click on fork button
  • git clone https://github.com/youraccount/jsonxx
  • apply patches and verify all tests pass
  • git add *
  • git commit -m "message to commit"
  • git push
  • go to your jsonxx clone webpage in github and click on the pull request button
  • submit the form

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants