Skip to content

Commit

Permalink
fix(util): do not consume leading slash
Browse files Browse the repository at this point in the history
Closes hjson#12
  • Loading branch information
CameronNemo committed Dec 7, 2019
1 parent 37c4be8 commit d998a1f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hjson/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl<Iter> StringReader<Iter>
self.eat_char();
self.eat_char();
},
Some(_) => { self.eat_char(); },
Some(_) => { return Ok(()); },
None => return Err(self.error(ErrorCode::TrailingCharacters)), //todo
}
}
Expand Down
4 changes: 3 additions & 1 deletion hjson_tests/assets/comments_result.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@
str1: 00 # part of the string
str2: 00.0 // part of the string
str3: 02 /* part of the string */
}
/key: value
key2: /value2
}
6 changes: 4 additions & 2 deletions hjson_tests/assets/comments_result.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@
"null3": null,
"str1": "00 # part of the string",
"str2": "00.0 // part of the string",
"str3": "02 /* part of the string */"
}
"str3": "02 /* part of the string */",
"/key": "value",
"key2": "/value2"
}
2 changes: 2 additions & 0 deletions hjson_tests/assets/comments_test.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ styles
str1: 00 # part of the string
str2: 00.0 // part of the string
str3: 02 /* part of the string */
/key: value
key2: /value2
}

0 comments on commit d998a1f

Please sign in to comment.