[cfe-dev] RFC: Extend clang-format to support more/all C-like languages

Daniel Jasper djasper at google.com
Fri Nov 1 14:50:38 PDT 2013


My gut feeling is that we won't need to change the lexer. Bear in mind,
that (same as with everything else in clang-format) we only need to
understand the language good enough to format it. There might always be
corner cases where we aren't correct, but these are rare in practice.

In fact, I would like to go ahead and see whether we really hit the limit
somewhere and if so, what the problems are. Once we have sufficient
information, we can make a good decision on how to continue. Options would
be allowing different lexers or post-processing the output of Clang's
lexer. I fully agree that we should not modify the lexer to accommodate
other languages.


On Fri, Nov 1, 2013 at 9:17 PM, Chandler Carruth <chandlerc at google.com>wrote:

>
> On Fri, Nov 1, 2013 at 1:13 PM, Ryan Gonzalez <rymg19 at gmail.com> wrote:
>
>> What if the lexer was an overly large, non-abstract base class? Then, the
>> derived classes can just override the tokens as needed.
>
>
> (FWIW, I wouldn't try to design changes to the lexer in this thread, in
> the abstract... If this is an interesting path to pursue, I suspect Daniel
> or others should produce concrete proposed patches that enable the features
> needed and minimize the pollution of the lexer with other languages...)
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131101/011f15b3/attachment.html>


More information about the cfe-dev mailing list