comparison Implab.ServiceHost/Unity/TypeReferenceParser.cs @ 277:963b17c275be v3

Refactoring Added <array> element to injection parameters Working on registrations of factories
author cin
date Sat, 28 Apr 2018 18:48:09 +0300
parents ff581cff7003
children 6691aff01de1
comparison
equal deleted inserted replaced
276:b4e0f81c7425 277:963b17c275be
15 15
16 OpenList, 16 OpenList,
17 17
18 CloseList, 18 CloseList,
19 19
20 OpenArray,
21
22 CloseArray,
23
20 Eof 24 Eof
21 } 25 }
22 26
23 readonly Regex _tokens = new Regex(@"([\w\+]+)|\s*([\.{},])\s*"); 27 readonly Regex _tokens = new Regex(@"([\w\+]+)|\s*([\.{},\[\]])\s*");
24 28
25 TokenType m_token; 29 TokenType m_token;
26 30
27 string m_tokenValue; 31 string m_tokenValue;
28 32
71 m_token = TokenType.Dot; 75 m_token = TokenType.Dot;
72 break; 76 break;
73 case ",": 77 case ",":
74 m_token = TokenType.Comma; 78 m_token = TokenType.Comma;
75 break; 79 break;
80 case "[":
81 m_token = TokenType.OpenArray;
82 break;
83 case "]":
84 m_token = TokenType.CloseArray;
85 break;
76 } 86 }
77 } 87 }
78 return true; 88 return true;
79 } 89 }
80 throw new FormatException($"Failed to parse '{m_text}' at pos {m_pos}"); 90 throw new FormatException($"Failed to parse '{m_text}' at pos {m_pos}");
81 } 91 }
82 92
83 public TypeReference Parse() { 93 public TypeReference Parse() {
84 var result = ReadTypeReference(); 94 var result = ReadTypeReference();
85 if (ReadToken()) 95 if (Token != TokenType.Eof)
86 ThrowUnexpectedToken(); 96 ThrowUnexpectedToken();
87 return result; 97 return result;
88 } 98 }
89 99
90 string[] ReadTypeName() { 100 string[] ReadTypeName() {
140 } 150 }
141 151
142 return typeReference; 152 return typeReference;
143 } 153 }
144 154
155 int CountDimentions() {
156 return 0;
157 }
158
145 TypeReference[] ReadTypeReferenceList() { 159 TypeReference[] ReadTypeReferenceList() {
146 var list = new List<TypeReference>(); 160 var list = new List<TypeReference>();
147 161
148 do { 162 do {
149 var typeReference = ReadTypeReference(); 163 var typeReference = ReadTypeReference();