#401 sh coloring (syntax highlight, parentesis matching) PRB

Program (402)

I'm using nedit 5.4

Try this code whith sh_ksh_bash syntax highlight :

# this is useless but it shows the bug
# both parenthesis matching (^M) and
# sh_ksh_bash syntax highlight fails for last ' ) '

val=$( echo $( echo toto ) )

If you bring the cursor just after the last ' ) ' the
parenthesis matching does not work.


  • Thorsten Haude

    Thorsten Haude - 2004-08-17

    Logged In: YES

    The last ) is not highlighted, so this is an error within the
    pattern, not any other part of NEdit. It should be possible to
    add another level of 'recursion' to cover this, but it will come
    up again and again until there is a way to have more than one
    parent for a given pattern or true recursive pattern.

    Is there another way to get this right with NEdit's current

  • Thorsten Haude

    Thorsten Haude - 2004-08-17
    • assigned_to: nobody --> yooden
  • linuxprocess

    linuxprocess - 2004-08-18

    Logged In: YES

    > until there is a way to have more than
    > one parent for a given pattern or true
    > recursive pattern

    What is the problem with "shell" pattern ?
    The "C" pattern is successfull for this code :
    void main(void)
    int val=abs( abs( abs( abs(-3))));
    Isn't it the same situation ?

  • Eddy De Greef

    Eddy De Greef - 2004-08-18

    Logged In: YES

    No, it's a different situation. The C pattern doesn't try to
    highlight the stuff between parenthesis. It just highlights
    every parenthesis independently.
    The Sh pattern tries to highlight $(...) expressions as a
    whole and gets in trouble when they are nested. I think it
    is currently impossible to highlight these expressions
    correctly when unlimited recursion is possible. All we can
    do is extend the pattern to allow at most a few levels of

    Note that you can turn off syntax-based paren matching:
    Preferences->Show Matching->Syntax Based. So in your
    original example, where syntax highlighting fails, you can
    still get a working paren matching (although, generally,
    syntax-based matching works more accurate).

  • Thorsten Haude

    Thorsten Haude - 2004-10-08
    • status: open --> closed

Log in to post a comment.