Author Topic: C::B Lexers  (Read 5596 times)

sethjackson

  • Guest
C::B Lexers
« on: February 03, 2006, 02:12:15 am »
On this page it says HTML is not supported....

http://wiki.codeblocks.org/index.php?title=Languages_supported_by_Code::Blocks_lexers

The XML lexer handles the HTML styling too. Just check the filemasks int the XML lexer.....

So do I need to write a seperate HTML lexer or no? XML supports free form tags where as HTML doesn't so if you are coding HTML and you type a tag like this

Code: html
<asdf></asdf>

The XML lexer says OK that is fine, but in HTML that is not a valid tag...... So do we need to split the XML and HTML lexers into two seperate files (I think this would be a good idea)????

takeshimiya

  • Guest
Re: C::B Lexers
« Reply #1 on: February 03, 2006, 03:34:30 am »
Yes, XML and HTML need to be separated.

In SciTE for example, any keyword that is not on the html standard appears in red.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: C::B Lexers
« Reply #2 on: February 03, 2006, 09:56:53 am »
Having the xml lexer handle HTML is not worse than what any specialised HTML editor that I know of does, as far as syntax styling is concerned. If, however, you insist that this is not good enough, then you will have to accept that Code::Blocks will never support HTML.

Neither Code::Blocks nor SciTE are suitable tools for properly editing HTML, and will probably never be. One reason is of course the lack of a preview window, but the much more important and much more difficult issue is the correct syntax styling of tags.
Even among editors specialised on editing web content, there are few, if any, that really support HTML. In fact, most of them simply highlight everything inside < > and be done with it.

Quote
any keyword that is not on the html standard appears in red
The problem is that no such thing as "the standard" exists.
"HTML" comes in many different versions (for example 3.2, 4.01 transitional/strict/frames, and XHTML 1.0). Each of these defines different tags (or attributes) and makes one or the other thing legal or illegal, optional or mandatory.
To properly support HTML, you would have to do a lot more than list a few keywords in a lexer. One solution could be to run a validator (such as tidy) on the document first.
I know of no editor which is doing such a thing.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5494
Re: C::B Lexers
« Reply #3 on: February 03, 2006, 10:06:25 am »
nvu ?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: C::B Lexers
« Reply #4 on: February 03, 2006, 10:09:59 am »
Well... lol, yes. You'll agree that nvu is a little bit out of the scope of cbEditor's or SciTE's capabilities, though ;)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

takeshimiya

  • Guest
Re: C::B Lexers
« Reply #5 on: February 03, 2006, 02:01:42 pm »
I don't agree at all. I use SciTE for editing my web pages.
Also, there isn't any editor that haves a "preview window" that works reliably with CCS. Those apps like Dreamweaver, Nvu, Frontpage (!) are a thing of the past for me, they're very unreliable.

I work with SciTE + Firefox Web developer toolbar + Apache + PHP + Some CMS, and indeed I don't need anything more than that for web development.

I know of no editor which is doing such a thing.
Welcome to SciTE, it includes tidy. Altrough I don't know if it's used for the highlighting (probably not).

Whatever... if SciTE can do it, C::B can do it also, it's just a matter of clonning their lexer.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: C::B Lexers
« Reply #6 on: February 03, 2006, 03:01:37 pm »
Welcome to SciTE, it includes tidy. Altrough I don't know if it's used for the highlighting (probably not).
Whatever... if SciTE can do it, C::B can do it also, it's just a matter of clonning their lexer.
I don't need to answer to this? ;)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

takeshimiya

  • Guest
Re: C::B Lexers
« Reply #7 on: February 03, 2006, 09:31:43 pm »
On this page it says HTML is not supported....

http://wiki.codeblocks.org/index.php?title=Languages_supported_by_Code::Blocks_lexers

The XML lexer handles the HTML styling too. Just check the filemasks int the XML lexer.....

So do I need to write a seperate HTML lexer or no? XML supports free form tags where as HTML doesn't so if you are coding HTML and you type a tag like this

Code: html
<asdf></asdf>

The XML lexer says OK that is fine, but in HTML that is not a valid tag...... So do we need to split the XML and HTML lexers into two seperate files (I think this would be a good idea)????

What you're looking for is in SciTE's menu Options->Open html.properties. Beware that it includes keywords not only for HTML, but also for PHP, VXML, XML, DOCBOOK, JavaScript, etc.