* diff support for the Eiffel language?
@ 2012-10-22 11:58 Ulrich Windl
2012-10-22 13:06 ` Ævar Arnfjörð Bjarmason
0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Windl @ 2012-10-22 11:58 UTC (permalink / raw)
To: git
Hi!
After a longer pause, I did some programming in Eiffel again, and while doing so, why not use Git? It works!
However there's one little thing I noticed with "git diff":
The conte4xt lines (staring with "@@") show the current function (in Perl and C), but they show the current "feature clause" in Eiffel (as opposed to the expected current feature). I wonder how hard it is to fix it (Observed in git 1.7.7 of openSUSE 12.1).
For the non-Eiffelists:
Eiffel has a class structure like this:
class FOO
feature {BAR} -- This is a "feature clause", grouping related features (attributes/routines)
baz (x,y : INTEGER) : STRING is
-- blabla...
do
...
end -- baz
end -- class FOO
---
Now if I change something inside "baz", it would be nice if the @@-contect line would show "baz" (or more) instead of "feature {BAR}...".
Regards,
Ulrich
P.S. Apologies if the feature requested had been added already.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: diff support for the Eiffel language?
2012-10-22 11:58 diff support for the Eiffel language? Ulrich Windl
@ 2012-10-22 13:06 ` Ævar Arnfjörð Bjarmason
2012-10-22 13:35 ` Johannes Sixt
0 siblings, 1 reply; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2012-10-22 13:06 UTC (permalink / raw)
To: Ulrich Windl; +Cc: git
On Mon, Oct 22, 2012 at 1:58 PM, Ulrich Windl
<Ulrich.Windl@rz.uni-regensburg.de> wrote:
> However there's one little thing I noticed with "git diff":
> The conte4xt lines (staring with "@@") show the current function (in Perl and C), but they show the current "feature clause" in Eiffel (as opposed to the expected current feature). I wonder how hard it is to fix it (Observed in git 1.7.7 of openSUSE 12.1).
See git.git's e90d065 for an example of adding a new diff pattern.
You could easily come up with a patch and send it to the list, however
it would probably be good to CC some Eiffel language list in case
there's some syntax oddities you've missed.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: diff support for the Eiffel language?
2012-10-22 13:06 ` Ævar Arnfjörð Bjarmason
@ 2012-10-22 13:35 ` Johannes Sixt
2012-11-27 11:16 ` Antw: " Ulrich Windl
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Sixt @ 2012-10-22 13:35 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: Ulrich Windl, git
Am 10/22/2012 15:06, schrieb Ævar Arnfjörð Bjarmason:
> On Mon, Oct 22, 2012 at 1:58 PM, Ulrich Windl
> <Ulrich.Windl@rz.uni-regensburg.de> wrote:
>> However there's one little thing I noticed with "git diff": The
>> conte4xt lines (staring with "@@") show the current function (in Perl
>> and C), but they show the current "feature clause" in Eiffel (as
>> opposed to the expected current feature). I wonder how hard it is to
>> fix it (Observed in git 1.7.7 of openSUSE 12.1).
>
> See git.git's e90d065 for an example of adding a new diff pattern.
It's not necessary to wait until there is built-in support for a new language.
For example, for Windows resource files, I have
*.rc diff=winres
in .gitattributes or .git/info/attributes and
[diff "winres"]
xfuncname =
"!^(BEGIN|END|FONT|CAPTION|STYLE)\n^[a-zA-Z_][a-zA-Z_0-9]*.*\n^[[:space:]]*([[:alnum:]_]+,
*DIALOG.*)"
in .git/config (the xfuncname is all on a single line). The first part
beginning at ! up to \n tells to ignore the specified matches. The other
parts separated by \n tell the things to put in the hunk header. You can
have "ignore" parts (with exlamation mark) and "take this" parts (without)
in any order that is convenient, as long as the last one is "take this".
-- Hannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Antw: Re: diff support for the Eiffel language?
2012-10-22 13:35 ` Johannes Sixt
@ 2012-11-27 11:16 ` Ulrich Windl
0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Windl @ 2012-11-27 11:16 UTC (permalink / raw)
To: avarab, Johannes Sixt; +Cc: git
Hi!
I managed to have some success, although it's not perfect. Unfortunately the
Eiffel grammar does not allow a 100% solution. Example:
---
local
x : BOOLEAN
---
declares a local variable named `x', while
---
x : BOOLEAN
do ... end
---
Declares a function named `x'. Formal generic parameters like `x :
ARRAY[ARRAY[STRING]]' make things more complicate. Anyway, here's my solution
(probably incomplete):
---
% git config --local -e
[diff "Eiffel"]
xfuncname =
"!^[[:space:]]*(check|class|[Cc]reate|else|elseif|end|ensure|do|!|feature|from|indexing|inherit|is|local|loop|note|require|then|until)[[:space:]]*\n\
^[[:space:]]*(class[[:space:]]*[[:alpha:]_][[:alnum:]_]*)\n\
^[[:space:]]*([[:alpha:]_][[:alnum:]_]*[[:space:]]*\\([^(\")]+:[^(\")]+\\)[[:space:]]*:[[:space:]*[[:alpha:]_][[:alnum:]_]*[[:space:]]*[^[:space:]\"]?[^\"=]*)[[:space:]]*$\n\
^[[:space:]]*([[:alpha:]_][[:alnum:]_]*[[:space:]]*\\([^(\")]+:[^(\")]+\\))[[:space:]]*$\n\
^[[:space:]]*([[:alpha:]_][[:alnum:]_]*[[:space:]]*:[[:space:]*[[:alpha:]_][[:alnum:]_]*[[:space:]]*[^[:space:]\"]?[^\"=]*)[[:space:]]*$\n\
^[[:space:]]*([[:alpha:]_][[:alnum:]_]*)[[:space:]]*$"
% cat .git/info/attributes
*.e diff=Eiffel
---
Regards,
Ulrich
>>> Johannes Sixt <j.sixt@viscovery.net> schrieb am 22.10.2012 um 15:35 in
Nachricht <50854B90.50807@viscovery.net>:
> Am 10/22/2012 15:06, schrieb Ævar Arnfjörð Bjarmason:
> > On Mon, Oct 22, 2012 at 1:58 PM, Ulrich Windl
> > <Ulrich.Windl@rz.uni-regensburg.de> wrote:
> >> However there's one little thing I noticed with "git diff": The
> >> conte4xt lines (staring with "@@") show the current function (in Perl
> >> and C), but they show the current "feature clause" in Eiffel (as
> >> opposed to the expected current feature). I wonder how hard it is to
> >> fix it (Observed in git 1.7.7 of openSUSE 12.1).
> >
> > See git.git's e90d065 for an example of adding a new diff pattern.
>
> It's not necessary to wait until there is built-in support for a new
> language.
>
> For example, for Windows resource files, I have
>
> *.rc diff=winres
>
> in .gitattributes or .git/info/attributes and
>
> [diff "winres"]
> xfuncname =
>
"!^(BEGIN|END|FONT|CAPTION|STYLE)\n^[a-zA-Z_][a-zA-Z_0-9]*.*\n^[[:space:]]*(
> [[:alnum:]_]+,
> *DIALOG.*)"
>
> in .git/config (the xfuncname is all on a single line). The first part
> beginning at ! up to \n tells to ignore the specified matches. The other
> parts separated by \n tell the things to put in the hunk header. You can
> have "ignore" parts (with exlamation mark) and "take this" parts (without)
> in any order that is convenient, as long as the last one is "take this".
>
> -- Hannes
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-27 11:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22 11:58 diff support for the Eiffel language? Ulrich Windl
2012-10-22 13:06 ` Ævar Arnfjörð Bjarmason
2012-10-22 13:35 ` Johannes Sixt
2012-11-27 11:16 ` Antw: " Ulrich Windl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).