<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">>This sounds similar to what clang-format does (lib/Format/</span><span style="font-family:arial,sans-serif;font-size:13px">UnwrappedLineParser.cpp) – have you looked at that?</span><br>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">He says in the fifth paragraph: </span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><font face="arial, sans-serif">> </font><span style="font-family:arial,sans-serif;font-size:13px"> clang-format internally has a similar fuzzy parser </span><span style="font-family:arial,sans-serif;font-size:13px">and is currently more complete, but not written in a reusable way.</span></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 30, 2014 at 10:40 AM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This sounds similar to what clang-format does (lib/Format/UnwrappedLineParser.cpp) – have you looked at that?</div>
<div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 30, 2014 at 10:28 AM, Johannes Kapfhammer <span dir="ltr"><<a href="mailto:kapf@student.ethz.ch" target="_blank">kapf@student.ethz.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I am working on a Google Summer of Code project to use the clang lexer for<br>
syntax highlighting. The intended usage is to highlight C++ for LaTeX<br>
(papers, presentations), HTML (documentations, wikis) and other formats.<br>
My goal is to provide a better alternative to Pygments (which highlights C++<br>
on the <a href="http://llvm.org" target="_blank">llvm.org</a> docs) or GNU Source-highlight. These tools can identify<br>
keywords perfectly well, but aren't able to highlight types and functions.<br>
<br>
To correctly highlight those source snippets, I wrote a fuzzy parser library on<br>
top of the clang lexer. The clang parser cannot be used for this as snippets<br>
don't need to be self-contained, e.g. use types or functions which definitions<br>
aren't included.<br>
<br>
The fuzzy parser doesn't understand all language constructs of C++, but enough<br>
to produce a reasonably good highlighting. A sample output produced with<br>
LaTeX an be found on github [1] (136 KB). There's also more documentation<br>
about clang-highlight [2] and the fuzzy parser [3].<br>
<br>
I submitted my work for review on phabricator [4] to get it into<br>
clang/tools/extra.<br>
<br>
The fuzzy parser is a general library that may have some other potential uses<br>
beside clang-highlight. clang-format internally has a similar fuzzy parser<br>
and is currently more complete, but not written in a reusable way.<br>
Another possible use would be for an auto complete system for editors.<br>
<br>
Any opinions or suggestions about this project?<br>
<br>
Best,<br>
Johannes<br>
<br>
1 : <a href="https://github.com/kapf/clang-highlight/blob/master/latex/fuzzyparser.pdf?raw=true" target="_blank">https://github.com/kapf/clang-highlight/blob/master/latex/fuzzyparser.pdf?raw=true</a><br>
2 : <a href="https://github.com/kapf/clang-highlight/blob/master/docs/clang-highlight.rst" target="_blank">https://github.com/kapf/clang-highlight/blob/master/docs/clang-highlight.rst</a><br>
3 : <a href="https://github.com/kapf/clang-highlight/blob/master/docs/LibFuzzy.rst" target="_blank">https://github.com/kapf/clang-highlight/blob/master/docs/LibFuzzy.rst</a><br>
4 : <a href="http://reviews.llvm.org/D4725" target="_blank">http://reviews.llvm.org/D4725</a><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>