private IToken TryGetComment()
        {
            // Consume the first character which must have been a #
            ConsumeCharacter();

            // Consume everything up till we hit the new line
            char next = Peek();

            while (next != '\n' && next != '\r')
            {
                if (Syntax == NTriplesSyntax.Original && next > 127)
                {
                    throw Error("Non-ASCII characters are not permitted in Original NTriples, please set the Syntax to Rdf11 to support characters beyond the ASCII range");
                }
                if (ConsumeCharacter(true))
                {
                    break;
                }
                next = Peek();
            }

            // Create the Token, discard the new line and return
            LastTokenType = Token.COMMENT;
            CommentToken comment = new CommentToken(Value, CurrentLine, StartPosition, EndPosition);

            ConsumeNewLine(false, true);
            return(comment);
        }
        /// <summary>
        /// Internal Helper method which attempts to get a Comment Token.
        /// </summary>
        /// <returns></returns>
        private IToken TryGetCommentToken()
        {
            char next = Peek();

            // Grab characters until we hit the new line
            while (next != '\n' && next != '\r')
            {
                if (ConsumeCharacter(true))
                {
                    break;
                }
                next = Peek();
            }

            // Discard New line and reset position
            CommentToken comment = new CommentToken(Value, CurrentLine, StartPosition, EndPosition);

            ConsumeNewLine(false, true);
            return(comment);
        }
Esempio n. 3
0
        private IToken TryGetComment()
        {
            //Consume the first character which must have been a #
            this.ConsumeCharacter();

            //Consume everything up till we hit the new line
            char next = this.Peek();

            while (next != '\n' && next != '\r')
            {
                if (this.ConsumeCharacter(true))
                {
                    break;
                }
                next = this.Peek();
            }

            //Create the Token, discard the new line and return
            this._lasttokentype = Token.COMMENT;
            CommentToken comment = new CommentToken(this.Value, this.CurrentLine, this.StartPosition, this.EndPosition);

            this.ConsumeNewLine(false, true);
            return(comment);
        }
        private IToken TryGetComment()
        {
            //Consume the first character which must have been a #
            this.ConsumeCharacter();

            //Consume everything up till we hit the new line
            char next = this.Peek();
            while (next != '\n' && next != '\r')
            {
                if (this.ConsumeCharacter(true)) break;
                next = this.Peek();
            }

            //Create the Token, discard the new line and return
            this.LastTokenType = Token.COMMENT;
            CommentToken comment = new CommentToken(this.Value, this.CurrentLine, this.StartPosition, this.EndPosition);
            this.ConsumeNewLine(false, true);
            return comment;
        }
        /// <summary>
        /// Internal Helper method which attempts to get a Comment Token
        /// </summary>
        /// <returns></returns>
        private IToken TryGetCommentToken()
        {
            char next = this.Peek();

            //Grab characters until we hit the new line
            while (next != '\n' && next != '\r')
            {
                if (this.ConsumeCharacter(true)) break;
                next = this.Peek();
            }

            //Discard New line and reset position
            CommentToken comment = new CommentToken(this.Value, this.CurrentLine, this.StartPosition, this.EndPosition);
            this.ConsumeNewLine(false, true);
            return comment;
        }