Esempio n. 1
0
        public static bool MatchString(ref ParseState state, out string str)
        {
            var s = state;

            Blank(ref s);
            str = string.Empty;
            char openChar = s.Peek();

            if (openChar != '\'' && openChar != '"')
            {
                return(false);
            }
            s = s.Advance();
            while (s.Peek(0, openChar) != openChar)
            {
                str += s.Peek();
                s    = s.Advance();
            }
            if (!s.IsEnd)
            {
                s = s.Advance();
            }
            state = s;
            // Unescape
            str = XmlString.Unescape(str);
            return(true);
        }
Esempio n. 2
0
 public static void MatchTagContent(ref ParseState state, out string content)
 {
     content = string.Empty;
     while (!state.Matches("<") && !state.IsEnd)
     {
         content += state.Peek();
         state    = state.Advance();
     }
     // Unescape it
     content = XmlString.Unescape(content);
 }