GNOME Bugzilla – Bug 150396
Highlight decimals in php.lang
Last modified: 2014-02-15 12:53:14 UTC
Distribution: Slackware Slackware 10.0.0 Package: gedit Severity: enhancement Version: GNOME2.6.2 unspecified Gnome-Distributor: GNOME.Org Synopsis: highlighting in gedit, a command is missing Bugzilla-Product: gedit Bugzilla-Component: general Bugzilla-Version: unspecified Description: gedit highlights also php sources, but the command "include_once" is not highlighted. there are may be some more.. there's also require_once missing. these are just two commands that i've seen... someone may add that to the list :-) ------- Bug moved to this database by unknown@bugzilla.gnome.org 2004-08-17 16:19 ------- Unknown platform unknown. Setting to default platform "Other". Unknown milestone "unknown" in product "gedit". Setting to default milestone for this product, '---' The original reporter of this bug does not have an account here. Reassigning to the person who moved it here, unknown@bugzilla.gnome.org. Previous reporter was pascalholzmann@web.de. Setting to default status "UNCONFIRMED". Setting qa contact to the default for this product. This bug either had no qa contact or an invalid one.
Sorry for the late reply. I don't know PHP. If you attach a list of missing keywords, we can add it. It would be great if you could send a path against php.lang
Created attachment 37336 [details] Updated PHP Language File
Created attachment 37337 [details] A screenshot of the updated language file in use.
I have a php.lang file with a complete keywords list. Changes are as follows: 1. it adds the missing 'null' keyword to the 'Case Insensetive Keywords'. 2. Added 'include_once', 'list', 'foreach' and 'require_once' to 'Case Sensitive Keyword'. 3. Added a keyword list of PHP(5) functions that is 1100+ long. 4. Added decimal number highlighting. There is only one problem with number 3, gtksourceview only allows 250 keywords in each keyword list, so after the 250th function in my list it stops highlighting the rest. To get around this, I split the keywords up into five groups of 250 and give them names like 'Functions A'. The .lang file it attatched, along with a screenshot of it in action on my computer.
Created attachment 37388 [details] [review] Diff patch as requested by Paolo
Could you please modify current version of the file in order to include changes 1, 2 and 4 and attach a diff. Why do you this it is important to highlight all the PHP functions? Why are you using the "Others" style for functions instead of "Function"? I should try a way to remove the limit of 250 keywords for list.
I wanted all PHP functions to be identified so that I might see what was part of the script and what is part of the system. I will fix my version, I should have I know, just wasn't thinking.
Created attachment 37390 [details] [review] Corrected patch
Rowan: note that the new patch still contains the function lists. Could you please attach one without the lists?
Created attachment 37391 [details] [review] Corrected patch: See if I can't get this right... this time
The following seems wrong to me + <pattern-item _name = "Decimal" style = "Decimal"> + <regex>\b([1-9][0-9]*|0)([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</regex> + </pattern-item> AFAIK, 10UL or 10lu, etc. are not valid integer in PHP: <paolo> pbor: uwog: do you know PHP? <paolo> do the Decimal Numbers have the same format as in C/C++? <uwog> paolo: afaik, yes <paolo> so 10UL or 10lu are valid integers? <uwog> in what context ? <paolo> for syntax highlighting PHP code <uwog> unsigned long l = 10UL; is valid in C ? <paolo> no, in PHP I mean <uwog> $l = 10UL is not valid for a start <paolo> ok <uwog> but in a format string, i think it is valid * uwog tries <uwog> nope, not valid as well
Sorry, I should just go burry myself now :/
Ok, Im working on a correct one now, instead of removing it altogether.
Created attachment 37423 [details] [review] The patch, fixed again I removed the Decimal pattern from the last patch and forgot to add my corrected one, this patch is the same as the last only it has the corrected patter. Forgive me for missing that, I must have been asleep.
Comment on attachment 37423 [details] [review] The patch, fixed again Sorry for the late reply. >+ <pattern-item _name="Decimal" style="Decimal"> >+ <regex>\b[0-9.]+\b</regex> >+ </pattern-item> >+ I think the regex is wrong since it also matched "......." or "..0099..", etc.
the missing keywords have been added some time ago, so just the highlighting for decimal numbers is missing. retitle.
Still missing var_dump and print_r common functions.
Patryk: could you please provide a patch to add support for var_dump and print_r common functions?
Created attachment 78356 [details] [review] More common functions Here's the patch. Adds print_r, var_dump and some other useful builtins.
Note: you might decide to drop the rest of the builtins until you provide proper highlighting for functions as these are not really keywords (var_dump and print_r are).
I committed the last patch. Need to evaluate this bug again for gsv2, leaving open.
2008-06-18 Yevgen Muntyan <muntyan@tamu.edu> * gtksourceview/language-specs/php.lang: added some keywords. Bug #150396, patch by Patryk Zawadzki.