Inheritance: BooParserBase
Beispiel #1
0
        public void Run()
        {
            ParserErrorHandler errorHandler = new ParserErrorHandler(OnParserError);

            foreach (ICompilerInput input in _context.Parameters.Input)
            {
                try
                {
                    using (System.IO.TextReader reader = input.Open())
                    {
                        BooParser.ParseModule(_tabSize, _context.CompileUnit, input.Name, reader, errorHandler);
                    }
                }
                catch (CompilerError error)
                {
                    _context.Errors.Add(error);
                }
                catch (antlr.TokenStreamRecognitionException x)
                {
                    OnParserError(x.recog);
                }
                catch (Exception x)
                {
                    _context.Errors.Add(CompilerErrorFactory.InputError(input.Name, x));
                }
            }
        }
Beispiel #2
0
 public static BooParser CreateParser(int tabSize, string readerName, TextReader reader, ParserErrorHandler errorHandler)
 {
     var parser = new BooParser(CreateBooLexer(tabSize, readerName, reader));
     parser.setFilename(readerName);
     parser.Error += errorHandler;
     return parser;
 }
Beispiel #3
0
        public static BooParser CreateParser(int tabSize, string readerName, TextReader reader, ParserErrorHandler errorHandler)
        {
            BooParser parser = new BooParser(CreateBooLexer(tabSize, readerName, reader));

            parser.setFilename(readerName);
            parser.Error += errorHandler;
            return(parser);
        }
Beispiel #4
0
        public static Module ParseModule(int tabSize, CompileUnit cu, string readerName, TextReader reader, ParserErrorHandler errorHandler)
        {
            BooParser parser = CreateParser(tabSize, readerName, reader, errorHandler);

            Module module = parser.start(cu);

            module.Name = CreateModuleName(readerName);
            return(module);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        protected virtual void ParseModule(string inputName, System.IO.TextReader reader)
        {
            var settings = My <ParserSettings> .Instance;

            BooParser.ParseModule(settings, _context.CompileUnit, inputName, reader);
        }
Beispiel #7
0
 protected virtual void ParseModule(string inputName, System.IO.TextReader reader, ParserErrorHandler errorHandler)
 {
     BooParser.ParseModule(TabSize, _context.CompileUnit, inputName, reader, errorHandler);
 }
Beispiel #8
0
		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;
		}