Esempio n. 1
0
 internal Comment(Token.Comment comment)
 {
     Line   = comment.Line;
     Column = comment.Column;
     Type   = GetCommentType(comment.TypeChar);
     Value  = comment.Value;
 }
Esempio n. 2
0
        private Token.Comment LexComment()
        {
            var comment = new Token.Comment();

            // Eat the '#'
            Read();

            // Determine the comment type
            var c = Peek();

            switch (c)
            {
            case '.': comment.Type = CommentType.Extracted; break;

            case ':': comment.Type = CommentType.Reference; break;

            case ',': comment.Type = CommentType.Flag; break;

            case '|': comment.Type = CommentType.PreviousContext; break;

            case '~': comment.Type = CommentType.ObsoleteMessage; break;

            default: comment.Type = CommentType.Translator; break;
            }

            // Eat the one of four comment type characters from above
            if (comment.Type != CommentType.Translator)
            {
                Read();
            }

            // Eat whitespace and then start accumulating the comment value
            EatWhitespace();

            while ((c = Read()) != '\n')
            {
                PushString(c);
            }

            comment.Value = PopString();
            return(comment);
        }
Esempio n. 3
0
        private Token.Comment LexComment()
        {
            var comment = new Token.Comment ();

            // Eat the '#'
            Read ();

            // Determine the comment type
            var c = Peek ();
            switch (c) {
                case '.': comment.Type = CommentType.Extracted; break;
                case ':': comment.Type = CommentType.Reference; break;
                case ',': comment.Type = CommentType.Flag; break;
                case '|': comment.Type = CommentType.PreviousContext; break;
                case '~': comment.Type = CommentType.ObsoleteMessage; break;
                default: comment.Type = CommentType.Translator; break;
            }

            // Eat the one of four comment type characters from above
            if (comment.Type != CommentType.Translator) {
                Read ();
            }

            // Eat whitespace and then start accumulating the comment value
            EatWhitespace ();

            while ((c = Read ()) != '\n') {
                PushString (c);
            }

            comment.Value = PopString ();
            return comment;
        }
        internal static HtmlProcessingInstruction Create(DomDocument doc, Token.Comment commentToken)
        {
            string fullContent = commentToken.Data.Substring(1, commentToken.Data.Length - 2);

            return(FromFullContent(doc, fullContent));
        }
Esempio n. 5
0
 internal override void Read(Tokeniser t, CharacterReader r)
 {
     // todo: handle bogus comment starting from eof. when does that trigger?
     // rewind to capture character that lead us here
     r.Unconsume();
     Token.Comment comment = new Token.Comment();
     comment.bogus = true;
     comment.data.Append(r.ConsumeTo('>'));
     // todo: replace nullChar with replaceChar
     t.Emit(comment);
     t.AdvanceTransition(TokeniserState.Data);
 }