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

24
LINES

< > BotCompany Repo | #1021356 // dm_importTextIntoRulesModule

JavaX fragment (include)

1  
svoid dm_importTextIntoRulesModule(S text) {
2  
  for (S ruleText : ai_splitEntriesWithMultipleDoubleArrows(splitAtEmptyLines(text))) {
3  
    new LS comments;
4  
    ruleText = gazelle_processSquareBracketAnnotations(ruleText, comments);
5  
    new Matches m;
6  
    S id = null;
7  
    for (S s : comments)
8  
      if "id: *" {
9  
        id = $1;
10  
        comments.remove(s);
11  
        break;
12  
      }
13  
      
14  
    if (id == null) {
15  
      print("Importing ID-less rule (better provide an ID!): " + ruleText);
16  
      call(dm_call(gazelle_rulesModule(),
17  
        'uniqConcept, id), '_uniqConcept, text := ruleText, comments := lines_rtrim(comments));
18  
    } else {
19  
      print("Importing rule: " + id);
20  
      call(dm_call(gazelle_rulesModule(), 'uniqConcept, globalID := id),
21  
        '_setFields, text := ruleText, comments := lines_rtrim(comments));
22  
    }
23  
  }
24  
}

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: 226 / 270
Version history: 5 change(s)
Referenced in: [show references]