private void ParseStruct(AccessLevel accessLevel) { Token structKeyword = _lexer.Eat(TokenType.StructKeyword); Token name = _lexer.Eat(TokenType.Identifer); if (accessLevel != AccessLevel.Public) { accessLevel = AnalysisAccessLevel(name.Content); } Token colon = null, inheritanceToken = null; if (_lexer.Match(":")) { colon = _lexer.Eat(TokenType.Colon); inheritanceToken = _lexer.Eat(TokenType.Identifer); } StructDefinition structDefinition = new StructDefinition(structKeyword, name, colon, inheritanceToken, _endNameSpace, accessLevel); if (accessLevel != AccessLevel.Public) { structDefinition.AccessLevel = AnalysisAccessLevel(_lexer.NextTokenContent); } if (_lexer.MatchNext(":")) { if (_lexer.MatchNext(TokenType.Identifer)) //TODO:使用Match函数报错 { structDefinition.InheritanceName = _lexer.NextTokenContent; _lexer.Next(); } } _endNameSpace.AddStructure(structDefinition); _parsingStructure = structDefinition; FilesDefinitions[_lexer.FileIndex].Add(structDefinition); structDefinition.AddFunction(new FunctionDefinition(structDefinition, ".ctor", structDefinition.AccessLevel, false)); ChunkNode chunk = ParseChunk(s_cusDefinitionOrder, out Token openBrace, out Token closeBrace); structDefinition.SetBraces(openBrace, closeBrace); foreach (SyntaxNode analysisNode in chunk.Nodes) { structDefinition.AddField((DefineVariableNode)analysisNode); } _parsingStructure = null; }