private SObject ExecuteImport(ScriptStatement statement) { // import apiClass from "moduleName" var exp = statement.Code; var parts = exp.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 4 || parts[0] != "import" || parts[2] != "from") { return(ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_INVALID_IMPORT_STATEMENT)); } var apiClass = parts[1]; var moduleName = exp.Remove(0, exp.IndexOf("\"")); moduleName = moduleName.Trim('\"'); if (!IsValidIdentifier(apiClass)) { return(ErrorHandler.ThrowError(ErrorType.SyntaxError, ErrorHandler.MESSAGE_SYNTAX_MISSING_VAR_NAME)); } var apiUsing = new SAPIUsing(apiClass, moduleName); Context.AddAPIUsing(apiUsing); return(apiUsing); }
internal void AddAPIUsing(SAPIUsing apiUsing) { if (!_apiUsings.ContainsKey(apiUsing.APIClass)) { _apiUsings.Add(apiUsing.APIClass, apiUsing); } }