Bug in XML tokenizer

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Bug in XML tokenizer

Postby preditcon » Thu Feb 16, 2012 12:34 pm

The following gets tokenized in a wrong way, resulting in wrong syntax coloring:

Code: Select all
<!DOCTYPE greeting [
  <!ELEMENT greeting (#PCDATA)>
]>


The tokenizer recognizes these tokens:

Code: Select all
========= TOKENS =========
[Token: text: '<!DOCTYPE greeting ['; offset: 0; type: 5; isPaintable: true; nextToken==null: true]
[Token: text: '  <!ELEMENT greeting (#PCDATA)>'; offset: 21; type: 5; isPaintable: true; nextToken==null: false]
[Token: <null token>]
[Token: text: ']>'; offset: 53; type: 15; isPaintable: true; nextToken==null: false]
[Token: <null token>]
==========================


Which is clearly incorrect. The "]>" is also a part of doctype. I know it's an obscure case, but the example is an exact copy/paste from XML 1.0 specification.
preditcon
 
Posts: 27
Joined: Wed Jan 25, 2012 10:09 am

Re: Bug in XML tokenizer

Postby robert » Thu Feb 16, 2012 1:50 pm

Thanks, add a bug tracker so I don't forget it. I can probably fix this in 2.0.1, which should be soon. As usual, I found an issue I wanted to fix in 2.0.0 right after it was released (we should expand code folds when a search/replace operation matches text in a collapsed fold).

Longer-term I plan to add highlighting for DTD's, but as a first pass the entire DOCTYPE element will likely just be highlighted one color. Better than nothing, right? :D
User avatar
robert
 
Posts: 788
Joined: Sat May 10, 2008 5:16 pm

Re: Bug in XML tokenizer

Postby robert » Sat Feb 18, 2012 12:29 am

Fixed in SVN commit 410. As an added bonus, hyperlinks are also now highlighted in XML comments.
User avatar
robert
 
Posts: 788
Joined: Sat May 10, 2008 5:16 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron