Просмотр исходного кода

Allow parseing multi parameter template

mingodad 4 лет назад
Родитель
Сommit
494310761e
1 измененных файлов с 14 добавлено и 3 удалено
  1. 14 3
      SquiLu/squirrel/sqcompiler.cpp

+ 14 - 3
SquiLu/squirrel/sqcompiler.cpp

@@ -2349,10 +2349,21 @@ function_params_decl:
         //C++/Java template instantiation
         //C++/Java template instantiation
         if(_token == _SC('<'))
         if(_token == _SC('<'))
         {
         {
+            int nested = 1;
             Lex();
             Lex();
-            ExpectTypeToken();
-            if(_token != _SC('>')) Error(_SC("template instantiation declaration expected <TYPE>"));
-            Lex();
+            while(nested > 0)
+            {
+                ExpectTypeToken();
+                switch(_token)
+                {
+                    case ',': break;
+                    case '<': ++nested; break;
+                    case '>': --nested; break;
+                    default:
+                        Error(_SC("template instantiation declaration unexpected token"));
+                }
+                Lex();
+            }
         }
         }
     }
     }
     SQInteger GetVarTypeDeclaration(SQInteger declType, SQInteger dest=-1)
     SQInteger GetVarTypeDeclaration(SQInteger declType, SQInteger dest=-1)