• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSharp.CSharpParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.CSharp.CSharpParser的典型用法代码示例。如果您正苦于以下问题:C# CSharpParser类的具体用法?C# CSharpParser怎么用?C# CSharpParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CSharpParser类属于Mono.CSharp命名空间,在下文中一共展示了CSharpParser类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ParseString

		//
		// Parses the string @input and returns a CSharpParser if succeeful.
		//
		// if @silent is set to true then no errors are
		// reported to the user.  This is used to do various calls to the
		// parser and check if the expression is parsable.
		//
		// @partial_input: if @silent is true, then it returns whether the
		// parsed expression was partial, and more data is needed
		//
		static CSharpParser ParseString (bool silent, string input, out bool partial_input)
		{
			partial_input = false;
			Reset ();
			queued_fields.Clear ();

			Stream s = new MemoryStream (Encoding.Default.GetBytes (input));
			SeekableStreamReader seekable = new SeekableStreamReader (s, Encoding.Default);

			InputKind kind = ToplevelOrStatement (seekable);
			if (kind == InputKind.Error){
				if (!silent)
					Report.Error (-25, "Detection Parsing Error");
				partial_input = false;
				return null;
			}

			if (kind == InputKind.EOF){
				if (silent == false)
					Console.Error.WriteLine ("Internal error: EOF condition should have been detected in a previous call with silent=true");
				partial_input = true;
				return null;
				
			}
			seekable.Position = 0;

			CSharpParser parser = new CSharpParser (seekable, (CompilationUnit) Location.SourceFiles [0]);
			parser.ErrorOutput = Report.Stderr;

			if (kind == InputKind.StatementOrExpression){
				parser.Lexer.putback_char = Tokenizer.EvalStatementParserCharacter;
				RootContext.StatementMode = true;
			} else {
				//
				// Do not activate EvalCompilationUnitParserCharacter until
				// I have figured out all the limitations to invoke methods
				// in the generated classes.  See repl.txt
				//
				parser.Lexer.putback_char = Tokenizer.EvalUsingDeclarationsParserCharacter;
				//parser.Lexer.putback_char = Tokenizer.EvalCompilationUnitParserCharacter;
				RootContext.StatementMode = false;
			}

			if (silent)
				Report.DisableReporting ();
			try {
				parser.parse ();
			} finally {
				if (Report.Errors != 0){
					if (silent && parser.UnexpectedEOF)
						partial_input = true;

					parser.undo.ExecuteUndo ();
					parser = null;
				}

				if (silent)
					Report.EnableReporting ();
			}
			return parser;
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:71,代码来源:eval.cs


示例2: Simple

		public void Simple ()
		{
			//string content = @"class A { }";
			string content = @"

class Foo
{
	void Bar ()
	{
completionList.Add (""delegate"" + sb, ""md-keyword"", GettextCatalog.GetString (""Creates anonymous delegate.""), ""delegate"" + sb + "" {"" + Document.Editor.EolMarker + stateTracker.Engine.ThisLineIndent + TextEditorProperties.IndentString + ""|"" + Document.Editor.EolMarker + stateTracker.Engine.ThisLineIndent +""};"");
	}
}"
	;


			var stream = new MemoryStream (Encoding.UTF8.GetBytes (content));

			var ctx = new CompilerContext (new CompilerSettings (), new AssertReportPrinter ());

			ModuleContainer module = new ModuleContainer (ctx);
			var file = new SourceFile ("test", "asdfas", 0);
			CSharpParser parser = new CSharpParser (
				new SeekableStreamReader (stream, Encoding.UTF8),
				new CompilationSourceFile (module, file),
				ctx.Report,
				new ParserSession ());

			RootContext.ToplevelTypes = module;
			Location.Initialize (new List<SourceFile> { file });
			parser.parse ();

			Assert.AreEqual (0, ctx.Report.Errors);

			module.Accept (new TestVisitor ());
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:35,代码来源:ASTVisitorTest.cs


示例3: Parse

        public static void Parse(SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module, ParserSession session, Report report)
        {
            var file = new CompilationSourceFile(module, sourceFile);
            module.AddTypeContainer(file);

            CSharpParser parser = new CSharpParser(reader, file, report, session);
            parser.parse();
        }
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:8,代码来源:CustomDynamicDriver.cs


示例4: Simple

		public void Simple ()
		{
			//string content = @"class A { }";
			string content = @"

class Foo
{
	void Bar ()
	{
completionList.Add (""delegate"" + sb, ""md-keyword"", GettextCatalog.GetString (""Creates anonymous delegate.""), ""delegate"" + sb + "" {"" + Document.Editor.EolMarker + stateTracker.Engine.ThisLineIndent + TextEditorProperties.IndentString + ""|"" + Document.Editor.EolMarker + stateTracker.Engine.ThisLineIndent +""};"");
	}
}"
	;


			var stream = new MemoryStream (Encoding.UTF8.GetBytes (content));

			var ctx = new CompilerContext (new CompilerSettings (), new Report (new AssertReportPrinter ()));

			ModuleContainer module = new ModuleContainer (ctx);
			CSharpParser parser = new CSharpParser (
				new SeekableStreamReader (stream, Encoding.UTF8),
				new CompilationUnit ("name", "path", 0),
				module);

			RootContext.ToplevelTypes = module;
			Location.AddFile (ctx.Report, "asdfas");
			Location.Initialize ();
			parser.LocationsBag = new LocationsBag ();
			parser.parse ();

			var m = module.Types[0].Methods[0] as Method;
			var s = m.Block.FirstStatement;
			var o = s.loc.Column;
			

			module.Accept (new TestVisitor ());
		}
开发者ID:nlhepler,项目名称:mono,代码行数:38,代码来源:ASTVisitorTest.cs


示例5: ParseSnippet

		/*
		/// <summary>
		/// Parses a file snippet; guessing what the code snippet represents (whole file, type members, block, type reference, expression).
		/// </summary>
		public AstNode ParseSnippet (string code)
		{
			// TODO: add support for parsing a part of a file
			throw new NotImplementedException ();
		}
		 */
		public DocumentationReference ParseDocumentationReference(string cref)
		{
			// see Mono.CSharp.DocumentationBuilder.HandleXrefCommon
			if (cref == null)
				throw new ArgumentNullException("cref");
			
			// Additional symbols for < and > are allowed for easier XML typing
			cref = cref.Replace('{', '<').Replace('}', '>');
			
			lock (parseLock) {
				errorReportPrinter = new ErrorReportPrinter("");
				var ctx = new CompilerContext(compilerSettings.ToMono(), errorReportPrinter);
				ctx.Settings.TabSize = 1;
				var reader = new SeekableStreamReader(new StringTextSource(cref));
				var file = new SourceFile("", "", 0);
				Location.Initialize(new List<SourceFile>(new [] { file }));
				var module = new ModuleContainer(ctx);
				module.DocumentationBuilder = new DocumentationBuilder(module);
				var source_file = new CompilationSourceFile(module);
				var report = new Report(ctx, errorReportPrinter);
				var session = new ParserSession();
				session.LocationsBag = new LocationsBag();
				var parser = new Mono.CSharp.CSharpParser(reader, source_file, report, session);
				parser.Lexer.Line += initialLocation.Line - 1;
				parser.Lexer.Column += initialLocation.Column - 1;
				parser.Lexer.putback_char = Tokenizer.DocumentationXref;
				parser.Lexer.parsing_generic_declaration_doc = true;
				parser.parse();
				if (report.Errors > 0) {
//					Report.Warning (1584, 1, mc.Location, "XML comment on `{0}' has syntactically incorrect cref attribute `{1}'",
//					                mc.GetSignatureForError (), cref);
				}
				
				var conversionVisitor = new ConversionVisitor(false, session.LocationsBag);
				var docRef = conversionVisitor.ConvertXmlDoc(module.DocumentationBuilder);
				CompilerCallableEntryPoint.Reset();
				return docRef;
			}
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:49,代码来源:CSharpParser.cs


示例6: ParseString

		//
		// Parses the string @input and returns a CSharpParser if succeeful.
		//
		// if @silent is set to true then no errors are
		// reported to the user.  This is used to do various calls to the
		// parser and check if the expression is parsable.
		//
		// @partial_input: if @silent is true, then it returns whether the
		// parsed expression was partial, and more data is needed
		//
		CSharpParser ParseString (ParseMode mode, string input, out bool partial_input)
		{
			partial_input = false;
			Reset ();

			var enc = ctx.Settings.Encoding;
			var s = new MemoryStream (enc.GetBytes (input));
			SeekableStreamReader seekable = new SeekableStreamReader (s, enc);

			InputKind kind = ToplevelOrStatement (seekable);
			if (kind == InputKind.Error){
				if (mode == ParseMode.ReportErrors)
					ctx.Report.Error (-25, "Detection Parsing Error");
				partial_input = false;
				return null;
			}

			if (kind == InputKind.EOF){
				if (mode == ParseMode.ReportErrors)
					Console.Error.WriteLine ("Internal error: EOF condition should have been detected in a previous call with silent=true");
				partial_input = true;
				return null;
				
			}
			seekable.Position = 0;

			source_file.DeclarationFound = false;
			CSharpParser parser = new CSharpParser (seekable, source_file);

			if (kind == InputKind.StatementOrExpression){
				parser.Lexer.putback_char = Tokenizer.EvalStatementParserCharacter;
				ctx.Settings.StatementMode = true;
			} else {
				parser.Lexer.putback_char = Tokenizer.EvalCompilationUnitParserCharacter;
				ctx.Settings.StatementMode = false;
			}

			if (mode == ParseMode.GetCompletions)
				parser.Lexer.CompleteOnEOF = true;

			ReportPrinter old_printer = null;
			if ((mode == ParseMode.Silent || mode == ParseMode.GetCompletions))
				old_printer = ctx.Report.SetPrinter (new StreamReportPrinter (TextWriter.Null));

			try {
				parser.parse ();
			} finally {
				if (ctx.Report.Errors != 0){
					if (mode != ParseMode.ReportErrors  && parser.UnexpectedEOF)
						partial_input = true;

					if (parser.undo != null)
						parser.undo.ExecuteUndo ();

					parser = null;
				}

				if (old_printer != null)
					ctx.Report.SetPrinter (old_printer);
			}
			return parser;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:72,代码来源:eval.cs


示例7: HandleXrefCommon

		//
		// Processes "see" or "seealso" elements from cref attribute.
		//
		void HandleXrefCommon (MemberCore mc, TypeContainer ds, XmlElement xref)
		{
			string cref = xref.GetAttribute ("cref");
			// when, XmlReader, "if (cref == null)"
			if (!xref.HasAttribute ("cref"))
				return;

			// Nothing to be resolved the reference is marked explicitly
			if (cref.Length > 2 && cref [1] == ':')
				return;

			// Additional symbols for < and > are allowed for easier XML typing
			cref = cref.Replace ('{', '<').Replace ('}', '>');

			var encoding = module.Compiler.Settings.Encoding;
			var s = new MemoryStream (encoding.GetBytes (cref));
			SeekableStreamReader seekable = new SeekableStreamReader (s, encoding);

			var source_file = new CompilationSourceFile (doc_module);
			var report = new Report (doc_module.Compiler, new NullReportPrinter ());

			var parser = new CSharpParser (seekable, source_file, report);
			ParsedParameters = null;
			ParsedName = null;
			ParsedBuiltinType = null;
			ParsedOperator = null;
			parser.Lexer.putback_char = Tokenizer.DocumentationXref;
			parser.Lexer.parsing_generic_declaration_doc = true;
			parser.parse ();
			if (report.Errors > 0) {
				Report.Warning (1584, 1, mc.Location, "XML comment on `{0}' has syntactically incorrect cref attribute `{1}'",
					mc.GetSignatureForError (), cref);

				xref.SetAttribute ("cref", "!:" + cref);
				return;
			}

			MemberSpec member;
			string prefix = null;
			FullNamedExpression fne = null;

			//
			// Try built-in type first because we are using ParsedName as identifier of
			// member names on built-in types
			//
			if (ParsedBuiltinType != null && (ParsedParameters == null || ParsedName != null)) {
				member = ParsedBuiltinType.Type;
			} else {
				member = null;
			}

			if (ParsedName != null || ParsedOperator.HasValue) {
				TypeSpec type = null;
				string member_name = null;

				if (member == null) {
					if (ParsedOperator.HasValue) {
						type = mc.CurrentType;
					} else if (ParsedName.Left != null) {
						fne = ResolveMemberName (mc, ParsedName.Left);
						if (fne != null) {
							var ns = fne as Namespace;
							if (ns != null) {
								fne = ns.LookupTypeOrNamespace (mc, ParsedName.Name, ParsedName.Arity, LookupMode.Probing, Location.Null);
								if (fne != null) {
									member = fne.Type;
								}
							} else {
								type = fne.Type;
							}
						}
					} else {
						fne = ResolveMemberName (mc, ParsedName);
						if (fne == null) {
							type = mc.CurrentType;
						} else if (ParsedParameters == null) {
							member = fne.Type;
						} else if (fne.Type.MemberDefinition == mc.CurrentType.MemberDefinition) {
							member_name = Constructor.ConstructorName;
							type = fne.Type;
						}
					}
				} else {
					type = (TypeSpec) member;
					member = null;
				}

				if (ParsedParameters != null) {
					var old_printer = mc.Module.Compiler.Report.SetPrinter (new NullReportPrinter ());
					foreach (var pp in ParsedParameters) {
						pp.Resolve (mc);
					}
					mc.Module.Compiler.Report.SetPrinter (old_printer);
				}

				if (type != null) {
					if (member_name == null)
//.........这里部分代码省略.........
开发者ID:royleban,项目名称:mono,代码行数:101,代码来源:doc.cs


示例8: ParseString

		//
		// Parses the string @input and returns a CSharpParser if succeeful.
		//
		// if @silent is set to true then no errors are
		// reported to the user.  This is used to do various calls to the
		// parser and check if the expression is parsable.
		//
		// @partial_input: if @silent is true, then it returns whether the
		// parsed expression was partial, and more data is needed
		//
		static CSharpParser ParseString (ParseMode mode, string input, out bool partial_input)
		{
			partial_input = false;
			Reset ();
			queued_fields.Clear ();
			Tokenizer.LocatedToken.Initialize ();

			Stream s = new MemoryStream (Encoding.Default.GetBytes (input));
			SeekableStreamReader seekable = new SeekableStreamReader (s, Encoding.Default);

			InputKind kind = ToplevelOrStatement (seekable);
			if (kind == InputKind.Error){
				if (mode == ParseMode.ReportErrors)
					ctx.Report.Error (-25, "Detection Parsing Error");
				partial_input = false;
				return null;
			}

			if (kind == InputKind.EOF){
				if (mode == ParseMode.ReportErrors)
					Console.Error.WriteLine ("Internal error: EOF condition should have been detected in a previous call with silent=true");
				partial_input = true;
				return null;
				
			}
			seekable.Position = 0;

			CSharpParser parser = new CSharpParser (seekable, (CompilationUnit) Location.SourceFiles [0], ctx);

			if (kind == InputKind.StatementOrExpression){
				parser.Lexer.putback_char = Tokenizer.EvalStatementParserCharacter;
				RootContext.StatementMode = true;
			} else {
				//
				// Do not activate EvalCompilationUnitParserCharacter until
				// I have figured out all the limitations to invoke methods
				// in the generated classes.  See repl.txt
				//
				parser.Lexer.putback_char = Tokenizer.EvalUsingDeclarationsParserCharacter;
				//parser.Lexer.putback_char = Tokenizer.EvalCompilationUnitParserCharacter;
				RootContext.StatementMode = false;
			}

			if (mode == ParseMode.GetCompletions)
				parser.Lexer.CompleteOnEOF = true;

			ReportPrinter old_printer = null;
			if ((mode == ParseMode.Silent || mode == ParseMode.GetCompletions) && CSharpParser.yacc_verbose_flag == 0)
				old_printer = SetPrinter (new StreamReportPrinter (TextWriter.Null));

			try {
				parser.parse ();
			} finally {
				if (ctx.Report.Errors != 0){
					if (mode != ParseMode.ReportErrors  && parser.UnexpectedEOF)
						partial_input = true;

					parser.undo.ExecuteUndo ();
					parser = null;
				}

				if (old_printer != null)
					SetPrinter (old_printer);
			}
			return parser;
		}
开发者ID:silk,项目名称:monodevelop,代码行数:76,代码来源:eval.cs


示例9: ParseFile

		public static CompilerCompilationUnit ParseFile (string[] args, Stream input, string inputFile, ReportPrinter reportPrinter)
		{
			lock (parseLock) {
				try {
					Driver d = Driver.Create (args, false, reportPrinter);
					if (d == null)
						return null;
	
					Location.AddFile (null, inputFile);
					Location.Initialize ();
	
					// TODO: encoding from driver
					SeekableStreamReader reader = new SeekableStreamReader (input, Encoding.Default);
	
					CompilerContext ctx = new CompilerContext (new ReflectionMetaImporter (), new Report (reportPrinter));
					
					RootContext.ToplevelTypes = new ModuleCompiled (ctx, false /* isUnsafe */);
					CompilationUnit unit = null;
					try {
						unit = (CompilationUnit) Location.SourceFiles [0];
					} catch (Exception) {
						string path = Path.GetFullPath (inputFile);
						unit = new CompilationUnit (inputFile, path, 0);
					}
					CSharpParser parser = new CSharpParser (reader, unit, ctx);
					parser.Lexer.TabSize = 1;
					parser.Lexer.sbag = new SpecialsBag ();
					parser.LocationsBag = new LocationsBag ();
					parser.UsingsBag = new UsingsBag ();
					parser.parse ();
					
					return new CompilerCompilationUnit () { ModuleCompiled = RootContext.ToplevelTypes, LocationsBag = parser.LocationsBag, UsingsBag = parser.UsingsBag, SpecialsBag = parser.Lexer.sbag };
				} finally {
					Reset ();
				}
			}
		}
开发者ID:Ein,项目名称:monodevelop,代码行数:37,代码来源:driver.cs


示例10: Parse

 public void Parse(SeekableStreamReader reader, CompilationUnit file, ModuleContainer module)
 {
     CSharpParser parser = new CSharpParser (reader, file, module);
     parser.parse ();
 }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:5,代码来源:driver.cs


示例11: ParseFile

		public static CompilerCompilationUnit ParseFile (string[] args, Stream input, string inputFile, ReportPrinter reportPrinter)
		{
			lock (parseLock) {
				try {
					//                                     Driver d = Driver.Create (args, false, null, reportPrinter);
					//                                     if (d == null)
					//                                             return null;
       
					var r = new Report (reportPrinter);
					CommandLineParser cmd = new CommandLineParser (r, Console.Out);
					var setting = cmd.ParseArguments (args);
					if (setting == null || r.Errors > 0)
						return null;

					CompilerContext ctx = new CompilerContext (setting, r);
					
					var files = new List<CompilationSourceFile> ();
					var unit = new CompilationSourceFile (inputFile, inputFile, 0);
					var module = new ModuleContainer (ctx);
					unit.NamespaceContainer = new NamespaceContainer (null, module, null, unit);
					files.Add (unit);
					Location.Initialize (files);

					// TODO: encoding from driver
					SeekableStreamReader reader = new SeekableStreamReader (input, Encoding.Default);
				
					RootContext.ToplevelTypes = module;
					
					CSharpParser parser = new CSharpParser (reader, unit);
					parser.Lexer.TabSize = 1;
					parser.Lexer.sbag = new SpecialsBag ();
					parser.LocationsBag = new LocationsBag ();
					parser.UsingsBag = new UsingsBag ();
					parser.parse ();
					
					return new CompilerCompilationUnit () { 
						ModuleCompiled = RootContext.ToplevelTypes,
						LocationsBag = parser.LocationsBag, 
						UsingsBag = parser.UsingsBag, 
						SpecialsBag = parser.Lexer.sbag,
						LastYYValue = parser.LastYYVal
					};
				} finally {
					Reset ();
				}
			}
		}
开发者ID:severinh,项目名称:monodevelop-vala-afrodite-update,代码行数:47,代码来源:driver.cs


示例12: Parse

		void Parse (SeekableStreamReader reader, CompilationUnit file)
		{
			CSharpParser parser = new CSharpParser (reader, file, ctx);
			parser.parse ();
		}
开发者ID:Ein,项目名称:monodevelop,代码行数:5,代码来源:driver.cs


示例13: ParseFile

		public static CompilerCompilationUnit ParseFile (string[] args, Stream input, string inputFile, ReportPrinter reportPrinter)
		{
			lock (parseLock) {
				try {
//                                     Driver d = Driver.Create (args, false, null, reportPrinter);
//                                     if (d == null)
//                                             return null;
       
                                       var r = new Report (reportPrinter);
                                       CommandLineParser cmd = new CommandLineParser (r, Console.Out);
                                       var setting = cmd.ParseArguments (args);
                                       if (setting == null || r.Errors > 0)
						return null;

                                       CompilerContext ctx = new CompilerContext (setting, r);
                                       var d = new Driver (ctx);

					Location.AddFile (null, inputFile);
					Location.Initialize ();
	
					// TODO: encoding from driver
					SeekableStreamReader reader = new SeekableStreamReader (input, Encoding.Default);
					
					RootContext.ToplevelTypes = new ModuleContainer (ctx);
					CompilationUnit unit = null;
					try {
						unit = (CompilationUnit) Location.SourceFiles [0];
					} catch (Exception) {
						string path = Path.GetFullPath (inputFile);
						unit = new CompilationUnit (inputFile, path, 0);
					}
					CSharpParser parser = new CSharpParser (reader, unit, RootContext.ToplevelTypes);
					parser.Lexer.TabSize = 1;
					parser.Lexer.sbag = new SpecialsBag ();
					parser.LocationsBag = new LocationsBag ();
					parser.UsingsBag = new UsingsBag ();
					parser.parse ();
					
					return new CompilerCompilationUnit () { ModuleCompiled = RootContext.ToplevelTypes, LocationsBag = parser.LocationsBag, UsingsBag = parser.UsingsBag, SpecialsBag = parser.Lexer.sbag };
				} finally {
					Reset ();
				}
			}
		}
开发者ID:sandyarmstrong,项目名称:monodevelop,代码行数:44,代码来源:driver.cs


示例14: Parse

		public void Parse (SeekableStreamReader reader, CompilationSourceFile file, ModuleContainer module)
		{
			file.NamespaceContainer = new NamespaceContainer (null, module, null, file);

			CSharpParser parser = new CSharpParser (reader, file);
			parser.parse ();
		}
开发者ID:severinh,项目名称:monodevelop-vala-afrodite-update,代码行数:7,代码来源:driver.cs


示例15: Parse

		void Parse (SeekableStreamReader reader, CompilationUnit file)
		{
			CSharpParser parser = new CSharpParser (reader, file);
			parser.ErrorOutput = Report.Stderr;
			try {
				parser.parse ();
			} catch (Exception ex) {
				Report.Error(589, parser.Lexer.Location,
					"Compilation aborted in file `{0}', {1}", file.Name, ex);
			}
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:11,代码来源:driver.cs


示例16: Parse

        public static CSharpParser Parse(SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module, ParserSession session, Report report, int lineModifier = 0, int colModifier = 0)
        {
            var file = new CompilationSourceFile (module, sourceFile);
            module.AddTypeContainer(file);

            CSharpParser parser = new CSharpParser (reader, file, report, session);
            parser.Lexer.Line += lineModifier;
            parser.Lexer.Column += colModifier;
            parser.Lexer.sbag = new SpecialsBag ();
            parser.parse ();
            return parser;
        }
开发者ID:riviti,项目名称:NRefactory,代码行数:12,代码来源:driver.cs


示例17: Parse

 /// <summary>
 /// Parses the code and generate the compiled units.
 /// </summary>
 /// <param name="_code">The source code that is being parsed.</param>
 /// <returns>Zero if success, otherwise a non-zero value would return.</returns>
 /// <remarks>
 /// For more information about compiled units, please refer to <see cref="System.CodeDom.CodeCompileUnit"/>.
 /// </remarks>
 /// <seealso cref="System.CodeDom.CodeCompileUnit"/>
 public int Parse(string _code)
 {
     MemoryStream memoryStream = new MemoryStream(Encoding.ASCII.GetBytes(_code));
     CSharpParser parser = new CSharpParser(null, memoryStream, null);
     int ret = parser.parse();
     codeCompileUnit__ = parser.Builder.CurrCompileUnit;
     return ret;
 }
开发者ID:daxnet,项目名称:guluwin,代码行数:17,代码来源:CSharpCodeVisualizer.cs


示例18: Parse

		public CSharpParser Parse (SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module)
		{
			var file = new CompilationSourceFile (module, sourceFile);
			module.AddTypeContainer (file);

			CSharpParser parser = new CSharpParser (reader, file);
			parser.Lexer.sbag = new SpecialsBag ();
			parser.parse ();
			return parser;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:10,代码来源:driver.cs


示例19: Parse

		public static void Parse (SeekableStreamReader reader, SourceFile sourceFile, ModuleContainer module, ParserSession session, Report report)
		{
			var file = new CompilationSourceFile (module, sourceFile);
			module.AddTypeContainer (file);

			if (sourceFile.FileType == SourceFileType.CSharp) {
				CSharpParser parser = new CSharpParser (reader, file, session);
				parser.parse ();
			} else {
				PlayScriptParser parser = new PlayScriptParser (reader, file, session);
				parser.parsing_playscript = sourceFile.PsExtended;
				parser.parse ();
			}
		}
开发者ID:robterrell,项目名称:playscript-mono,代码行数:14,代码来源:driver.cs



注:本文中的Mono.CSharp.CSharpParser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSharp.Cast类代码示例发布时间:2022-05-26
下一篇:
C# CSharp.BuilderContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap