Пример #1
0
        public CAutoComplete.ACRet CodeCompletion(string linetext, int x_pos, int cctype)
        {
            if (cctype == 0)
            {
                Regex asdf = new Regex(@"\s*(\b[A-Z_][A-Z0-9_]*\b)\s*\(", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
                Match mt   = asdf.Match(linetext, x_pos);

                //return (mt.Value.Split('(')[0].ToString());
            }
            else if (cctype == 1)
            {
                Regex asdf = new Regex(@"\s*?(%|\$\b[A-Z_][A-Z0-9_]*\b)?(\.)?(\b[A-Z_][A-Z0-9_]*\b)?(\b::\b)?(\b[A-Z_][A-Z0-9_]*\b).*?(?>[^()]+|\)(?<DEPTH>)|\((?<-DEPTH>))*(?(DEPTH)(?!))", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
                Match mt   = asdf.Match(linetext, x_pos);

                if (mt.Success == false)
                {
                    asdf = new Regex(@"\s*?(%|\$\b[A-Z_][A-Z0-9_]*\b)?(\.)?(\b[A-Z_][A-Z0-9_]*\b)\s*\(", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
                    mt   = asdf.Match(linetext, x_pos);
                }

                //return (mt.Value.Split('(')[0].ToString());
                CAutoComplete.ACRet ret = new CAutoComplete.ACRet();
                ret.FunctionName = mt.Groups[5].Value;
                ret.ObjectName   = mt.Groups[3].Value;
                ret.VariableName = mt.Groups[1].Value;

                return(ret);
            }
            else
            {
                //return "";
            }

            return(null);
        }
Пример #2
0
        public CAutoComplete.ACRet CodeCompletion(string linetext, int x_pos, int cctype)
        {
            if (cctype == 0) {
                Regex asdf = new Regex(@"\s*(\b[A-Z_][A-Z0-9_]*\b)\s*\(", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
                Match mt = asdf.Match(linetext, x_pos);

                //return (mt.Value.Split('(')[0].ToString());
            } else if (cctype == 1) {

                Regex asdf = new Regex(@"\s*?(%|\$\b[A-Z_][A-Z0-9_]*\b)?(\.)?(\b[A-Z_][A-Z0-9_]*\b)?(\b::\b)?(\b[A-Z_][A-Z0-9_]*\b).*?(?>[^()]+|\)(?<DEPTH>)|\((?<-DEPTH>))*(?(DEPTH)(?!))", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
                Match mt = asdf.Match(linetext, x_pos);

                if (mt.Success == false) {
                    asdf = new Regex(@"\s*?(%|\$\b[A-Z_][A-Z0-9_]*\b)?(\.)?(\b[A-Z_][A-Z0-9_]*\b)\s*\(", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
                    mt = asdf.Match(linetext, x_pos);
                }

                //return (mt.Value.Split('(')[0].ToString());
                CAutoComplete.ACRet ret = new CAutoComplete.ACRet();
                ret.FunctionName = mt.Groups[5].Value;
                ret.ObjectName = mt.Groups[3].Value;
                ret.VariableName = mt.Groups[1].Value;

                return ret;
            } else {
                //return "";
            }

            return null;
        }