Exemplo n.º 1
0
 private void ParseNamespace(NamespaceDefinition namespaceParent)
 {
     Move();
     if (mToken.TagValue != Tag.Identifier)
     {
         Error("Identifier expected");
     }
     var xId = (Word)mToken;
     var xName = ReadFullIdentifier(true);
     var xNamespace = namespaceParent.GetNamespaceDefinition(xName);
     mParsingContexts.Push(xNamespace);
     try
     {
         Match('{');
         while (!IsMatch('}'))
         {
             #region namespace contents
             switch (mToken.TagValue)
             {
                 case Tag.Identifier:
                     {
                         var xWord = (Word)mToken;
                         switch (mKeywords.IndexOf(xWord.Value))
                         {
                             case Keywords.Class_Idx:
                                 ParseClass(xNamespace);
                                 break;
                             case Keywords.Namespace_Idx:
                                 ParseNamespace(xNamespace);
                                 break;
                             default:
                                 throw new Exception("Keyword '" + xWord.Value + "' unexpected!");
                         }
                         break;
                     }
                 default:
                     Error("Syntax Error, token not expected: " + mToken.ToString());
                     break;
             }
             #endregion
         }
         Move(); // } char was found, otherwise the while loop wouldn't have been exited
     }
     finally
     {
         mParsingContexts.Pop();
     }
 }