Esempio n. 1
0
 public ParserValue(ParserValue parserValue)
 {
     Text   = parserValue.Text;
     Leng   = parserValue.Leng;
     Loc    = parserValue.Loc;
     LineNo = parserValue.LineNo;
 }
Esempio n. 2
0
        public ParserValue Clone()
        {
            var parserValue = new ParserValue();

            parserValue.Text = this.Text;


            return(parserValue);
        }
Esempio n. 3
0
 public void SetValue(ParserValue value)
 {
     m_value = value;
 }
Esempio n. 4
0
 /// <summary>
 /// Read the string up to any <see cref="Rune"/> that is included in <paramref name="chars"/> or until EOF is reached.
 /// The matched character is put in <paramref name="matched"/>.
 /// </summary>
 /// <param name="parser">A parser on which to operate.</param>
 /// <param name="chars">The characters to find in the stream</param>
 /// <param name="matched">The character that was finally matched, or 0 if the end of the stream was reached.</param>
 /// <returns>A parser string containing the read characters.</returns>
 public static ParserString ReadUntilAny(this ITextParser parser, char[] chars, out ParserValue match)
 {
     return(parser.ReadUntilAny(chars.Select(c => new Rune(c)).ToArray(), out match));
 }
Esempio n. 5
0
 /// <summary>
 /// Read the string up to the <see cref="Rune"/> where <paramref name="matcher"/> returns true or until EOF is reached.
 /// The matched character is put in <paramref name="matched"/>.
 /// </summary>
 /// <param name="parser">A parser on which to operate.</param>
 /// <param name="matcher">A predicate to test for when to terminate the read.</param>
 /// <param name="matched">The character that was finally matched, or 0 if the end of the stream was reached.</param>
 /// <returns>A parser string containing the read characters.</returns>
 public static ParserString ReadUntil(this ITextParser parser, Predicate <Rune> matcher, out ParserValue matched)
 {
     return(parser.ReadUntil(matcher, null, out matched));
 }
Esempio n. 6
0
 /// <summary>
 /// Read the string up to the <see cref="Rune"/> where <paramref name="matcher"/> returns false or until EOF is reached.
 /// The matched character is put in <paramref name="matched"/>.
 /// If <paramref name="escape"/> is set to a non-null value, the character immediately following the escape-character
 /// is always matched, even if <paramref name="matcher"/> returns false.
 /// </summary>
 /// <param name="parser">A parser on which to operate.</param>
 /// <param name="matcher">A predicate that receives a <see cref="Rune"/> and returns whether to continue reading.</param>
 /// <param name="escape">A character to use to escape the matched character, or null to not allow escaping of characters.</param>
 /// <param name="matched">The character that was finally matched, or 0 if the end of the stream was reached.</param>
 /// <returns>A parser string containing the read characters.</returns>
 public static ParserString ReadWhile(this ITextParser parser, Predicate <Rune> matcher, Rune?escape, out ParserValue matched)
 {
     return(parser.ReadUntil(r => !matcher(r), escape, out matched));
 }
Esempio n. 7
0
 /// <summary>
 /// Read the string up to any <see cref="Rune"/> that is included in <paramref name="runes"/> or until EOF is reached.
 /// The matched character is put in <paramref name="matched"/>.
 /// </summary>
 /// <param name="parser">A parser on which to operate.</param>
 /// <param name="runes">The runes to find in the stream</param>
 /// <param name="matched">The character that was finally matched, or 0 if the end of the stream was reached.</param>
 /// <returns>A parser string containing the read characters.</returns>
 public static ParserString ReadUntilAny(this ITextParser parser, Rune[] runes, out ParserValue match)
 {
     return(parser.ReadUntil(runes.Contains, out match));
 }
Esempio n. 8
0
 public void SetValue(ParserValue value)
 {
     m_value = value;
 }