示例#1
0
 private void AddPropertyToClass(SToken token, SToken localToken, SElementMultiplicity sElementMultiplicity)
 {
     throw new NotImplementedException();
 }
示例#2
0
 public bool AdoptSymbol(int symbolId, string symbolText, List<string> forms, string code, SElementMultiplicity multiplicity)
 {
     bool simbolFound = false;
     SToken token = new SToken();
     if (currentToken.TokenBefore != null)
     {
         token = currentToken;
     }
     token.Configure(symbolId, symbolText, SElementType.Symbol, "[" + symbolId + ":0]");
     token.Link(currentToken.TokenParent, currentToken, null, null);
     if (currentToken.TokenBefore != null)
     {
         token.TokenBefore = currentToken.TokenBefore;
     }
     if (token.TokenMultiplicity == SElementMultiplicity.Undefined)
     token.TokenMultiplicity = multiplicity;
     StringBuilder tokenCollectionAsString = new StringBuilder();
     SToken localCurrentToken = currentToken;
     while (localCurrentToken != null)
     {
         for (int i = 0; i < forms.Count; i++)
         {
             if (localCurrentToken.TokenType == SElementType.Undefined)
             {
                 if (localCurrentToken.TokenString.Contains(forms[i]))
                 {
                     List<SToken> explodedToken = ExplodeStoken(localCurrentToken, token, forms[i]);
                     // Try child
                     int ii = localCurrentToken.TokenParent.TokenChilds.IndexOf(localCurrentToken);
                     if (ii > -1)
                     {
                         localCurrentToken.TokenParent.TokenChilds.Insert(localCurrentToken.TokenParent.TokenChilds.IndexOf(localCurrentToken), explodedToken[0]);
                         localCurrentToken.TokenParent.TokenChilds.Remove(localCurrentToken);
                         i = 0;
                         //if (explodedToken[explodedToken.Count - 1]!=null)
                         localCurrentToken = explodedToken[explodedToken.Count - 1];
                         simbolFound = true;
                     }
                     // Try properties
                     if (currentToken.TokenDescribed != null)
                     {
                         ii = localCurrentToken.TokenDescribed.TokenProperties.IndexOf(localCurrentToken);
                         if (ii > -1)
                         {
                             localCurrentToken.TokenDescribed.TokenProperties.Insert(localCurrentToken.TokenDescribed.TokenProperties.IndexOf(localCurrentToken), explodedToken[0]);
                             localCurrentToken.TokenDescribed.TokenProperties.Remove(localCurrentToken);
                             i = 0;
                             //if (explodedToken[explodedToken.Count - 1]!=null)
                             localCurrentToken = explodedToken[explodedToken.Count - 1];
                             simbolFound = true;
                         }
                     }
                 }
             }
         }
         localCurrentToken = GetNext(localCurrentToken);
     }
     return simbolFound;
 }