コード例 #1
0
 internal UsualCompilation GetUsualCompiler(bool lVo)
 {
     if (Options.AllowOldStyleComments != lVo || usualCompiler == null)
     {
         options.AllowSingleQuotedStrings = lVo;
         usualCompiler  = new UsualCompilation(options);
         objectCompiler = null;
     }
     return(usualCompiler);
 }
コード例 #2
0
 internal ObjectCompilation GetObjectCompiler(bool lVo)
 {
     if (Options.AllowOldStyleComments != lVo || objectCompiler == null)
     {
         options.AllowSingleQuotedStrings = lVo;
         objectCompiler = ObjectCompilation.Create(options);
         usualCompiler  = null;
     }
     return(objectCompiler);
 }
コード例 #3
0
        public ICodeblock Compile(string macro)
        {
            ObjectCompilation compiler = GetObjectCompiler(true);
            var m = compiler.Compile(macro);

            if (m.Diagnostic != null)
            {
                throw m.Diagnostic;
            }
            return(new XSharp.MacroCompiler.ObjectMacro.MacroCodeblock(m.Macro, m.ParamCount));
        }
コード例 #4
0
        public ICodeblock Compile(string macro, bool lAllowSingleQuotes, Module module, out bool isCodeblock, out bool addsMemVars)

        {
            isCodeblock = macro.Replace(" ", "").StartsWith("{|");
            addsMemVars = false;
            ObjectCompilation compiler = GetObjectCompiler(lAllowSingleQuotes);
            var m = compiler.Compile(macro);

            if (m.Diagnostic != null)
            {
                throw m.Diagnostic;
            }
            if (m.CreatesAutoVars)
            {
                addsMemVars = false;
                return(new XSharp.MacroCompiler.ObjectMacro.MacroMemVarCodeblock(m.Macro, m.ParamCount));
            }
            else
            {
                return(new XSharp.MacroCompiler.ObjectMacro.MacroCodeblock(m.Macro, m.ParamCount));
            }
        }