示例#1
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static CompileUnit ParseFile(ParserSettings settings, string fname)
		{
			if (null == fname)
				throw new ArgumentNullException("fname");
	
			using (StreamReader reader = File.OpenText(fname))
				return ParseReader(settings, fname, reader);
		}
示例#2
0
        public static CompileUnit ParseReader(string readerName, TextReader reader)
        {
            var settings = new ParserSettings();

            return(ParseReader(settings, readerName, reader));
        }
示例#3
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static CompileUnit ParseReader(string readerName, TextReader reader)
		{
			var settings = new ParserSettings();
			return ParseReader(settings, readerName, reader);
		}
示例#4
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static BooParser CreateParser(ParserSettings settings, string readerName, TextReader reader)
		{
			var parser = new BooParser(CreateBooLexer(settings.TabSize, readerName, reader)) {
				MaxRecursionLimit = settings.MaxRecursionLimit,
				ErrorPatterns = settings.ErrorPatterns
			};
			parser.setFilename(readerName);
			if (null != settings.ErrorHandler)
				parser.Error += settings.ErrorHandler;
			return parser;
		}
示例#5
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static CompileUnit ParseFile(int tabSize, string fname)
		{
			var settings = new ParserSettings() { TabSize = tabSize };
			return ParseFile(settings, fname);
		}
示例#6
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static BooParser CreateParser(int tabSize, string readerName, TextReader reader, ParserErrorHandler errorHandler)
		{
			var settings = new ParserSettings() { TabSize = tabSize, ErrorHandler = errorHandler };
			return CreateParser(settings, readerName, reader);
		}
示例#7
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static Module ParseModule(ParserSettings settings, CompileUnit cu, string readerName, TextReader reader)
		{
			if (Readers.IsEmpty(reader))
			{
				var emptyModule = new Module(new LexicalInfo(readerName), CodeFactory.ModuleNameFrom(readerName));
				cu.Modules.Add(emptyModule);
				return emptyModule;
			}

			var module = CreateParser(settings, readerName, reader).start(cu);
			module.Name = CodeFactory.ModuleNameFrom(readerName);
			return module;
		}
示例#8
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static Module ParseModule(int tabSize, CompileUnit cu, string readerName, TextReader reader, ParserErrorHandler errorHandler)
		{
			var settings = new ParserSettings() { TabSize = tabSize, ErrorHandler = errorHandler };
			return ParseModule(settings, cu, readerName, reader);
		}
示例#9
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static CompileUnit ParseReader(ParserSettings settings, string readerName, TextReader reader)
		{
			var cu = new CompileUnit();
			ParseModule(settings, cu, readerName, reader);
			return cu;
		}
示例#10
0
文件: BooParser.cs 项目: Rfvgyhn/boo
		public static CompileUnit ParseReader(int tabSize, string readerName, TextReader reader)
		{		
			var settings = new ParserSettings() { TabSize = tabSize };
			return ParseReader(settings, readerName, reader);
		}