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

28
LINES

< > BotCompany Repo | #1021748 // dm_gazelle_wireStatementConditions

JavaX fragment (include)

svoid dm_gazelle_wireStatementConditions() {
  for (T3<S> t : dm_gazelle_allRulesWithComment("in 2 = statement"))
    dm_gazelle_wireStatementConditions(/*assertGlobalID*/(t.c));
}

svoid dm_gazelle_wireStatementConditions(S ruleID) pcall {
  PairS p = dm_textAndCommentForRule(ruleID);
  LS lines = tlft(p.a);
  new Matches m;
  LS comments = lines(p.b);
  bool change = false;
  for i over comments: {
    if (match("in * = statement", comments.get(i), m)) {
      int line = parseInt($1);
      S s = dropPrefixTrim("+", get(lines, line-1));
      if (empty(s) || startsWith(s, "=>")) continue; // avoid any weird stuff
      S ruleID2 = dm_gazelle_findRuleForStatementCondition(s);
      if (ruleID2 == null) {
        print("No statement rule found for: " + s + ", making one");
        ruleID2 = pairA(dm_gazelle_addRuleWithComment(s + "\n=> statement", "in = statement\n" + "made for rule " + ruleID + "\n" + p.b);
      }
      comments.set(i, "in " + line + " = statement " + ruleID2);
      set change;
    }
  }
  if (change)
    dm_gazelle_setRuleComments_verbose(ruleID, lines(comments));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1021748
Snippet name: dm_gazelle_wireStatementConditions
Eternal ID of this version: #1021748/12
Text MD5: 8be345a4b9d537be140d8b3a5ce7d1c8
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-04 13:00:48
Source code size: 1130 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 328 / 380
Version history: 11 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)