<p dir="ltr">The below is the sort of thing I'd suggest. You'll probably need some manual massaging to get the extraction exactly right, though.</p>
<p dir="ltr">Also, the synopses do not typically include class definitions, just a "class X;" style declaration, so if that's a problem for you then you'll need to do a bit more work to extract those too.</p>
<div class="gmail_quote">On 9 May 2016 8:51 a.m., "Kim Gräsman" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Eric,<br>
<br>
On Mon, May 9, 2016 at 3:30 PM, Eric Liu via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> As an alternative, we are thinking about parsing header synopses from C++<br>
> standard. So, we are wondering if there are existing syntax-correct header<br>
> synopses in the form of C++ header files somewhere that we can use. If not,<br>
> Manual(@klimek) suggests that maybe we could have the header synopses as C++<br>
> header files and have the standard draft includes them so that syntax can be<br>
> easily checked, and we can conveniently parse the synopses too.<br>
<br>
We've had similar plans for IWYU, and I think we eventually parsed the<br>
TeX source from <a href="https://github.com/cplusplus/draft/tree/master/source" rel="noreferrer" target="_blank">https://github.com/cplusplus/draft/tree/master/source</a><br>
with a simple shell script.<br>
<br>
I didn't do this myself, but I found a couple of examples in our source here:<br>
<br>
// These headers are defined in C++14 [headers]p3. You can get them with<br>
// $ sed -n '/begin{floattable}.*{tab:cpp.c.headers}/,/end{floattable}/p'<br>
lib-intro.tex | grep tcode | perl -nle 'm/tcode{<c(.*)>}/ && print qq@<br>
{ "<$1.h>", kPublic, "<c$1>", kPublic },@' | sort<br>
// on <a href="https://github.com/cplusplus/draft/blob/master/source/lib-intro.tex" rel="noreferrer" target="_blank">https://github.com/cplusplus/draft/blob/master/source/lib-intro.tex</a><br>
<br>
// These headers are defined in C++14 [headers]p2. You can get them with<br>
// $ sed -n '/begin{floattable}.*{tab:cpp.library.headers}/,/end{floattable}/p'<br>
lib-intro.tex | grep tcode | perl -nle 'm/tcode{(.*)}/ && print qq@<br>
"$1",@' | sort<br>
// on <a href="https://github.com/cplusplus/draft/blob/master/source/lib-intro.tex" rel="noreferrer" target="_blank">https://github.com/cplusplus/draft/blob/master/source/lib-intro.tex</a><br>
<br>
(from <a href="https://github.com/include-what-you-use/include-what-you-use/blob/master/iwyu_include_picker.cc" rel="noreferrer" target="_blank">https://github.com/include-what-you-use/include-what-you-use/blob/master/iwyu_include_picker.cc</a>)<br>
<br>
Assuming you want this to be portable I'm sure you can do something<br>
similar in C++ relatively easily.<br>
<br>
FWIW,<br>
- Kim<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>