xaizek / zograscope (License: AGPLv3 only) (since 2018-12-07)
Mainly a syntax-aware diff that also provides a number of additional tools.
Commit b3515bf0e31da5a28fcdf56313e0b1ff19ae88d3

Fix odd alteration of empty parameter list in C++
A Statements node was put between `(` and `)` tokens.
Author: xaizek
Author date (UTC): 2019-07-01 14:52
Committer name: xaizek
Committer date (UTC): 2019-07-01 14:52
Parent(s): fd122cf26c536d82b4412452b34e8413360635ad
Signing key: 99DC5E4DB05F6BE2
Tree: 81a0a48a586bee1509cc643d2c8a437ced41ddba
File Lines added Lines deleted
src/srcml/cxx/SrcmlCxxLanguage.cpp 12 7
File src/srcml/cxx/SrcmlCxxLanguage.cpp changed (mode: 100644) (index 36c38e3..5203628)
... ... static void postProcessBlock(PNode *node, TreeBuilder &tb,
38 38 static void postProcessParameterList(PNode *node, TreeBuilder &tb, static void postProcessParameterList(PNode *node, TreeBuilder &tb,
39 39 const std::string &contents); const std::string &contents);
40 40 static bool breakLeaf(PNode *node, TreeBuilder &tb, static bool breakLeaf(PNode *node, TreeBuilder &tb,
41 const std::string &contents, char left, char right);
41 const std::string &contents, char left, char right,
42 SrcmlCxxSType newChild);
42 43 static void dropLeadingWS(PNode *node, const std::string &contents); static void dropLeadingWS(PNode *node, const std::string &contents);
43 44 static void postProcessConditional(PNode *node, TreeBuilder &tb, static void postProcessConditional(PNode *node, TreeBuilder &tb,
44 45 const std::string &contents); const std::string &contents);
 
... ... postProcessBlock(PNode *node, TreeBuilder &tb, const std::string &contents)
266 267 } }
267 268
268 269 // Children: `{}` (with any whitespace in between). // Children: `{}` (with any whitespace in between).
269 if (breakLeaf(node, tb, contents, '{', '}')) {
270 if (breakLeaf(node, tb, contents, '{', '}', SrcmlCxxSType::Statements)) {
270 271 return; return;
271 272 } }
272 273
 
... ... postProcessParameterList(PNode *node, TreeBuilder &tb,
284 285 const std::string &contents) const std::string &contents)
285 286 { {
286 287 // Children: `()` (with any whitespace in between). // Children: `()` (with any whitespace in between).
287 if (breakLeaf(node, tb, contents, '(', ')')) {
288 if (breakLeaf(node, tb, contents, '(', ')', SrcmlCxxSType::None)) {
288 289 return; return;
289 290 } }
290 291 } }
 
... ... postProcessParameterList(PNode *node, TreeBuilder &tb,
293 294 // rewritten. // rewritten.
294 295 static bool static bool
295 296 breakLeaf(PNode *node, TreeBuilder &tb, const std::string &contents, breakLeaf(PNode *node, TreeBuilder &tb, const std::string &contents,
296 char left, char right)
297 char left, char right, SrcmlCxxSType newChild)
297 298 { {
298 299 // Children: `<left><right>` (with any whitespace in between). // Children: `<left><right>` (with any whitespace in between).
299 300 if (node->children.size() == 1 && if (node->children.size() == 1 &&
 
... ... breakLeaf(PNode *node, TreeBuilder &tb, const std::string &contents,
319 320 right->value.token = static_cast<int>(Type::RightBrackets); right->value.token = static_cast<int>(Type::RightBrackets);
320 321 dropLeadingWS(right, contents); dropLeadingWS(right, contents);
321 322
322 PNode *stmts = tb.addNode();
323 stmts->stype = +SrcmlCxxSType::Statements;
323 if (newChild == SrcmlCxxSType::None) {
324 node->children.assign({ left, right });
325 } else {
326 PNode *stmts = tb.addNode();
327 stmts->stype = +newChild;
324 328
325 node->children.assign({ left, stmts, right });
329 node->children.assign({ left, stmts, right });
330 }
326 331 return true; return true;
327 332 } }
328 333 return false; return false;
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/zograscope

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/zograscope

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master