[antlr-interest] Can StringTemplate do this? and Is StringTemplate different for C#?

Voelkel, Andy andy.voelkel at plantronics.com
Tue Oct 25 15:54:55 PDT 2011


Hi,



I'm just getting started with StringTemplate after starting to climb the steep Antlr learning curve. I've done a quick look over of the documentation, not enough to really understand it in depth, but I'm wondering if it will do something that I've done before. I want to print out end of line C++ style comments (// this kind) for generated code for C structure definitions, one comment for each structure member. I want the start of the comments to all to align vertically for readability. This means that they have to be in a column far enough over not to collide with end of the variable names. But I don't want to put them over farther than necessary. So what I've done in the past is format all the variable name strings in a structure and put them aside, then calculate the length of the longest formatted string, and then use that to determine the column for the start of the comments. This is done separately for each structure, which gives a good compromise between readability and line length. You can extend the idea past C structure definitions, but you get the idea.



Can I do this with StringTemplates?



While I'm at, I might as well ask - does StringTemplate differ as much from java based platforms to C# based platforms as Antlr does?



Thanks for any help!



-          Andy

________________________________

CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential and/or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, please DO NOT disclose the contents to another person, store or copy the information in any medium, or use any of the information contained in or attached to this transmission for any purpose. If you have received this transmission in error, please immediately notify the sender by reply email or at privacy at plantronics.com, and destroy the original transmission and its attachments without reading or saving in any manner.

For further information about Plantronics - the Company, its products, brands, partners, please visit our website www.plantronics.com.


More information about the antlr-interest mailing list