Re: Syntax highlighting of odd language

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Aaron,

why don't you use a very simle sintax like this one:

$code = 'function what() { do oddname; %oddsyntax }';

function highlight_code($code)
{
$oddsyntax = array('oddsyntax','oddsyntax2','oddsyntax3');

for($i = 0; $i <= count($oddsyntax)-1; $i++)
{
$highlighted_code = eregi_replace($oddsyntax[$i],'<spam class="highlighted">'.$oddsyntax[$i].'</spam>',$code);
}
return $code;
}


echo highlight_code($code);


Regards, Bruno B B Magalhães

On Nov 5, 2004, at 6:39 PM, Aaron Gould wrote:

Could any of you privide some leads in regard to highlighting syntax of an odd language? I have a large amount of snippits of legacy code from our company's primary application. The code used is "BBx" (a variant of Basic).

I'm attempting to show this code on a web page, but with highlighting of keywords and variables/numbers. I've already got a list of the language's 250-odd keywords in a file.

I saw a "Text_Highlighter" PEAR class, but that seems to only do a bunch of predefined popular languages (ie. SQL, PHP, C).

Please don't ruin my Friday afternoon and tell me I'll need to dig into regular expressions..... :)

--
Aaron Gould
Parts Canada - Web Developer

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux