diff --git a/Implab/Diagnostics/Extensions.cs b/Implab/Diagnostics/Extensions.cs --- a/Implab/Diagnostics/Extensions.cs +++ b/Implab/Diagnostics/Extensions.cs @@ -19,7 +19,7 @@ }, reason => { TraceContext.Instance.EnterLogicalOperation(op,true); - TraceLog.TraceInformation("promise cancelled {0}", reason.Message); + TraceLog.TraceInformation("promise cancelled {0}", reason == null ? "" : reason.Message); TraceLog.EndLogicalOperation(); TraceContext.Instance.Leave(); } diff --git a/Implab/JSON/JSONParser.cs b/Implab/JSON/JSONParser.cs --- a/Implab/JSON/JSONParser.cs +++ b/Implab/JSON/JSONParser.cs @@ -46,10 +46,11 @@ namespace Implab.JSON { static readonly DFAStateDescriptior[] _arrayDFA; static JSONParser() { - var jsonExpression = Token.New(JsonTokenType.BeginObject, JsonTokenType.BeginArray).Tag(0); + var valueExpression = Token.New(JsonTokenType.BeginArray, JsonTokenType.BeginObject, JsonTokenType.Literal, JsonTokenType.Number, JsonTokenType.String); var memberExpression = Token.New(JsonTokenType.String).Cat(Token.New(JsonTokenType.NameSeparator)).Cat(valueExpression); + var objectExpression = memberExpression .Cat( Token.New(JsonTokenType.ValueSeparator) @@ -69,6 +70,8 @@ namespace Implab.JSON { .Cat(Token.New(JsonTokenType.EndArray)) .Tag(0); + var jsonExpression = valueExpression.Tag(0); + _jsonDFA = BuildDFA(jsonExpression).States; _objectDFA = BuildDFA(objectExpression).States; _arrayDFA = BuildDFA(arrayExpression).States;