protected LanguageTempCodeCompiler(IronyAst rootAst, LanguageCompilationLog compilationLog) { var textCodeUnit = new LanguageCodeText("", ""); CodeUnit = textCodeUnit; RootAst = rootAst; CompilationLog = compilationLog ?? new LanguageCompilationLog(textCodeUnit, Progress); TranslatorContext = null; }
internal LanguageCodeTextLine(LanguageCodeText parentTextSourceCode, int lineNumber, int firstCharPos, int charCount) { ParentTextCodeUnit = parentTextSourceCode; LineNumber = lineNumber; FirstCharacterPosition = firstCharPos; CharactersCount = charCount; }
/// <summary> /// Initialize the compiler to be ready for parse tree to AST translation /// </summary> /// <param name="codeText"></param> /// <param name="parsingFunction"></param> /// <param name="parentScope"></param> /// <returns></returns> protected bool InitializeCompiler(string codeText, Func <string, LanguageCompilationLog, ParseTreeNode> parsingFunction, LanguageScope parentScope) { CodeUnit = new LanguageCodeText("", codeText); InitializeCompilationLog(); RootAst = parentScope.RootAst; //Parse the new code (this is a fast operation) ParseSourceCode(parsingFunction); //Translate the parse tree into the root AST if (RootParseNode == null) { return(false); } InitializeTranslatorContext(parentScope); //Make sure the translator context is initialized return(TranslatorContext != null); }