dfmt 0.1.0
qznc via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Sun Feb 22 10:52:36 PST 2015
On Sunday, 22 February 2015 at 09:07:16 UTC, Brian Schott wrote:
> On Sunday, 22 February 2015 at 08:48:16 UTC, Brian Schott wrote:
>> On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott
>> wrote:
>>> dfmt is a D source code formatting tool.
>>>
>>> https://github.com/Hackerpilot/dfmt/
>>> https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0
>>
>> I just tagged 0.1.1. The only change is a bug fix for a case
>> where certain long lines with parenthesis wouldn't wrap
>> properly.
>
> v0.1.2 is tagged... "Move fast: things are broken", or
> something like that.
Congratulations to releasing. :)
For the record, I think using a D parser in dfmt is a dead end.
Surely, for certain cases the additional information is
necessary. However, it restricts dfmt to only format
syntactically valid snippets. This means you cannot (in general)
format parts of a file, e.g. within a diff or editor.
Example where parsing helps: "foo : bar" or "foo: bar" depending
on the context. The former within import statements, the latter
within switch statements.
Example for a snippet you cannot parse: The body of a switch
statement without the switch. The 'case' keyword would be an
error.
Effectively, you want to parse, but not with a normal parser.
Great formatting seems to require a special (more flexible, less
correct) parser. This is what clang-format does.
More information about the Digitalmars-d-announce
mailing list