Class TextReaderExtensions
- Namespace
- PAC.Extensions
public static class TextReaderExtensions
- Inheritance
-
TextReaderExtensions
- Inherited Members
Methods
ReadMatch(TextReader, IEnumerable<char>)
Reads, checking if it reads the given sequence of characters (starting at the current point). Returns the characters it matched before it found a non-match. Doesn't reach the non-match character / the next character after all have characters been matched.
public static string ReadMatch(this TextReader reader, IEnumerable<char> text)
Parameters
reader
TextReadertext
IEnumerable<char>
Returns
Exceptions
- EndOfStreamException
If there is nothing left for the reader to read at the start of the method.
ReadMatch(TextReader, IEnumerable<ICollection<char>>)
Reads, checking if the first read character is in the first collection of characters, then if the second is in the second collection, etc. until all character collections have been matched or until a character doesn't match. Returns the characters it matched before it found a non-match. Doesn't reach the non-match character / the next character after all have characters been matched.
public static string ReadMatch(this TextReader reader, IEnumerable<ICollection<char>> charSets)
Parameters
reader
TextReadercharSets
IEnumerable<ICollection<char>>
Returns
Exceptions
- EndOfStreamException
If there is nothing left for the reader to read at the start of the method.
ReadMatch(TextReader, IEnumerable<Func<char, bool>>)
Reads, checking if the first read character satisfies the first match condition, then if the second matches the second condition, etc. until all character collections have been matched or until a character doesn't match. Returns the characters it matched before it found a non-match. Doesn't reach the non-match character / the next character after all have characters been matched.
public static string ReadMatch(this TextReader reader, IEnumerable<Func<char, bool>> matchConditions)
Parameters
reader
TextReadermatchConditions
IEnumerable<Func<char, bool>>
Returns
Exceptions
- EndOfStreamException
If there is nothing left for the reader to read at the start of the method.
ReadMatch(TextReader, string)
Reads, checking if it reads the given string (starting at the current point). Returns the characters it matched before it found a non-match. Doesn't reach the non-match character / the next character after all have characters been matched.
public static string ReadMatch(this TextReader reader, string text)
Parameters
reader
TextReadertext
string
Returns
Exceptions
- EndOfStreamException
If there is nothing left for the reader to read at the start of the method.
ReadMatchAll(TextReader, IEnumerable<char>)
Reads, checking if it reads the given sequence of characters (starting at the current point).
public static bool ReadMatchAll(this TextReader reader, IEnumerable<char> text)
Parameters
reader
TextReadertext
IEnumerable<char>
Returns
Exceptions
- EndOfStreamException
If there is nothing left for the reader to read at the start of the method.
ReadMatchAll(TextReader, IEnumerable<ICollection<char>>)
Reads, checking if the first read character is in the first collection of characters, then if the second is in the second collection, etc. until all character collections have been matched. Doesn't reach the non-match character / the next character after all have characters been matched.
public static bool ReadMatchAll(this TextReader reader, IEnumerable<ICollection<char>> charSets)
Parameters
reader
TextReadercharSets
IEnumerable<ICollection<char>>
Returns
Exceptions
- EndOfStreamException
If there is nothing left for the reader to read at the start of the method.
ReadMatchAll(TextReader, string)
Reads, checking if it reads the given string (starting at the current point). Doesn't reach the non-match character / the next character after all have characters been matched. Doesn't reach the non-match character / the next character after all have characters been matched.
public static bool ReadMatchAll(this TextReader reader, string text)
Parameters
reader
TextReadertext
string
Returns
Exceptions
- EndOfStreamException
If there is nothing left for the reader to read at the start of the method.
TryReadIntoChar(TextReader, ref char)
If the TextReader can read another character, it will read it into chr and return true. Otherwise, it will return false without changing chr and without reading.
public static bool TryReadIntoChar(this TextReader reader, ref char chr)
Parameters
reader
TextReaderchr
char