Esempio n. 1
0
        public virtual void setRuleName(string ruleName)
        {
            string text = JSGFRuleName.stripRuleName(ruleName);

            this.fullRuleName = text;
            int num = String.instancehelper_lastIndexOf(text, 46);

            if (num < 0)
            {
                this.packageName       = null;
                this.simpleGrammarName = null;
                this.simpleRuleName    = text;
            }
            else
            {
                int num2 = String.instancehelper_lastIndexOf(text, 46, num - 1);
                if (num2 < 0)
                {
                    this.packageName       = null;
                    this.simpleGrammarName = String.instancehelper_substring(text, 0, num);
                    this.simpleRuleName    = String.instancehelper_substring(text, num + 1);
                }
                else
                {
                    this.packageName       = String.instancehelper_substring(text, 0, num2);
                    this.simpleGrammarName = String.instancehelper_substring(text, num2 + 1, num);
                    this.simpleRuleName    = String.instancehelper_substring(text, num + 1);
                }
            }
        }
Esempio n. 2
0
        public static bool isLegalRuleName(string name)
        {
            if (name == null)
            {
                return(false);
            }
            name = JSGFRuleName.stripRuleName(name);
            if (String.instancehelper_endsWith(name, ".*"))
            {
                name = String.instancehelper_substring(name, 0, String.instancehelper_length(name) - 2);
            }
            if (String.instancehelper_length(name) == 0)
            {
                return(false);
            }
            if (String.instancehelper_startsWith(name, ".") || String.instancehelper_endsWith(name, ".") || String.instancehelper_indexOf(name, "..") >= 0)
            {
                return(false);
            }
            StringTokenizer stringTokenizer = new StringTokenizer(name, ".");

            while (stringTokenizer.hasMoreTokens())
            {
                string text = stringTokenizer.nextToken();
                int    num  = String.instancehelper_length(text);
                if (num == 0)
                {
                    return(false);
                }
                for (int i = 0; i < num; i++)
                {
                    if (!JSGFRuleName.isRuleNamePart(String.instancehelper_charAt(text, i)))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 3
0
 public virtual bool isLegalRuleName()
 {
     return(JSGFRuleName.isLegalRuleName(this.fullRuleName));
 }