/// <summary>
        /// Initializes a new instance of the <see cref="UvssLexerStream"/> class.
        /// </summary>
        /// <param name="lexer">The lexer instance which produces tokens for this stream.</param>
        internal UvssLexerStream(UvssLexer lexer)
        {
            Contract.Require(lexer, nameof(lexer));

            this.lexer = lexer;
            this.linePositions.Add(0);
        }
예제 #2
0
        /// <summary>
        /// Tokenizes the specified Ultraviolet StyleSheets (UVSS) string.
        /// </summary>
        /// <param name="source">The source string to tokenize.</param>
        /// <param name="options">The lexer's configurable options, or null to use the default options.</param>
        /// <returns>A <see cref="UvssLexerStream"/> instance which produces lexed tokens from the specified source text.</returns>
        public static UvssLexerStream Tokenize(String source, UvssLexerOptions options = null)
        {
            Contract.Require(source, nameof(source));

            var instance = new UvssLexer(source, options ?? UvssLexerOptions.Default);

            return(new UvssLexerStream(instance));
        }