Help me test my syntax highlighter

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Help me test my syntax highlighter

Post by jraede »

I decided that it would help me to document projects to have a syntax highlighter that worked for more than one language at once, so after searching for a while (I'm willing to bet that someone knows of one that I didn't find, but hey, it turned out pretty well), I made one myself. It separates and highlights HTML, JavaScript, PHP, and CSS.

It's still in alpha stages and I would love if people who work with a lot of code could help me test it out.

Check it out at http://www.tavorinteractive.com/syntax-highlighter/

Thanks!
Last edited by jraede on Fri Oct 28, 2011 4:00 pm, edited 1 time in total.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Help me test my syntax highlighter

Post by twinedev »

Tried the following, it lost some of it...

Code: Select all

<html>
<head><title>Test here</title></head>
<body>
  <h1><?= $heading ?></h1>
  <? $var = 'Hello'; ?>
  <table>
   <tr>
     <td><?php echo $var;,"</td></tr>"; ?>
  </table>
</body>
</html>
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Re: Help me test my syntax highlighter

Post by jraede »

K, I gotta add the <? ?> shorthand syntax. Did it lose anything else besides what was in those tags?

Edit: I guess I can test that as well, going over it now.

Edit 2: whoops, forgot to make it recognize table tags as valid HTML. Knew I missed something big. Thanks for the heads up
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Help me test my syntax highlighter

Post by flying_circus »

Looks like it also struggles on certain matches.

For example: print and int

The "pr" part of print is one color while the "int" part is another. I assume this is because it found the keywork "int" and thought it was a declaration or cast.

Overall though, it looks great. Seems to work pretty fast in my limited use. Nice work :)
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Re: Help me test my syntax highlighter

Post by jraede »

Updated with all valid HTML tags and <? ?> PHP shorthand. I'm working on a solution for pr(int) and other such problems, it should be good to go soon. I also found a bug in which something like

Code: Select all

$string = "The string is '".$variable."'.";
...would first parse the stuff in between the single-quotes, thinking it's a normal string, and then the stuff in the double quotes, so the variable would get colorized as if it's in a string.

@flying_circus, thanks for checking it out, glad you like it.
Post Reply