diff 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
line wrap: on
line diff
--- a/Implab.ServiceHost/Unity/TypeReferenceParser.cs	Sat Apr 28 00:11:38 2018 +0300
+++ b/Implab.ServiceHost/Unity/TypeReferenceParser.cs	Sat Apr 28 18:48:09 2018 +0300
@@ -17,10 +17,14 @@
 
             CloseList,
 
+            OpenArray,
+
+            CloseArray,
+
             Eof
         }
 
-        readonly Regex _tokens = new Regex(@"([\w\+]+)|\s*([\.{},])\s*");
+        readonly Regex _tokens = new Regex(@"([\w\+]+)|\s*([\.{},\[\]])\s*");
 
         TokenType m_token;
 
@@ -73,6 +77,12 @@
                         case ",":
                             m_token = TokenType.Comma;
                             break;
+                        case "[":
+                            m_token = TokenType.OpenArray;
+                            break;
+                        case "]":
+                            m_token = TokenType.CloseArray;
+                            break;
                     }
                 }
                 return true;
@@ -82,7 +92,7 @@
 
         public TypeReference Parse() {
             var result = ReadTypeReference();
-            if (ReadToken())
+            if (Token != TokenType.Eof)
                 ThrowUnexpectedToken();
             return result;
         }
@@ -142,6 +152,10 @@
             return typeReference;
         }
 
+        int CountDimentions() {
+            return 0;
+        }
+
         TypeReference[] ReadTypeReferenceList() {
             var list = new List<TypeReference>();