Beispiel #1
0
		// http://www.digitalmars.com/d/2.0/module.html

		/// <summary>
		/// Module entry point
		/// </summary>
		public DModule Root()
		{
			Step();

			var module = new DModule();
			LastParsedObject = module;
			module.Location = la.Location;
			doc = module;

			// Only one module declaration possible!
			if (laKind == (Module))
			{
				module.Description = GetComments();
				module.OptionalModuleStatement= ModuleDeclaration();
				module.Add(module.OptionalModuleStatement);
				module.Description += CheckForPostSemicolonComment();

				if (module.OptionalModuleStatement.ModuleName!=null)
					module.ModuleName = module.OptionalModuleStatement.ModuleName.ToString();
				module.OptionalModuleStatement.ParentNode = doc;
			}

			// Now only declarations or other statements are allowed!
			while (!IsEOF)
			{
				DeclDef(module);
			}

			// Also track comments at a module's end e.g. for multi-line comment folding
			GetComments();
			
			module.EndLocation = la.Location;
			return module;
		}