Bug 140511 - BASH parser bugs with case and the word "do"
Summary: BASH parser bugs with case and the word "do"
Status: CLOSED FIXED
Alias: None
Product: kate
Classification: Applications
Component: syntax (show other bugs)
Version: 2.5
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks: 311233
  Show dependency treegraph
 
Reported: 2007-01-23 21:29 UTC by Luiz Angelo De Luca
Modified: 2014-05-22 19:02 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
This fixes the problem of parsing arguments as commands. (5.01 KB, patch)
2012-04-13 01:16 UTC, Luiz Angelo De Luca
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luiz Angelo De Luca 2007-01-23 21:29:37 UTC
Version:           3.3.5 (using KDE 3.5.5 "release 45.2" , openSUSE 10.2)
Compiler:          Target: x86_64-suse-linux
OS:                Linux (x86_64) release 2.6.18.2-34-default

Hello,

Bash parser inside kdevelop (and kate) is buggy.

The use o ";;" in the last case clause is optional. Parser fails to accept case without it. Ex:

case 1 in 
2) echo xxx;
;;
1) echo yyy;
esac

The use of the text "do" without '"' bugs the parser. Ex:

function aaa {
    echo do            
}
XXX
Comment 1 Andreas Pakulat 2007-01-23 22:22:20 UTC
I can confirm the first one, but the 2nd example works here. Same as with the other the problem is in kate.
Comment 2 Andreas Pakulat 2007-01-23 22:24:02 UTC
Forgot to change the status.
Comment 3 Pino Toscano 2007-07-31 00:44:27 UTC
(Really reassing to the Kate guys.)
Comment 4 Luiz Angelo De Luca 2007-12-13 16:56:35 UTC
This bug is still valid in kde4rc2
Comment 5 Dario Andres 2009-01-04 22:24:49 UTC
The first issue is still valid using:

Qt: 4.4.3 + qt-copy-patches-889120
KDE: 4.1.87 (KDE 4.1.87 (KDE 4.2 >= 20090101))
kdelibs svn rev. 905636 / kdebase svn rev. 905636
kdesdk svn rev. 905676
on ArchLinux x86_64 - Kernel 2.6.27.10
Comment 6 Joseph Wenninger 2009-01-04 23:42:07 UTC
SVN commit 905727 by jowenn:

case 1 in 
2) echo xxx;
;;
1) echo yyy;
esac

works now for KDE 4.2

The 
	echo do
problem still exists
this is a littlebit more work and needs a rewrite of the FindAll and FindCommands contexts

CCBUG: 140511


 M  +2 -1      syntax/data/bash.xml  
 M  +9 -0      tests/highlight.sh  


WebSVN link: http://websvn.kde.org/?view=rev&revision=905727
Comment 7 Luiz Angelo De Luca 2009-05-20 22:03:52 UTC
Testing with kde4.3

I think that the "case" situation is not completely fixed. In Kate, if I add the ";;", esac left bar color is changed to something darker, which I suppose to identify the last line in a block.

The "do" one is still open
Comment 8 Christoph Cullmann 2010-02-20 14:55:37 UTC
Moving to wish list status. All highlightings works with heuristics and will never be perfect. Perhaps somebody can provide a patch, therefor not closing it.
Comment 9 Luiz Angelo De Luca 2012-04-10 14:47:59 UTC
Just the do problem persists in kde 4.8
Comment 10 Luiz Angelo De Luca 2012-04-13 01:16:03 UTC
Created attachment 70355 [details]
This fixes the problem of parsing arguments as commands.
Comment 11 Christoph Cullmann 2012-10-29 04:04:17 UTC
Git commit a021bc5b6e039de781628de777def492c7887f4e by Christoph Cullmann.
Committed on 29/10/2012 at 05:03.
Pushed by cullmann into branch 'master'.

commit patch by Luiz Angelo De Luca to fix issues with bash hl

M  +29   -9    part/syntax/data/bash.xml

http://commits.kde.org/kate/a021bc5b6e039de781628de777def492c7887f4e
Comment 12 Milian Wolff 2012-12-13 13:31:56 UTC
This patch horribly breaks something common as this:

foo="$(pwd)"

the ) is apparently eaten by some other context than the SubstCommand context and thus it never pops
Comment 13 Luiz Angelo De Luca 2012-12-13 13:45:25 UTC
Hello Milian,

Thanks for your report. The version 2.15 is known to have problems with ")", "}" or "`". I should have commented on this bug before about these problems.

Could you please test the proposed patch at bug 311233? 

This is the bash.xml link:

https://bugs.kde.org/attachment.cgi?id=75714