MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / jsonValue

Function jsonValue

lib/web/jshint.js:24081–24162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24079 // Parse JSON
24080
24081 function jsonValue() {
24082 function jsonObject() {
24083 var o = {}, t = state.tokens.next;
24084 advance("{");
24085 if (state.tokens.next.id !== "}") {
24086 for (;;) {
24087 if (state.tokens.next.id === "(end)") {
24088 error("E026", state.tokens.next, t.line);
24089 } else if (state.tokens.next.id === "}") {
24090 warning("W094", state.tokens.curr);
24091 break;
24092 } else if (state.tokens.next.id === ",") {
24093 error("E028", state.tokens.next);
24094 } else if (state.tokens.next.id !== "(string)") {
24095 warning("W095", state.tokens.next, state.tokens.next.value);
24096 }
24097 if (o[state.tokens.next.value] === true) {
24098 warning("W075", state.tokens.next, "key", state.tokens.next.value);
24099 } else if ((state.tokens.next.value === "__proto__" &&
24100 !state.option.proto) || (state.tokens.next.value === "__iterator__" &&
24101 !state.option.iterator)) {
24102 warning("W096", state.tokens.next, state.tokens.next.value);
24103 } else {
24104 o[state.tokens.next.value] = true;
24105 }
24106 advance();
24107 advance(":");
24108 jsonValue();
24109 if (state.tokens.next.id !== ",") {
24110 break;
24111 }
24112 advance(",");
24113 }
24114 }
24115 advance("}");
24116 }
24117
24118 function jsonArray() {
24119 var t = state.tokens.next;
24120 advance("[");
24121 if (state.tokens.next.id !== "]") {
24122 for (;;) {
24123 if (state.tokens.next.id === "(end)") {
24124 error("E027", state.tokens.next, t.line);
24125 } else if (state.tokens.next.id === "]") {
24126 warning("W094", state.tokens.curr);
24127 break;
24128 } else if (state.tokens.next.id === ",") {
24129 error("E028", state.tokens.next);
24130 }
24131 jsonValue();
24132 if (state.tokens.next.id !== ",") {
24133 break;
24134 }
24135 advance(",");
24136 }
24137 }
24138 advance("]");

Callers 3

jsonObjectFunction · 0.85
jsonArrayFunction · 0.85

Calls 4

jsonObjectFunction · 0.85
jsonArrayFunction · 0.85
errorFunction · 0.85
advanceFunction · 0.70

Tested by

no test coverage detected