Ejemplo n.º 1
0
        protected LanguageTempCodeCompiler(IronyAst rootAst, LanguageCompilationLog compilationLog)
        {
            var textCodeUnit = new LanguageCodeText("", "");

            CodeUnit          = textCodeUnit;
            RootAst           = rootAst;
            CompilationLog    = compilationLog ?? new LanguageCompilationLog(textCodeUnit, Progress);
            TranslatorContext = null;
        }
Ejemplo n.º 2
0
        internal LanguageCodeTextLine(LanguageCodeText parentTextSourceCode, int lineNumber, int firstCharPos, int charCount)
        {
            ParentTextCodeUnit = parentTextSourceCode;

            LineNumber = lineNumber;

            FirstCharacterPosition = firstCharPos;

            CharactersCount = charCount;
        }
Ejemplo n.º 3
0
        /// <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);
        }