Beispiel #1
0
 private string GetIdentifier(TypeNameIdentifiers identifierType) {
   int start = this.currentItr;
   Int32List escape = new Int32List();
   if (identifierType == TypeNameIdentifiers.Id) {
     do {
       char c = this.currentItr < this.typeNameString.Length ? this.typeNameString[this.currentItr] : '\0';
       this.currentItr++;
       switch (c) {
         case ',':
         case '[':
         case ']':
         case '&':
         case '*':
         case '+':
         case '\0':
           goto done;
         case '\\':
           escape.Add(this.currentItr - 1);
           if (!this.IsTypeNameReservedChar(this.typeNameString[this.currentItr]) || this.currentItr >= this.typeNameString.Length)
             return null;
           this.currentItr++;
           break;
       }
     } while (true);
     done:
     this.currentItr--;
   } else if (identifierType == TypeNameIdentifiers.FusionName)
     this.currentItr = this.typeNameString.Length;
   else if (identifierType == TypeNameIdentifiers.EmbeddedFusionName) {
     for (; (this.currentItr < this.typeNameString.Length) && (this.typeNameString[this.currentItr] != ']'); this.currentItr++) {
       if (this.typeNameString[this.currentItr] == '\\')
         if (this.typeNameString[this.currentItr + 1] == ']') {
           escape.Add(this.currentItr);
           this.currentItr++;
           continue;
         }
       if (this.currentItr >= this.typeNameString.Length)
         return null;
     }
     if (this.currentItr >= this.typeNameString.Length)
       return null;
   } else
     return null;
   this.itr = this.currentItr;
   this.nextToken = this.LexAToken();
   if (escape.Count < 1)
     return this.typeNameString.Substring(start, this.currentItr - start);
   Text.StringBuilder idBuilder = new Text.StringBuilder(this.currentItr - start - escape.Count);
   int s = start;
   for (int i = 0; i < escape.Count; i++) {
     int e = escape[i];
     idBuilder.Append(this.typeNameString, s, e - s);
     s = e + 1;
   }
   if (s < this.typeNameString.Length)
     idBuilder.Append(this.typeNameString, s, this.currentItr - s);
   return idBuilder.ToString();
 }
Beispiel #2
0
 private bool TokenIs(TypeNameTokens token) {
   return (this.currentToken & token) != 0;
 }
Beispiel #3
0
 private void NextToken() {
   this.currentToken = this.nextToken;
   this.currentItr = this.itr;
   this.nextToken = this.LexAToken();
 }
Beispiel #4
0
 private bool NextTokenIs(TypeNameTokens token) {
   return (this.nextToken & token) != 0;
 }
Beispiel #5
0
 private TypeNameParser(string typeNameString, SerializedTypeName typeName) {
   if (typeNameString == null)
     typeNameString = string.Empty;
   this.currentToken = TypeNameTokens.Empty;
   this.nextToken = TypeNameTokens.Empty;
   this.typeName = typeName;
   this.typeNameString = typeNameString;
   this.currentItr = this.itr = 0;
 }