示例#1
0
        private bool ReadPropertyValue()
        {
            char[] delimiters = options.AllowComments ? new char[] { ';', '\r', '\n' } : new char[] { '\r', '\n' };
            string value      = ReadUntilAny(delimiters, allowEscapeSequences: true);

            if (options.Unescape)
            {
                value = IniDocument.Unescape(value);
            }

            // Whitespace surrounding property values is ignored.

            tokens.Enqueue(new IniLexerToken(IniLexerTokenType.PropertyValue, value.Trim()));

            return(true);
        }
示例#2
0
        private bool ReadSectionName()
        {
            string value = ReadUntilAny(new char[] { ']', '\r', '\n' }, allowEscapeSequences: true);

            if (options.Unescape)
            {
                value = IniDocument.Unescape(value);
            }

            // Whitespace surrounding section names is ignored.

            tokens.Enqueue(new IniLexerToken(IniLexerTokenType.SectionName, value.Trim()));

            // If we reached the end of the line rather than the end of the section, the section was not closed.

            if (PeekCharacter()?.IsNewLine() ?? false)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        private bool ReadPropertyName()
        {
            char[] delimiters = options.AllowComments ? new char[] { '=', ';', '\r', '\n' } : new char[] { '=', '\r', '\n' };
            string value      = ReadUntilAny(delimiters, allowEscapeSequences: true);

            if (options.Unescape)
            {
                value = IniDocument.Unescape(value);
            }

            // Whitespace surrounding property names is ignored.

            tokens.Enqueue(new IniLexerToken(IniLexerTokenType.PropertyName, value.Trim()));

            // If we reached the end of the line rather than the end of the property, the property does not have a value.

            if (PeekCharacter()?.IsNewLine() ?? false)
            {
                return(false);
            }

            return(true);
        }