A ScriptContainer contains a script of a given language.
示例#1
0
        public void Compile()
        {
            string testScript = "alias test {\n  echo -a Hallo $left($me, 1) $+ .\n }\nalias -l coolHu { echo -a private! }";
            TextReader reader = new StringReader(testScript);
            Parser p = new Parser();
            CodeCompileUnit result = p.Parse(reader);
            ScriptContainer container = new ScriptContainer("Extensions\\", "test");
            container.ScriptDom = result;

            // container.Compile();
        }
示例#2
0
 /// <summary>
 /// Compiles the given msl script string to a Script instance.
 /// </summary>
 /// <param name="script">The string to interpret as a msl script.</param>
 /// <returns></returns>
 public ScriptContainer Compile(string name, string source, string binPathes)
 {
     ScriptContainer result = new ScriptContainer(binPathes, name);
     Parser mslParser = new Parser();
     mslParser.ScriptName = name;
     StringReader reader = new StringReader(source);
     CodeCompileUnit unit = mslParser.Parse(reader);
     reader.Close();
     result.ScriptDom = unit;
     result.Compile(name, this);
     return result;
 }
示例#3
0
 /// <summary>
 /// Compiles the given msl script file to a Script instance.
 /// </summary>
 /// <param name="file">The file to compile.</param>
 /// <returns>The compiled script.</returns>
 public ScriptContainer Compile(System.IO.FileInfo file, string binPathes)
 {
     ScriptContainer result = new ScriptContainer(binPathes, file.Name);
     Parser mslParser = new Parser();
     StreamReader reader = new StreamReader(file.OpenRead(), System.Text.Encoding.Default, false);
     CodeCompileUnit unit = mslParser.Parse(reader);
     reader.Close();
     result.ScriptDom = unit;
     result.Compile(file.Name, this);
     return result;
 }