public PascalPreprocessorLanguageParser() { this.filesExtensions = new string[1]; this.filesExtensions[0] = ".paspr" + Parsers.Controller.HideParserExtensionPostfixChar; parser = null; }
public void Reset() { grammar_stream = CGTResourceExtractor.Extract(new ResourceManager("PascalABCParser.Preprocessor.PascalPreprocessorLang", Assembly.GetExecutingAssembly()), "PascalPreprocessorLanguage"); parser = new GPBPreprocessor_Pascal(grammar_stream); max_errors = 5; }
public syntax_tree_node BuildTree(string FileName, string Text, string[] SearchPatchs, ParseMode parseMode) { if (this.parser == null) Reset(); GPBPreprocessor_Pascal parser = new GPBPreprocessor_Pascal(this.grammar_stream,this.parser.LanguageGrammar); parser.errors = Errors; parser.current_file_name = FileName; compilerDirectives = new List<compiler_directive>(); parser.CompilerDirectives = compilerDirectives; switch (parseMode) { case ParseMode.Expression: case ParseMode.Statement: return null; } syntax_tree_node cu = (syntax_tree_node)parser.Parse(Text); if (cu != null && cu is compilation_unit) { (cu as compilation_unit).file_name = FileName; (cu as compilation_unit).compiler_directives = compilerDirectives; } return cu; }