After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 150396 - Highlight decimals in php.lang
Highlight decimals in php.lang
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: Syntax files
unspecified
Other other
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2004-08-17 20:18 UTC by pascalholzmann
Modified: 2014-02-15 12:53 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Updated PHP Language File (43.85 KB, text/plain)
2005-02-11 11:57 UTC, Rowan Lewis
  Details
A screenshot of the updated language file in use. (144.31 KB, image/png)
2005-02-11 12:01 UTC, Rowan Lewis
  Details
Diff patch as requested by Paolo (42.59 KB, patch)
2005-02-12 10:36 UTC, Rowan Lewis
none Details | Review
Corrected patch (41.75 KB, patch)
2005-02-12 11:06 UTC, Rowan Lewis
none Details | Review
Corrected patch: See if I can't get this right... this time (1.21 KB, patch)
2005-02-12 11:19 UTC, Rowan Lewis
none Details | Review
The patch, fixed again (1.41 KB, patch)
2005-02-13 01:19 UTC, Rowan Lewis
needs-work Details | Review
More common functions (1.64 KB, patch)
2006-12-14 12:40 UTC, Patryk Zawadzki
committed Details | Review

Description pascalholzmann 2004-08-17 20:19:15 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.

Comment 1 Paolo Maggi 2005-01-07 18:47:07 UTC
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 
Comment 2 Rowan Lewis 2005-02-11 11:57:57 UTC
Created attachment 37336 [details]
Updated PHP Language File
Comment 3 Rowan Lewis 2005-02-11 12:01:04 UTC
Created attachment 37337 [details]
A screenshot of the updated language file in use.
Comment 4 Rowan Lewis 2005-02-11 12:01:29 UTC
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.
Comment 5 Rowan Lewis 2005-02-12 10:36:45 UTC
Created attachment 37388 [details] [review]
Diff patch as requested by Paolo
Comment 6 Paolo Maggi 2005-02-12 10:49:05 UTC
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.
Comment 7 Rowan Lewis 2005-02-12 10:54:16 UTC
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.
Comment 8 Rowan Lewis 2005-02-12 11:06:45 UTC
Created attachment 37390 [details] [review]
Corrected patch
Comment 9 Paolo Maggi 2005-02-12 11:14:40 UTC
Rowan: note that the new patch still contains the function lists.
Could you please attach one without the lists?
Comment 10 Rowan Lewis 2005-02-12 11:19:08 UTC
Created attachment 37391 [details] [review]
Corrected patch: See if I can't get this right... this time
Comment 11 Paolo Maggi 2005-02-12 15:14:17 UTC
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
Comment 12 Rowan Lewis 2005-02-13 00:57:16 UTC
Sorry, I should just go burry myself now :/
Comment 13 Rowan Lewis 2005-02-13 01:05:41 UTC
Ok, Im working on a correct one now, instead of removing it altogether.
Comment 14 Rowan Lewis 2005-02-13 01:19:04 UTC
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 15 Paolo Maggi 2005-03-01 10:23:04 UTC
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.
Comment 16 Paolo Borelli 2005-08-29 16:27:48 UTC
the missing keywords have been added some time ago, so just the highlighting for
decimal numbers is missing. retitle.
Comment 17 Patryk Zawadzki 2006-01-16 16:11:32 UTC
Still missing var_dump and print_r common functions.
Comment 18 Paolo Maggi 2006-12-13 13:33:18 UTC
Patryk: could you please provide a patch to add support for var_dump and print_r common functions?

Comment 19 Patryk Zawadzki 2006-12-14 12:40:50 UTC
Created attachment 78356 [details] [review]
More common functions

Here's the patch. Adds print_r, var_dump and some other useful builtins.
Comment 20 Patryk Zawadzki 2006-12-14 12:48:19 UTC
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).
Comment 21 Paolo Borelli 2007-02-12 18:26:23 UTC
I committed the last patch. Need to evaluate this bug again for gsv2, leaving open.
Comment 22 Yevgen Muntyan 2008-06-20 02:59:30 UTC
2008-06-18  Yevgen Muntyan  <muntyan@tamu.edu>

	* gtksourceview/language-specs/php.lang: added some keywords.
        Bug #150396, patch by Patryk Zawadzki.