<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
I seen 2 ways to build AST matchers : static and <span
class="docutils literal"><span class="pre">dynamic </span></span>(my
wording may be wrong). <br>
<br>
- The static one :<tt> auto matcher = </tt><tt><span
class="docutils literal"><span class="pre">recordDecl(hasName("Foo"),</span>
<span class="pre">isDerivedFrom("Bar")) </span></span></tt><span
class="docutils literal"><span class="pre">directly written in a
C++ file </span></span><tt><span class="docutils literal"><span
class="pre"><br>
</span></span></tt><span class="docutils literal"><span
class="pre"><br>
- The dynamic one </span></span><span class="docutils literal"><span
class="pre">with</span></span><tt><span class="docutils literal"><span
class="pre"> Parser::parseMatcherExpression <br>
<br>
</span></span></tt><span class="docutils literal"><span
class="pre">And i was wandering if there was </span></span><i>semi
dynamic</i> way to build AST matchers ?<br>
<br>
Something like <br>
<tt>auto </tt><tt>matcher = </tt><tt><span class="docutils
literal"><span class="pre">recordDecl();<br>
</span></span></tt><tt>matcher.add(</tt><tt><span
class="docutils literal"><span class="pre">hasName("Foo"));<br>
</span></span></tt><span class="docutils literal"><span
class="pre"><br>
The main idea beyond it is to be able to build matcher matching
a specific AST by visiting the AST<br>
and building the matcher instead of building a string and then
re-parsing it. <br>
<br>
Thanks,<br>
David.</span></span><tt><span class="docutils literal"><span
class="pre"><br>
<br>
</span></span></tt>
</body>
</html>