Hok's Macromedia Flash Blog

macromedia flash actionscript scripting, php, remoting, webservices, c#, javascript

Ads

Search

Question: Highlighting Code

Did anybody know a php-script which highlights code?
Maybe something with linenumbers?
regards, Holger

Posted by hOk at January 9, 2004 03:22 PM

Comments (16)

Posted by Jim Cheng at January 9, 2004 06:16 PM

hok, looks like you got a new design. nice!! i've not tried this, but google brought it up.

http://www.0php.com/PHP-source-code-utility.php

Posted by eokyere at January 9, 2004 07:14 PM

oops... beautifier is already up there... i missed it somehow

Posted by eokyere at January 9, 2004 07:16 PM

Thanks, i have totally missed that there is
a php-version of the beautifier.
Sadly it doesn't work correctly to me :-(

regards, Holger

Posted by hOk at January 10, 2004 02:03 PM

Test - actionscript

//////////////////////////////////////////////////////////////////////////////
//
// Function.prototype.callWith
// ===========================
//
// example:
// function test (a, b) { trace("a: " + a + " b: " + b); }
// test_2_3 = test.callWith(2, 3);
// test_2_3(); // output: "a: 2 b: 3"
//
//////////////////////////////////////////////////////////////////////////////
Function.prototype.callWith = function () {
var a = arguments;
var f = this;
return function () {
f.apply(null, a);
};
};

Posted by hOk at January 10, 2004 02:09 PM

I found the bug, it was my fault...;-)
I use preg_replace with the e-Option, which
means that php-code would be executed in the
replacement.
The Problem is the implicit escaping of the
quotes.

Example

function solve ($v) { die($v); }
$content = "Paul 'test' paul";
$content = preg_replace('|.*|es', "solve(\"$0\")", $content);


Output
Paul \'test\' paul

Posted by hOk at January 10, 2004 02:43 PM

preg_replace_callback is our friend, if we don't
want the implicit escaping.

Posted by hOk at January 10, 2004 02:55 PM

Dear hOK,

I'm working on one(with AS2 support). I will let you know once done

Regards,
Arul

Posted by Arul Kumaran at January 11, 2004 07:41 AM

Thanks,
that would be great,
regards, Holger

Posted by hOk at January 11, 2004 12:35 PM

Dear hOK,

Please help me to find the bugs in

http://www.shockwave-india.com/blog/services/as-highlight2/

By testing it with AS2 code

I can pass the PHP file once the bugs are fixed

Regards,
Arul

Posted by Arul at January 11, 2004 05:11 PM

Hi Holger
Do you only need a AS beautifier in php ?
I have a php file which works excellent - given from a flashforum member - you can call the script
with an "calle" argument like in c++

so you can call it in this way:
myHighlighter.php myAs.as

without any get or post methods (remember calle)

This Script is very fast - but it works only with completely as files...yout can`t highlight parts of a Side with it...

If you need it - send me an e-mail
regards
nky

Posted by nky at January 16, 2004 03:54 PM

hok, i just realized you have code tags enabled for comments... i'm just testing it out with this post, meanwhile, what's the hack?


var str = "testing hok's hack";
this.name = str;
trace(str);

Posted by eokyere at January 26, 2004 04:19 PM

eokyere, i use the the php-version of beautifier
http://www.beautifier.org/ there is also an
plugin for mt. You find the links in the
"Powered by"-section.

Posted by hOk at January 26, 2004 11:36 PM

what about an actionscript version of an actionscript highlighter? Any leads :-)

-m

Posted by macromike at February 1, 2004 07:29 AM

that is, one that in a published swf file could format a block of text to look like code in the actionscript editor. I'm working on one now for a flash windowSWF codebank, but it's not an easy task :)

I can parse comments well. I can parse quotes well. I can parse reserved words well. It's just putting it all together that gets tricky. Any help would be great.

Thanks-
-m

Posted by macromike at February 1, 2004 07:31 AM

Hehe, you have to count which occures first,
regards, Holger

Posted by hOk at February 1, 2004 09:58 AM


Name:


Email Address:


URL:


Comments:



You can use <code>code that should be highlightned</code> to highlight code!
Optionally you can use the attribut language="php|perl|java" within the code tag, otherwise
actionscript-highlightning will be used.

New Place