Example #1
0
        public static bool @Is(int c, YamlCharacterType type)
        {
            if (c == -1)
            {
                return(false);
            }
            char ch = Convert.ToChar(c);

            return(Is(ch, type));
        }
Example #2
0
        /// <summary>
        /// Parses a string of the given type
        /// </summary>
        /// <param name="type"></param>
        /// <returns>A string of the parsed characters or null if no matching characters are available for parsing</returns>
        public string ParseArray(YamlCharacterType type)
        {
            using (Marker mark = _reader.GetMarker())
            {
                int i = this._reader.ReadWhile(delegate(int c) { return(YamlCharacter.Is(c, type)); });

                if (i != 0)
                {
                    return(mark.GetString());
                }
                else
                {
                    return(null);
                }
            }
        }
Example #3
0
        public static bool @Is(char c, YamlCharacterType type)
        {
            switch (type)
            {
            case YamlCharacterType.Printable: return(IsPrintableChar(c));

            case YamlCharacterType.Word: return(IsWordChar(c));

            case YamlCharacterType.Line: return(IsLineChar(c));

            case YamlCharacterType.LineSP: return(IsLineSpChar(c));

            case YamlCharacterType.Space: return(IsSpaceChar(c));

            case YamlCharacterType.LineBreak: return(IsLineBreakChar(c));

            case YamlCharacterType.Digit: return(Char.IsDigit(c));

            case YamlCharacterType.Indent: return(c == ' ');

            default: return(false);
            }
        }