Menu

#111 Improved php.xml file

closed-accepted
None
7
2007-08-17
2007-06-20
No

Please find attached a thoroughly improved php.xml mode file.

I've been using this at work and home now for a long time and have tried to keep in sync with the patches to the php.xml file from jEdit SVN.

Because there are a lot of changes, I will provide the new file rather than a patch.

If necessary, I can put a list together of things that have been improved.

There's only one regression I'm aware of currently: internal PHP functions or e.g. "empty()" do not get highlighted as KEYWORD1 anymore, but just like any function. This is caused, because now e.g. "foo ()" also gets correctly handled as a function. IIRC there has been a fix/suggestion posted in the bug tracker for this - so this could get fixed without changing jEdit's syntax parser.

This mode requires jEdit 4.3pre10 (SVN trunk).

I will keep this tracker item up-to-date with the latest version.

To test/use it, copy it into ~/.jedit/modes/ and create/change ~/.jedit/modes/catalog to actually use it (take a look at the "catalog" file in jEdit's "modes" directory in the program folder).

Discussion

  • daniel hahler

    daniel hahler - 2007-06-20

    Logged In: YES
    user_id=663176
    Originator: YES

    File Added: _test_jedit_editmode.php

     
  • Alan Ezust

    Alan Ezust - 2007-06-21
    • priority: 5 --> 7
    • assigned_to: nobody --> kpouer
     
  • Alan Ezust

    Alan Ezust - 2007-06-21

    Logged In: YES
    user_id=935841
    Originator: NO

    assigning to matthieu, since I know he uses PHP a lot more than I do :-)

     
  • Matthieu Casanova

    Logged In: YES
    user_id=285591
    Originator: NO

    Hi, that's not bad but there is something that I don't like when having a function call or declaration the () have the same color as the function name. Is it possible to fix that ?

     
  • Matthieu Casanova

    Logged In: YES
    user_id=285591
    Originator: NO

    And the if, while ... keywords are not keywords anymore, they are highlighted as functions

     
  • daniel hahler

    daniel hahler - 2007-06-21

    Logged In: YES
    user_id=663176
    Originator: YES

    Matthieu, that's what I've said. It's the regression I've mentioned.

    A workaround would be to use SEQ TYPE="KEYWORDX" instead of KEYWORDX, but the drawback here is that it does not get considered for complete-word than. A solution to this might be to not only include KEYWORDX in ParserRuleSet.keywords, but add SEQ[type=KEYWORDX] there, too.
    Another workaround would be to duplicate everything, so you would have KEYWORDX and SEQs - but that seems stupid.

    What do you think?

    I'm attaching the same php.xml file, but with the workaround mentioned above.
    File Added: php.xml

     
  • daniel hahler

    daniel hahler - 2007-06-21

    Logged In: YES
    user_id=663176
    Originator: YES

    Sorry, for obvious reasons the SEQ-workaround does not work, because it does not respect "whole words". E.g. something like "infodienew()" gets really colourful.

    Now I've commented out the delegate to PHP_FUNCS like already suggested in
    http://sourceforge.net/tracker/index.php?func=detail&aid=1716134&group_id=588&atid=100588 and "ordinary" functions do not get highlighted therefor.
    Of course, we should find a solution for this.
    File Added: php.xml

     
  • daniel hahler

    daniel hahler - 2007-08-11

    Logged In: YES
    user_id=663176
    Originator: YES

    I've now worked several months with this fixed mode and think I should commit it (I have commit access).

    If nobody complains about it, I'll do so in a couple of days.

    It would be nice to have a solution for the cannot-mark-custom-functions problem, but this can get fixed later, if it needs to at all.

     
  • Matthieu Casanova

    Logged In: YES
    user_id=285591
    Originator: NO

    Hi, it seems better but there is still something that I dislike :
    the functions aren't highlighted (that's not very important), and most important : the parens for the class methods call are highlighted like the function name :
    $A->B();

    B() have the same color

     
  • daniel hahler

    daniel hahler - 2007-08-15

    Logged In: YES
    user_id=663176
    Originator: YES

    kpouer, I've now fixed the most important issue: the parens for class methods are now highlighted as functions.
    The other issue is fixed, too.

    So this should be the most sweetest php.xml ever :)

    Please test it and provide feedback - I've only tested it against the test file now really.
    File Added: php.xml

     
  • Matthieu Casanova

    Logged In: YES
    user_id=285591
    Originator: NO

    Hi, there are still some inconsistency with the classes (the -> and :: colors in fact are different if a field or a method is accessed for example) but that's not very important and I think this version is good.
    Do you want to commit it ?

     
  • daniel hahler

    daniel hahler - 2007-08-16

    Logged In: YES
    user_id=663176
    Originator: YES

    Yes, I would be happy to commit it.

    I think I've just fixed the issue you're mentioning (the "->" gets highlighted as function and the "::" as KEYWORD4).
    I've also changed the default for set OBJECT_PHP to KEYWORD4, so "$A->as()::asas" looks good now.

    See the new php.xml file. I will commit it this evening.

    Thanks for your feedback!
    File Added: php.xml

     
  • daniel hahler

    daniel hahler - 2007-08-16

    Logged In: YES
    user_id=663176
    Originator: YES

    So, here's a new php.xml file again, with some more fixes and cleanup.
    I've even documented the use of keywords in there.. :p

    The test file has also been improved a lot.

    I think it's fine now, but want to use it tomorrow at work first and would like to get some feedback again, of course.. :)

    Thanks.
    File Added: php.xml

     
  • daniel hahler

    daniel hahler - 2007-08-16

    PHP mode file

     
  • daniel hahler

    daniel hahler - 2007-08-16

    Test file for php.xml

     
  • daniel hahler

    daniel hahler - 2007-08-16

    Logged In: YES
    user_id=663176
    Originator: YES

    File Added: _test_jedit_editmode.php

     
  • daniel hahler

    daniel hahler - 2007-08-17
    • status: open --> closed-accepted
     
  • daniel hahler

    daniel hahler - 2007-08-17

    Logged In: YES
    user_id=663176
    Originator: YES

    Committed in r10397.

     

Log in to post a comment.