* [Cocci] Determining the second line indent amount?
@ 2018-12-18 18:01 Timur Tabi
2018-12-18 18:04 ` Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2018-12-18 18:01 UTC (permalink / raw)
To: cocci
I want to write a Python script that will word-wrap long literal
strings. In order to do that properly, I need to know how many spaces
the parameter is indented, so that I can guarantee that the string is
wrapped at column 80. Is that information available?
Coccinelle puts long strings on their own line (in my case, it's
always the second parameter), so I think all I will need is the indent
amount that Coccinelle uses for multi-line function calls, not any
specific parameter.
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Cocci] Determining the second line indent amount?
2018-12-18 18:01 [Cocci] Determining the second line indent amount? Timur Tabi
@ 2018-12-18 18:04 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2018-12-18 18:04 UTC (permalink / raw)
To: Timur Tabi; +Cc: cocci
On Tue, 18 Dec 2018, Timur Tabi wrote:
> I want to write a Python script that will word-wrap long literal
> strings. In order to do that properly, I need to know how many spaces
> the parameter is indented, so that I can guarantee that the string is
> wrapped at column 80. Is that information available?
>
> Coccinelle puts long strings on their own line (in my case, it's
> always the second parameter), so I think all I will need is the indent
> amount that Coccinelle uses for multi-line function calls, not any
> specific parameter.
You only have access to the number of characters from the beginning of the
line (col field of a position variable), but you don't know whether those
characters are spaces or tabs. If your software only uses spaces, then
the number would be reliable.
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-18 18:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 18:01 [Cocci] Determining the second line indent amount? Timur Tabi
2018-12-18 18:04 ` Julia Lawall
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).