Changeset 351 for binary-improvements/7dtd-server-fixes/src/JSON/Parser.cs
- Timestamp:
- Jan 19, 2019, 6:12:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/JSON/Parser.cs
r325 r351 1 1 namespace AllocsFixes.JSON { 2 2 public class Parser { 3 public static JSONNode Parse (string json) {3 public static JSONNode Parse (string _json) { 4 4 int offset = 0; 5 return ParseInternal ( json, ref offset);5 return ParseInternal (_json, ref offset); 6 6 } 7 7 8 public static JSONNode ParseInternal (string json, ref intoffset) {9 SkipWhitespace ( json, refoffset);8 public static JSONNode ParseInternal (string _json, ref int _offset) { 9 SkipWhitespace (_json, ref _offset); 10 10 11 11 //Log.Out ("ParseInternal (" + offset + "): Decide on: '" + json [offset] + "'"); 12 switch ( json [offset]) {12 switch (_json [_offset]) { 13 13 case '[': 14 return JSONArray.Parse ( json, refoffset);14 return JSONArray.Parse (_json, ref _offset); 15 15 case '{': 16 return JSONObject.Parse ( json, refoffset);16 return JSONObject.Parse (_json, ref _offset); 17 17 case '"': 18 return JSONString.Parse ( json, refoffset);18 return JSONString.Parse (_json, ref _offset); 19 19 case 't': 20 20 case 'f': 21 return JSONBoolean.Parse ( json, refoffset);21 return JSONBoolean.Parse (_json, ref _offset); 22 22 case 'n': 23 return JSONNull.Parse ( json, refoffset);23 return JSONNull.Parse (_json, ref _offset); 24 24 default: 25 return JSONNumber.Parse ( json, refoffset);25 return JSONNumber.Parse (_json, ref _offset); 26 26 } 27 27 } 28 28 29 public static void SkipWhitespace (string json, ref intoffset) {29 public static void SkipWhitespace (string _json, ref int _offset) { 30 30 //Log.Out ("SkipWhitespace (" + offset + "): '" + json [offset] + "'"); 31 while ( offset <json.Length) {32 switch ( json [offset]) {31 while (_offset < _json.Length) { 32 switch (_json [_offset]) { 33 33 case ' ': 34 34 case '\t': 35 35 case '\r': 36 36 case '\n': 37 offset++;37 _offset++; 38 38 break; 39 39 default:
Note:
See TracChangeset
for help on using the changeset viewer.