Esempio n. 1
0
        /// <summary>
        /// Ported from: op_bool_tuple find_option(scope_t& scope, const string& name)
        /// </summary>
        public static Tuple <ExprOp, bool> FindOption(Scope scope, string name)
        {
            name = name.Replace('-', '_') + '_';
            ExprOp exprOp = scope.Lookup(SymbolKindEnum.OPTION, name);

            if (exprOp != null)
            {
                return(new Tuple <ExprOp, bool>(exprOp, true));
            }

            name = name.Remove(name.Length - 1);
            return(new Tuple <ExprOp, bool>(scope.Lookup(SymbolKindEnum.OPTION, name), false));
        }
Esempio n. 2
0
        /// <summary>
        /// Ported from: op_bool_tuple find_option(scope_t& scope, const string& name)
        /// </summary>
        public static Tuple <ExprOp, bool> FindOption(Scope scope, string name)
        {
            if (name != null && name.Length > 127)
            {
                throw new OptionError(String.Format(OptionError.ErrorMessage_IllegalOption, name));
            }

            name = name.Replace('-', '_') + '_';
            ExprOp exprOp = scope.Lookup(SymbolKindEnum.OPTION, name);

            if (exprOp != null)
            {
                return(new Tuple <ExprOp, bool>(exprOp, true));
            }

            name = name.Remove(name.Length - 1);
            return(new Tuple <ExprOp, bool>(scope.Lookup(SymbolKindEnum.OPTION, name), false));
        }
Esempio n. 3
0
        public ExprFunc LookForCommand(Scope scope, string verb)
        {
            ExprOp def = scope.Lookup(SymbolKindEnum.COMMAND, verb);

            if (def != null)
            {
                return(def.AsFunction);
            }
            else
            {
                return(Expr.EmptyFunc);
            }
        }