/// <summary> /// Executes the using. /// </summary> public override object DoEvaluate(IAstVisitor visitor) { var source = Source; // Case 1: System namespace if (source.StartsWith("sys")) { // TODO: Register the types found in the sys.namespace. } // Case 2: Relative file path else if (source.StartsWith("..")) { // TODO: Get absolute path of file } // Case 3: Absolution file path from root else if (source.StartsWith("\\")) { // TODO: Get absolute path of file } // Case 4: Envrionment variable path else if (source.StartsWith("env")) { // TODO: Get absolute path of file } // Case 5: File path else { if (!File.Exists(source)) { throw new FileNotFoundException("File : " + source + " does not exist"); } } var script = global::System.IO.File.ReadAllText(source); Context ctx = null; var scriptParser = new Lib.Parser.Parser(ctx); scriptParser.Parse(script); Lib.Parser.Parser parser = null; parser.Statements.AddRange(scriptParser.Statements); return(LObjects.Null); }
/// <summary> /// Executes the using. /// </summary> public override object DoEvaluate(IAstVisitor visitor) { var source = Source; // Case 1: System namespace if (source.StartsWith("sys")) { // TODO: Register the types found in the sys.namespace. } // Case 2: Relative file path else if (source.StartsWith("..")) { // TODO: Get absolute path of file } // Case 3: Absolution file path from root else if (source.StartsWith("\\")) { // TODO: Get absolute path of file } // Case 4: Envrionment variable path else if (source.StartsWith("env")) { // TODO: Get absolute path of file } // Case 5: File path else { if (!File.Exists(source)) throw new FileNotFoundException("File : " + source + " does not exist"); } var script = global::System.IO.File.ReadAllText(source); Context ctx = null; var scriptParser = new Lib.Parser.Parser(ctx); scriptParser.Parse(script); Lib.Parser.Parser parser = null; parser.Statements.AddRange(scriptParser.Statements); return LObjects.Null; }