1
Vote

"using" keyword does not parse namespaces with "." symbols

description

using System; //valid syntax
using System.NET; // throws exception "Syntax error on ".", state 46, expecting: SC"
 
Unit test (currently failing on v0.2.0
 
[Test]
public void LoadAssemblyTests()
{
bool hasError = false;
try
{
    ScriptRuntime runtime = ScriptRuntime.Create();
    runtime.LoadAssembly(typeof(string).Assembly);
    runtime.LoadAssembly(typeof(System.Web.UI.WebControls.TextBox).Assembly);

    ScriptScope globals = runtime.CreateScope();
    ScriptEngine scriptEngine = runtime.GetEngine(typeof(MyJScript.DLR.MJSLanguageContext));
    string command = "using System.Web;";
    ScriptSource src = scriptEngine.CreateScriptSourceFromString(command, SourceCodeKind.Statements);
    src.Execute(globals);
}
catch (Exception ex)
{
    hasError = true;
    Console.WriteLine(ex.Message);
}
finally
{
    Assert.IsFalse(hasError);
}
}

comments