Exemple #1
0
        //
        // RBBISymbolTable::parseReference   This function from the abstract symbol table interface
        //                                   looks for a $variable name in the source text.
        //                                   It does not look it up, only scans for it.
        //                                   It is used by the UnicodeSet parser.
        //
        public virtual string ParseReference(string text, ParsePosition pos, int limit)
        {
            int    start  = pos.Index;
            int    i      = start;
            string result = "";

            while (i < limit)
            {
                int c = UTF16.CharAt(text, i);
                if ((i == start && !UChar.IsUnicodeIdentifierStart(c)) ||
                    !UChar.IsUnicodeIdentifierPart(c))
                {
                    break;
                }
                i += UTF16.GetCharCount(c);
            }
            if (i == start)
            {                   // No valid name chars
                return(result); // Indicate failure with empty string
            }
            pos.Index = i;
            result    = text.Substring(start, i - start); // ICU4N: Corrected 2nd parameter
            return(result);
        }