public SyntaxElement ParseSyntax() { ParseToken("syntax"); string name = ParseName(); SyntaxElement syntax = new SyntaxElement(name); ParseToken("="); for (Token tk = this.PeekToken(); tk != null && tk.Value != ";"; tk = this.PeekToken()) { switch (tk.TokenType) { case TokenType.Name: syntax.AddPrimaryExpression(this.ParseIdentifier()); break; case TokenType.String: syntax.AddPrimaryExpression(this.ParseTextLiteral()); break; default: throw new UnexpectedTokenException(tk); } } ParseToken(";"); return(syntax); }