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

24
LINES

< > BotCompany Repo | #1021356 // dm_importTextIntoRulesModule

JavaX fragment (include)

svoid dm_importTextIntoRulesModule(S text) {
  for (S ruleText : ai_splitEntriesWithMultipleDoubleArrows(splitAtEmptyLines(text))) {
    new LS comments;
    ruleText = gazelle_processSquareBracketAnnotations(ruleText, comments);
    new Matches m;
    S id = null;
    for (S s : comments)
      if "id: *" {
        id = $1;
        comments.remove(s);
        break;
      }
      
    if (id == null) {
      print("Importing ID-less rule (better provide an ID!): " + ruleText);
      call(dm_call(gazelle_rulesModule(),
        'uniqConcept, id), '_uniqConcept, text := ruleText, comments := lines_rtrim(comments));
    } else {
      print("Importing rule: " + id);
      call(dm_call(gazelle_rulesModule(), 'uniqConcept, globalID := id),
        '_setFields, text := ruleText, comments := lines_rtrim(comments));
    }
  }
}

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: #1021356
Snippet name: dm_importTextIntoRulesModule
Eternal ID of this version: #1021356/6
Text MD5: 4647aca1a9eac179d4d5067a2c8e84f5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-24 12:27:04
Source code size: 854 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 223 / 266
Version history: 5 change(s)
Referenced in: [show references]