-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* @author Mikhail Yurasov <[email protected]> | ||
* @package JSONParser | ||
* @version 0.3.1 | ||
* @version 1.0.1 | ||
*/ | ||
|
||
/** | ||
|
@@ -13,7 +13,7 @@ | |
class JSONParser { | ||
|
||
// should be the same for all components within JSONParser package | ||
static version = [1, 0, 0]; | ||
static version = "1.0.1"; | ||
|
||
/** | ||
* Parse JSON string into data structure | ||
|
@@ -164,10 +164,15 @@ class JSONParser { | |
|
||
":" : { | ||
colon = function () { | ||
// check if the key already exists | ||
if (key in container) { | ||
throw "Duplicate key \"" + key + "\""; | ||
// Check if the key already exists | ||
// NOTE previous code used 'if (key in container)...' | ||
// but this finds table ('container') member methods too | ||
local err = false; | ||
foreach (akey, avalue in container) { | ||
if (akey == key) err = true; | ||
break | ||
} | ||
if (err) throw "Duplicate key \"" + key + "\""; | ||
state = "ovalue"; | ||
} | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters