A static class to provide attribute information about characters, e.g. determining whether or not it belongs to a number of predefined classes. This creates an array of every possible character with a uint that is a bitmap (of up to 32 possible values) This permits very fast access to this information since it only needs to be looked up via an index. Uses an array of 65536 uints = 256K of memory.
Ejemplo n.º 1
0
        /// <summary>
        /// Return true while the string is alphabetic, e.g. contains only letters.
        /// </summary>
        ///
        /// <param name="index">
        /// Zero-based index of the current position in the string.
        /// </param>
        /// <param name="character">
        /// The character at the current position.
        /// </param>
        ///
        /// <returns>
        /// True if the current character is valid for this pattern, false if not.
        /// </returns>

        public static bool Alpha(int index, char character)
        {
            return(CharacterData.IsType(character, CharacterType.Alpha));
        }
Ejemplo n.º 2
0
 public static bool Alphanumeric(int index, char character)
 {
     return(CharacterData.IsType(character, CharacterType.Alpha | CharacterType.NumberPart));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Test whether the character is an operator.
        /// </summary>
        ///
        /// <param name="index">
        /// Zero-based index of this character's position. Not used for this test.
        /// </param>
        /// <param name="character">
        /// The character.
        /// </param>
        ///
        /// <returns>
        /// true if it is an operator, false if it fails.
        /// </returns>

        public static bool Operator(int index, char character)
        {
            return(CharacterData.IsType(character, CharacterType.Operator));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// A matching function that validates
        /// </summary>
        ///
        /// <param name="index">
        /// Zero-based index of the.
        /// </param>
        /// <param name="character">
        /// The character.
        /// </param>
        ///
        /// <returns>
        /// true if it succeeds, false if it fails.
        /// </returns>

        public static bool PseudoSelector(int index, char character)
        {
            return(index == 0 ? CharacterData.IsType(character, CharacterType.Alpha) :
                   CharacterData.IsType(character, CharacterType.Alpha) || character == '-');
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Test whether the character is a bound character.
        /// </summary>
        ///
        /// <param name="index">
        /// Zero-based index of the current position in the string.
        /// </param>
        /// <param name="character">
        /// The character at the current position.
        /// </param>
        ///
        /// <returns>
        /// true if it succeeds, false if it fails.
        /// </returns>

        public static bool BoundChar(int index, char character)
        {
            return(CharacterData.IsType(character, CharacterType.Enclosing | CharacterType.Quote));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Test whether the character is a quote character.
        /// </summary>
        ///
        /// <param name="index">
        /// Zero-based index of the current position in the string.
        /// </param>
        /// <param name="character">
        /// The character at the current position.
        /// </param>
        ///
        /// <returns>
        /// true if it succeeds, false if it fails.
        /// </returns>

        public static bool QuoteChar(int index, char character)
        {
            return(CharacterData.IsType(character, CharacterType.Quote));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Test whether the character is whitespace.
        /// </summary>
        ///
        /// <param name="index">
        /// Zero-based index of the current position in the string. Not used for this test.
        /// </param>
        /// <param name="character">
        /// The character at the current position.
        /// </param>
        ///
        /// <returns>
        /// true if it is whitespace, false if it fails.
        /// </returns>

        public static bool NonWhitespace(int index, char character)
        {
            return(!CharacterData.IsType(character, CharacterType.Whitespace));
        }