Coccinelle archive on lore.kernel.org
 help / Atom feed
* [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, back to index

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

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr cocci@archiver.kernel.org
	public-inbox-index cocci


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/ public-inbox