Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1017424 // ai_matchParseTrees

JavaX fragment (include)

1  
static L<Pair<PTElement>> ai_matchParseTrees(PTElement a, PTElement b) {
2  
  new L<Pair<PTElement>> out;
3  
  ai_matchParseTrees_collect(a, b, out);
4  
  ret out;
5  
}
6  
7  
svoid ai_matchParseTrees_collect(PTElement a, PTElement b, L<Pair<PTElement>> out) {
8  
  PTElement a2 = ai_parseTree_descendToComposite(a);
9  
  PTElement b2 = ai_parseTree_descendToComposite(b);
10  
  
11  
  PTElement aa = or(a2, a), bb = or(b2, b);
12  
  
13  
  if (a2 != null && b2 != null) {
14  
    ai_matchParseTrees_collect(first(a2.children), first(b2.children), out);
15  
    ai_matchParseTrees_collect(second(a2.children), second(b2.children), out);
16  
  } else
17  
    addPair(out, aa, bb);
18  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017424
Snippet name: ai_matchParseTrees
Eternal ID of this version: #1017424/3
Text MD5: d3db34d45d30e71f3a5cd5d2579c1bc8
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-20 14:51:19
Source code size: 642 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 387 / 421
Version history: 2 change(s)
Referenced in: [show references]