Mercurial > pub > ImplabNet
comparison Implab/JSON/JSONParser.cs @ 140:f973c5df9972 v2
fixes
author | cin |
---|---|
date | Fri, 20 Feb 2015 15:58:34 +0300 |
parents | 0349189d2564 |
children | 97fbbf816844 |
comparison
equal
deleted
inserted
replaced
139:041b77711262 | 140:f973c5df9972 |
---|---|
44 static readonly DFAStateDescriptior[] _jsonDFA; | 44 static readonly DFAStateDescriptior[] _jsonDFA; |
45 static readonly DFAStateDescriptior[] _objectDFA; | 45 static readonly DFAStateDescriptior[] _objectDFA; |
46 static readonly DFAStateDescriptior[] _arrayDFA; | 46 static readonly DFAStateDescriptior[] _arrayDFA; |
47 | 47 |
48 static JSONParser() { | 48 static JSONParser() { |
49 var jsonExpression = Token.New(JsonTokenType.BeginObject, JsonTokenType.BeginArray).Tag(0); | 49 |
50 | 50 |
51 var valueExpression = Token.New(JsonTokenType.BeginArray, JsonTokenType.BeginObject, JsonTokenType.Literal, JsonTokenType.Number, JsonTokenType.String); | 51 var valueExpression = Token.New(JsonTokenType.BeginArray, JsonTokenType.BeginObject, JsonTokenType.Literal, JsonTokenType.Number, JsonTokenType.String); |
52 var memberExpression = Token.New(JsonTokenType.String).Cat(Token.New(JsonTokenType.NameSeparator)).Cat(valueExpression); | 52 var memberExpression = Token.New(JsonTokenType.String).Cat(Token.New(JsonTokenType.NameSeparator)).Cat(valueExpression); |
53 | |
53 var objectExpression = memberExpression | 54 var objectExpression = memberExpression |
54 .Cat( | 55 .Cat( |
55 Token.New(JsonTokenType.ValueSeparator) | 56 Token.New(JsonTokenType.ValueSeparator) |
56 .Cat(memberExpression) | 57 .Cat(memberExpression) |
57 .EClosure() | 58 .EClosure() |
66 .EClosure() | 67 .EClosure() |
67 ) | 68 ) |
68 .Optional() | 69 .Optional() |
69 .Cat(Token.New(JsonTokenType.EndArray)) | 70 .Cat(Token.New(JsonTokenType.EndArray)) |
70 .Tag(0); | 71 .Tag(0); |
72 | |
73 var jsonExpression = valueExpression.Tag(0); | |
71 | 74 |
72 _jsonDFA = BuildDFA(jsonExpression).States; | 75 _jsonDFA = BuildDFA(jsonExpression).States; |
73 _objectDFA = BuildDFA(objectExpression).States; | 76 _objectDFA = BuildDFA(objectExpression).States; |
74 _arrayDFA = BuildDFA(arrayExpression).States; | 77 _arrayDFA = BuildDFA(arrayExpression).States; |
75 } | 78 } |