- Timestamp:
- 02/24/10 12:35:19 (15 years ago)
- Location:
- branches/Persistence Test/HeuristicLab.Persistence/3.3/Auxiliary
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Persistence Test/HeuristicLab.Persistence/3.3/Auxiliary/TypeName.cs
r1795 r2858 31 31 public string ToString(bool full, bool includeAssembly) { 32 32 StringBuilder sb = new StringBuilder(); 33 sb.Append(Namespace).Append('.').Append(ClassName); 33 if (!string.IsNullOrEmpty(Namespace)) 34 sb.Append(Namespace).Append('.'); 35 sb.Append(ClassName); 34 36 if (IsGeneric) { 35 37 sb.Append('`').Append(GenericArgs.Count).Append('['); -
branches/Persistence Test/HeuristicLab.Persistence/3.3/Auxiliary/TypeNameParser.cs
r2735 r2858 29 29 | 'Culture=[a-zA-F0-9]+' 30 30 31 Version := '\d+\.\d+\.\d+\.\d+)'31 Version := \d+\.\d+\.\d+\.\d+ 32 32 33 33 IDENTIFIER = [_a-zA-Z][_a-ZA-Z0-9]* … … 50 50 {"`", "BACKTICK"} }; 51 51 private static Regex NumberRegex = new Regex("^\\d+$"); 52 private static Regex TokenRegex = new Regex("[-&.+,\\[\\]* =`]|\\d+|[_a-zA-Z][_a-zA-Z0-9]*"); 52 private static Regex IdentifierRegex = new Regex("^[_a-zA-Z][_a-zA-Z0-9]*$"); 53 private static Regex TokenRegex = new Regex("[-&.+,\\[\\]* =`]|[a-f0-9]+|\\d+|[_a-zA-Z][_a-zA-Z0-9]*"); 53 54 public string Name { get; private set; } 54 55 public string Value { get; private set; } 56 public bool IsIdentifier { get; private set; } 55 57 public int? Number { get; private set; } 56 58 public int Position { get; private set; } … … 63 65 } else { 64 66 Value = value; 67 IsIdentifier = IdentifierRegex.IsMatch(value); 65 68 } 66 69 } … … 239 242 private KeyValuePair<string, string> ConsumeAssignment(string name) { 240 243 ConsumeToken("EQUALS", true); 241 return new KeyValuePair<string, string>(name, Consume Identifier());244 return new KeyValuePair<string, string>(name, ConsumeToken()); 242 245 } 243 246 … … 273 276 if (tokens.Count == 0) 274 277 return false; 275 if (tokens.Peek().Value == value ) {278 if (tokens.Peek().Value == value && tokens.Peek().IsIdentifier) { 276 279 tokens.Dequeue(); 277 280 return true; … … 288 291 if (tokens.Count == 0) 289 292 throw new ParseError("End of input while expecting identifier"); 293 if (tokens.Peek().Value != null && tokens.Peek().IsIdentifier) 294 return tokens.Dequeue().Value; 295 throw new ParseError(String.Format( 296 "Identifier expected, found \"{0}\" instead", 297 tokens.Peek().ToString())); 298 } 299 300 private string ConsumeToken() { 301 if (tokens.Count == 0) 302 throw new ParseError("End of input while expecting token"); 290 303 if (tokens.Peek().Value != null) 291 304 return tokens.Dequeue().Value; 292 305 throw new ParseError(String.Format( 293 " Identifierexpected, found \"{0}\" instead",306 "Token expected, found \"{0}\" instead", 294 307 tokens.Peek().ToString())); 295 308 }
Note: See TracChangeset
for help on using the changeset viewer.