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

20
LINES

< > BotCompany Repo | #1021782 // gazelle_processSquareBracketAnnotations - extract comments from rule text

JavaX fragment (include)

// return new rule text, add comments to comments
sS gazelle_processSquareBracketAnnotations(S ruleText, LS comments) {
  LS lines = tlft(ruleText);
  while (isSquareBracketed(last(lines)))
    comments.add(deSquareBracket(popLast(lines)));
    
  int out = -1;
  for i over lines: {
    S s = lines.get(i);
    PairS p = splitTrailingSquareBracketStuff(s);
    if (startsWith(s, "=>")) out = i;
    if (nempty(p.b))
      comments.add(
        (out >= 0 ? i == out && i == l(lines)-1 ? "out" : "out " + (i-out+1) : "in " + (i+1))
        + " = " + gazelle_canonicalizeLineType(p.b));
    lines.set(i, p.a);
  }
 
  ret lines_rtrim(lines);
}

Author comment

Began life as a copy of #1021762

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1021782
Snippet name: gazelle_processSquareBracketAnnotations - extract comments from rule text
Eternal ID of this version: #1021782/6
Text MD5: 6cf1fb335438ebbd675328c5d8c2cc9f
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-23 17:25:50
Source code size: 660 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 200 / 249
Version history: 5 change(s)
Referenced in: [show references]