AuthorMessage
Meka][Meka
Unstopable
Posts: 700

hi everyone... ok i've been working on a script to implement the geshi syntax highlighting on the forum... all the mods i found were shit, so i've came up with some routines to implement a non modded version of geshi.... now ive designed it to detect which programming language code is written in.. only problem is, i cant think of ways of detecting which languages code is in..... ive came up with some, but others need feedbak, so good ways and fast ways of detecting language.... any feedback will be welcomed...
Nina
Ametuar
Posts: 134

hi,
 i'm suggesting you try to detect the code language by file extensions, this means if a file has a php extension it is a php file. etc. i think it works now Meka, thank you :wink:  Nina
Meka][Meka
Unstopable
Posts: 700

lolm uhm.. problem is if you post code on the site, it doesnt have a file extension ... lol
Nina
Ametuar
Posts: 134

Meka, try searching google. and that image doesn't suits you with your imago .. i think
http://www.oisyn.nl/articles.php/11
Meka][Meka
Unstopable
Posts: 700

huh what 'imago'  and why search google, i've already implemented a code syntax displayer.
Nina
Ametuar
Posts: 134

you are talking about real languages? noo, this is not easy or fast. you should create a text-mining script first and compare the analyzed words with  huge dictionary. or look them up in google and filter the domains you've found, mostly these are sites with same language. Nina
Meka][Meka
Unstopable
Posts: 700

that would take too long, it doesnt matter, i know how todo it anyways, just looking for someone that maybe has a quicker better way... i use regexp for sampling code ie
vb:
Code:
dim [a-z0-9_] as [a-z0-9_]

if anyone can give me more regexp examples on catching languages precise then please reply... for example asm you could search just 'mov' but if another language contains mov, then we are nackered, so it has to be something common, and maybe specific to that language...
Nina
Ametuar
Posts: 134

goodmorning! i will answer this tonight asap, i have to get prepared for school now, i have got oberon programming exam  within few hours. i'm little nervous, wish me all the best :cry: later all
Ashura
Unstopable
Posts: 370

good luck then 
Meka][Meka
Unstopable
Posts: 700

lol good luck
Nina
Ametuar
Posts: 134

thank you,  that's so very very kind of you! well.. i just dropped in im back from the pub, drunk three beers and smoke pink sigarets i have to say i have asked around my colleague students about your problem and to be short, we don't seem to get out of it in any easy way, sorry.
Meka][Meka
Unstopable
Posts: 700

lol, its not really a problem at all, like i said, i know how todo it anyways, im jus checking to see if any other proggers has a nicer/quicker way to do it.... to be honest i dont think there is, my method words quick enough, will finish integration probby some time this week...
Nina
Ametuar
Posts: 134

lol i wasn't going to reply on this one, i feel i wasn't really helpfull on this topic. better should keep my mouth now and then lol.  well im glad you already know a solution. this topic has got the latest replies  also, GreetzZ