#158 $x->format() breaks syntax highlighting

closed-wont-fix
nobody
None
5
2005-04-06
2005-04-02
Jan Ploski
No

I am reporting this bug against the current CVS version.

The expression $foo->format() (an invocation of a method
named format on some object) breaks syntax highlighting
in source code which follows it.

The reason is that a SPAN rule from
org.epic.ext.cbg.editor/modes/perl.xml is applied
incorrectly to the above expression:

<SPAN TYPE="LITERAL2"
REQUIRE_WHITESPACE_BEFORE ="TRUE"
REQUIRE_WHITESPACE_AFTER ="TRUE" >
<BEGIN>format</BEGIN>
<END>.</END>
</SPAN>

Specifically, the REQUIRE_WHITESPACE_BEFORE part
does not work as expected. The bug seems to be caused
by cbg.editor.rules.ColoringWhitespaceDetector
whose isWhitespace method returns true not just
for real whitespace, but also for various punctuation
characters (including >).

Discussion

  • LeO
    LeO
    2005-04-06

    Logged In: YES
    user_id=703323

    Here as well it's hard to distinguish when it's a reference
    and when it's the built-in function of Perl. And the
    Whitespace-function works as design, cause whitespace is
    interpreted as Whitespace + (1-letter)-operators.

    So, I say: It works as desgined. Same problem would appear
    if you wish to write something like $foo->print

    You can try in the xml-code to adapt it, but frankly say,
    don't know what the benefit of this should be.

     
  • LeO
    LeO
    2005-04-06

    • status: open --> closed-wont-fix
     
  • Jan Ploski
    Jan Ploski
    2005-04-07

    Logged In: YES
    user_id=86907

    The benefit is quite simple: syntax highlighting would work in the case
    I described, as opposed to: half of the file has wrong syntax highlighting
    because of one invocation of a strangely named method inside it.

    Also, note that "it works as designed" does not mean "as intended".

     
  • LeO
    LeO
    2005-04-07

    Logged In: YES
    user_id=703323

    "it works as designed" => EPIC
    "as intended" => Perl

    You could send us code-changes and we'll verfiy against
    side-effects. Your suggested change has to many side-effects.

    You can add something like

    Mark_following -gt;

    which works (and will be submitted to CVS soon).