/// <summary> /// load_namespace : KW_USING STRING (KW_AS IDENTIFIER)? ; /// </summary> override public Shell.Types.IShellReturnable VisitLoad_namespace(ShellParser.Load_namespaceContext context) { var ctx_str = context.STRING(); var ctx_id = context.IDENTIFIER(); var name = Utility.GetString(ctx_str.GetText(), this); var ns = Utility.LoadNamespace( name.contents, ctx_id != null ? ctx_id.GetText() : "", this ); if (state.Names.DefinedAs(ns.name, typeof(Shell.Types.Namespace))) { logger.Debug($"Overwriting namespace {ns.name}"); } state.Namespaces.Register(ns); return(defaultReturnValue); }
/// <summary> /// Visit a parse tree produced by <see cref="ShellParser.load_namespace"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitLoad_namespace([NotNull] ShellParser.Load_namespaceContext context) { return(VisitChildren(context)); }