private void Initialize(Token annotationToken, TokenStream proxyTokenStream) { this.Token = annotationToken; Token token = proxyTokenStream.Pop(); if (!Parser.IsValidIdentifier(token.Value)) { throw new ParserException(annotationToken, "Invalid type"); } this.Name = token.Value; while (proxyTokenStream.PopIfPresent(".")) { this.Name += "."; this.Name += proxyTokenStream.PopValue(); } List <AnnotatedType> generics = new List <AnnotatedType>(); if (proxyTokenStream.PopIfPresent("<")) { while (proxyTokenStream.HasMore && !proxyTokenStream.IsNext(">")) { if (generics.Count > 0 && !proxyTokenStream.PopIfPresent(",")) { throw new ParserException(annotationToken, "Expected comma in generic list"); } AnnotatedType genericItem = new AnnotatedType(annotationToken, proxyTokenStream); generics.Add(genericItem); } if (!proxyTokenStream.PopIfPresent(">")) { throw new ParserException(annotationToken, "Unclosed generic bracket."); } } this.Generics = generics.ToArray(); }
private void Initialize(Token annotationToken, TokenStream proxyTokenStream) { this.Token = annotationToken; Token token = proxyTokenStream.Pop(); if (!Parser.IsValidIdentifier(token.Value)) throw new ParserException(annotationToken, "Invalid type"); this.Name = token.Value; while (proxyTokenStream.PopIfPresent(".")) { this.Name += "."; this.Name += proxyTokenStream.PopValue(); } List<AnnotatedType> generics = new List<AnnotatedType>(); if (proxyTokenStream.PopIfPresent("<")) { while (proxyTokenStream.HasMore && !proxyTokenStream.IsNext(">")) { if (generics.Count > 0 && !proxyTokenStream.PopIfPresent(",")) { throw new ParserException(annotationToken, "Expected comma in generic list"); } AnnotatedType genericItem = new AnnotatedType(annotationToken, proxyTokenStream); generics.Add(genericItem); } if (!proxyTokenStream.PopIfPresent(">")) { throw new ParserException(annotationToken, "Unclosed generic bracket."); } } this.Generics = generics.ToArray(); }