internal void Parse(Parser parser) { this.sourceAttributes = new List<SourceCustomAttribute>(0); List<INamespaceDeclarationMember> members = this.members = new List<INamespaceDeclarationMember>(2); members.Add(this.CreateNamespaceImport()); List<ITypeDeclarationMember> typeMembers = new List<ITypeDeclarationMember>(); RootClassDeclaration rootClass = new RootClassDeclaration(new NameDeclaration(this.Compilation.NameTable.GetNameFor("RootClass"), this.SourceLocation), typeMembers, this.SourceLocation); members.Add(rootClass); List<Statement> statements = new List<Statement>(); rootClass.AddStandardMembers(this.Compilation, statements); parser.ParseStatements(statements, rootClass); }
/// <summary> /// If this namespace declaration has not yet been initialized, parse the source, set the containing nodes of the result /// and report any scanning and parsing errors via the host environment. This method is called whenever /// </summary> /// <remarks>Not called in incremental scenarios</remarks> protected override void InitializeIfNecessary() { if (this.isInitialized) return; lock (GlobalLock.LockingObject) { if (this.isInitialized) return; //^ assume this.CompilationPart is CompilationPart; //The constructor ensures this SmallBasicCompilationPart cp = (SmallBasicCompilationPart)this.CompilationPart; Parser parser = new Parser(this.Compilation.NameTable, this.SourceLocation, new SmallBasicCompilerOptions(), cp.ScannerAndParserErrors); //TODO: get options from Compilation this.Parse(parser); this.SetContainingNodes(); ErrorEventArgs errorEventArguments = new ErrorEventArgs(ErrorReporter.Instance, this.SourceLocation, cp.ScannerAndParserErrors.AsReadOnly()); this.Compilation.HostEnvironment.ReportErrors(errorEventArguments); this.isInitialized = true; } }
internal void Parse(Parser parser, SmallBasicCompilationPart compilationPart) { this.Parse(parser); this.compilationPart = compilationPart; this.SetContainingNodes(); this.isInitialized = true; }