Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 33x 1x 33x 33x 33x 1x 120x 120x 120x 120x 120x 120x 120x 120x 120x 120x 120x 120x 120x 120x 120x 117x 117x 120x 120x 120x 120x 120x 1x 68x 68x 68x 68x 68x 68x 68x 68x 68x 68x 68x 48x 68x 20x 20x 68x 68x 1x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 106x 106x 51x 51x 51x 51x 51x 51x 106x 106x 34x 7x 7x 7x 7x 7x 7x 34x 1x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 67x 17x 17x 1x 17x 17x 17x 17x 17x 17x 17x 17x 17x 1x 1x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 34x 122x 122x 122x 122x 122x 182x 182x 182x 128x 128x 128x 128x 182x 54x 54x 54x 33x 33x 33x 33x 33x 54x 182x 122x 34x 34x 1x 18x 18x 18x 18x 18x 18x 18x 18x 18x 18x 1x 1x 1x 17x 17x 17x 17x 17x 18x 1x 1x 69x 69x 69x 69x 69x 69x 69x 69x 69x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_syntax_highlighter.clas.abap class zcl_abapgit_syntax_highlighter { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER'; static IMPLEMENTED_INTERFACES = []; static ATTRIBUTES = {"MT_RULES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "regex": new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_rule-token"}), "style": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-STYLE"}), "relevant_submatch": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-RELEVANT_SUBMATCH"})}, "zcl_abapgit_syntax_highlighter=>ty_rule", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "");}, "visibility": "O", "is_constant": " ", "is_class": " "}, "MV_HIDDEN_CHARS": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "visibility": "O", "is_constant": " ", "is_class": " "}, "C_TOKEN_NONE": {"type": () => {return new abap.types.Character(1, {});}, "visibility": "O", "is_constant": "X", "is_class": "X"}}; static METHODS = {"ADD_RULE": {"visibility": "O", "parameters": {"IV_REGEX": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_TOKEN": {"type": () => {return new abap.types.Character();}, "is_optional": " "}, "IV_STYLE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_SUBMATCH": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " "}}}, "PARSE_LINE": {"visibility": "O", "parameters": {"RT_MATCHES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt");}, "is_optional": " "}, "IV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "ORDER_MATCHES": {"visibility": "O", "parameters": {"IV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "CT_MATCHES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt");}, "is_optional": " "}}}, "EXTEND_MATCHES": {"visibility": "O", "parameters": {"IV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "CT_MATCHES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt");}, "is_optional": " "}}}, "FORMAT_LINE": {"visibility": "O", "parameters": {"RV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IT_MATCHES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt");}, "is_optional": " "}}}, "APPLY_STYLE": {"visibility": "O", "parameters": {"RV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_CLASS": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "IS_WHITESPACE": {"visibility": "O", "parameters": {"RV_RESULT": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}, "IV_STRING": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "SHOW_HIDDEN_CHARS": {"visibility": "O", "parameters": {"RV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "PROCESS_LINE": {"visibility": "U", "parameters": {"RV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "SET_HIDDEN_CHARS": {"visibility": "U", "parameters": {"IV_HIDDEN_CHARS": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}}}; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "add_rule": this.add_rule.bind(this), "parse_line": this.parse_line.bind(this), "order_matches": this.order_matches.bind(this), "extend_matches": this.extend_matches.bind(this), "format_line": this.format_line.bind(this), "apply_style": this.apply_style.bind(this), "is_whitespace": this.is_whitespace.bind(this), "show_hidden_chars": this.show_hidden_chars.bind(this), "process_line": this.process_line.bind(this), "set_hidden_chars": this.set_hidden_chars.bind(this), }; this.mt_rules = abap.types.TableFactory.construct(new abap.types.Structure({ "regex": new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_rule-token"}), "style": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-STYLE"}), "relevant_submatch": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-RELEVANT_SUBMATCH"})}, "zcl_abapgit_syntax_highlighter=>ty_rule", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, ""); this.mv_hidden_chars = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); this.c_token_none = zcl_abapgit_syntax_highlighter.c_token_none; } async constructor_(INPUT) { if (super.constructor_) { await super.constructor_(INPUT); } return this; } async add_rule(INPUT) { let iv_regex = INPUT?.iv_regex; if (iv_regex?.getQualifiedName === undefined || iv_regex.getQualifiedName() !== "STRING") { iv_regex = undefined; } if (iv_regex === undefined) { iv_regex = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_regex); } let iv_token = INPUT?.iv_token; let iv_style = INPUT?.iv_style; if (iv_style?.getQualifiedName === undefined || iv_style.getQualifiedName() !== "STRING") { iv_style = undefined; } if (iv_style === undefined) { iv_style = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_style); } let iv_submatch = new abap.types.Integer({qualifiedName: "I"}); if (INPUT && INPUT.iv_submatch) {iv_submatch.set(INPUT.iv_submatch);} let ls_rule = new abap.types.Structure({ "regex": new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_rule-token"}), "style": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-STYLE"}), "relevant_submatch": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-RELEVANT_SUBMATCH"})}, "zcl_abapgit_syntax_highlighter=>ty_rule", undefined, {}, {}); if (abap.compare.initial(iv_regex) === false) { ls_rule.get().regex.set(await (new abap.Classes['CL_ABAP_REGEX']()).constructor_({pattern: iv_regex, ignore_case: abap.builtin.abap_true})); } ls_rule.get().token.set(iv_token); ls_rule.get().style.set(iv_style); ls_rule.get().relevant_submatch.set(iv_submatch); abap.statements.append({source: ls_rule, target: this.mt_rules}); } async apply_style(INPUT) { let rv_line = new abap.types.String({qualifiedName: "STRING"}); let iv_line = INPUT?.iv_line; if (iv_line?.getQualifiedName === undefined || iv_line.getQualifiedName() !== "STRING") { iv_line = undefined; } if (iv_line === undefined) { iv_line = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_line); } let iv_class = INPUT?.iv_class; if (iv_class?.getQualifiedName === undefined || iv_class.getQualifiedName() !== "STRING") { iv_class = undefined; } if (iv_class === undefined) { iv_class = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_class); } let lv_escaped = new abap.types.String({qualifiedName: "STRING"}); lv_escaped.set(abap.builtin.escape({val: iv_line, format: abap.Classes['CL_ABAP_FORMAT'].e_html_text})); lv_escaped.set((await this.show_hidden_chars({iv_line: lv_escaped}))); if (abap.compare.initial(iv_class) === false) { rv_line.set(new abap.types.String().set(`<span class="${abap.templateFormatting(iv_class)}">${abap.templateFormatting(lv_escaped)}</span>`)); } else { rv_line.set(lv_escaped); } return rv_line; } async extend_matches(INPUT) { let iv_line = INPUT?.iv_line; if (iv_line?.getQualifiedName === undefined || iv_line.getQualifiedName() !== "STRING") { iv_line = undefined; } if (iv_line === undefined) { iv_line = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_line); } let ct_matches = abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt"); if (INPUT && INPUT.ct_matches) {ct_matches = INPUT.ct_matches;} let lv_line_len = new abap.types.Integer({qualifiedName: "I"}); let lv_last_pos = new abap.types.Integer({qualifiedName: "I"}); lv_last_pos.set(0); let lv_length = new abap.types.Integer({qualifiedName: "I"}); let ls_match = new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}); let fs_ls_match_ = new abap.types.FieldSymbol(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {})); lv_line_len.set(abap.builtin.strlen({val: iv_line})); abap.statements.sort(ct_matches,{by: [{component: "offset"}]}); for await (const unique651 of abap.statements.loop(ct_matches)) { fs_ls_match_.assign(unique651); if (abap.compare.gt(fs_ls_match_.get().offset, lv_last_pos)) { lv_length.set(abap.operators.minus(fs_ls_match_.get().offset,lv_last_pos)); ls_match.get().token.set(zcl_abapgit_syntax_highlighter.c_token_none); ls_match.get().offset.set(lv_last_pos); ls_match.get().length.set(lv_length); abap.statements.insertInternal({data: ls_match, index: abap.builtin.sy.get().tabix, table: ct_matches}); } lv_last_pos.set(abap.operators.add(fs_ls_match_.get().offset,fs_ls_match_.get().length)); } if (abap.compare.gt(lv_line_len, lv_last_pos)) { lv_length.set(abap.operators.minus(lv_line_len,lv_last_pos)); ls_match.get().token.set(zcl_abapgit_syntax_highlighter.c_token_none); ls_match.get().offset.set(lv_last_pos); ls_match.get().length.set(lv_length); abap.statements.append({source: ls_match, target: ct_matches}); } } async format_line(INPUT) { let rv_line = new abap.types.String({qualifiedName: "STRING"}); let iv_line = INPUT?.iv_line; if (iv_line?.getQualifiedName === undefined || iv_line.getQualifiedName() !== "STRING") { iv_line = undefined; } if (iv_line === undefined) { iv_line = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_line); } let it_matches = INPUT?.it_matches; if (it_matches?.getQualifiedName === undefined || it_matches.getQualifiedName() !== "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH_TT") { it_matches = undefined; } if (it_matches === undefined) { it_matches = abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt").set(INPUT.it_matches); } let lv_chunk = new abap.types.String({qualifiedName: "STRING"}); let ls_rule = new abap.types.Structure({ "regex": new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_rule-token"}), "style": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-STYLE"}), "relevant_submatch": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-RELEVANT_SUBMATCH"})}, "zcl_abapgit_syntax_highlighter=>ty_rule", undefined, {}, {}); let fs_ls_match_ = new abap.types.FieldSymbol(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {})); for await (const unique652 of abap.statements.loop(it_matches)) { fs_ls_match_.assign(unique652); lv_chunk.set(abap.builtin.substring({val: iv_line, off: fs_ls_match_.get().offset, len: fs_ls_match_.get().length})); ls_rule.clear(); abap.statements.readTable(this.mt_rules,{into: ls_rule, withKey: (i) => {return abap.compare.eq(i.token, fs_ls_match_.get().token);}, withKeyValue: [{key: (i) => {return i.token}, value: fs_ls_match_.get().token}], usesTableLine: false, withKeySimple: {"token": fs_ls_match_.get().token}}); lv_chunk.set((await this.apply_style({iv_line: lv_chunk, iv_class: ls_rule.get().style}))); rv_line.set(abap.operators.concat(rv_line,lv_chunk)); } return rv_line; } async is_whitespace(INPUT) { let rv_result = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); let iv_string = INPUT?.iv_string; if (iv_string?.getQualifiedName === undefined || iv_string.getQualifiedName() !== "STRING") { iv_string = undefined; } if (iv_string === undefined) { iv_string = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_string); } let lv_whitespace = new abap.types.String({qualifiedName: "STRING"}); lv_whitespace.set(abap.operators.concat(new abap.types.String().set(` `),abap.operators.concat(abap.Classes['CL_ABAP_CHAR_UTILITIES'].horizontal_tab,abap.Classes['CL_ABAP_CHAR_UTILITIES'].cr_lf))); rv_result.set(abap.builtin.boolc(abap.compare.co(iv_string, lv_whitespace))); return rv_result; } async order_matches(INPUT) { let iv_line = INPUT?.iv_line; if (iv_line?.getQualifiedName === undefined || iv_line.getQualifiedName() !== "STRING") { iv_line = undefined; } if (iv_line === undefined) { iv_line = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_line); } let ct_matches = abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt"); if (INPUT && INPUT.ct_matches) {ct_matches = INPUT.ct_matches;} } async parse_line(INPUT) { let rt_matches = abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt"); let iv_line = INPUT?.iv_line; if (iv_line?.getQualifiedName === undefined || iv_line.getQualifiedName() !== "STRING") { iv_line = undefined; } if (iv_line === undefined) { iv_line = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_line); } let lo_regex = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}); let lo_matcher = new abap.types.ABAPObject({qualifiedName: "CL_ABAP_MATCHER", RTTIName: "\\CLASS=CL_ABAP_MATCHER"}); let lt_result = abap.types.TableFactory.construct(new abap.types.Structure({ "line": new abap.types.Integer({qualifiedName: "I"}), "offset": new abap.types.Integer({qualifiedName: "I"}), "length": new abap.types.Integer({qualifiedName: "I"}), "submatches": abap.types.TableFactory.construct(new abap.types.Structure({ "offset": new abap.types.Integer({qualifiedName: "I"}), "length": new abap.types.Integer({qualifiedName: "I"})}, "SUBMATCH_RESULT", "SUBMATCH_RESULT", {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "SUBMATCH_RESULT_TAB")}, "MATCH_RESULT", "MATCH_RESULT", {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "MATCH_RESULT_TAB"); let ls_match = new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}); let fs_ls_regex_ = new abap.types.FieldSymbol(new abap.types.Structure({ "regex": new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_rule-token"}), "style": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-STYLE"}), "relevant_submatch": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-RELEVANT_SUBMATCH"})}, "zcl_abapgit_syntax_highlighter=>ty_rule", undefined, {}, {})); let fs_ls_result_ = new abap.types.FieldSymbol(new abap.types.Structure({ "line": new abap.types.Integer({qualifiedName: "I"}), "offset": new abap.types.Integer({qualifiedName: "I"}), "length": new abap.types.Integer({qualifiedName: "I"}), "submatches": abap.types.TableFactory.construct(new abap.types.Structure({ "offset": new abap.types.Integer({qualifiedName: "I"}), "length": new abap.types.Integer({qualifiedName: "I"})}, "SUBMATCH_RESULT", "SUBMATCH_RESULT", {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "SUBMATCH_RESULT_TAB")}, "MATCH_RESULT", "MATCH_RESULT", {}, {})); let fs_ls_submatch_ = new abap.types.FieldSymbol(new abap.types.Structure({ "offset": new abap.types.Integer({qualifiedName: "I"}), "length": new abap.types.Integer({qualifiedName: "I"})}, "SUBMATCH_RESULT", "SUBMATCH_RESULT", {}, {})); for await (const unique653 of abap.statements.loop(this.mt_rules,{where: async (I) => {return abap.compare.initial(I.regex) === false;}})) { fs_ls_regex_.assign(unique653); lo_regex.set(fs_ls_regex_.get().regex); lo_matcher.set((await lo_regex.get().create_matcher({text: iv_line}))); lt_result.set((await lo_matcher.get().find_all())); for await (const unique654 of abap.statements.loop(lt_result)) { fs_ls_result_.assign(unique654); ls_match.clear(); if (abap.compare.eq(fs_ls_regex_.get().relevant_submatch, abap.IntegerFactory.get(0))) { ls_match.get().token.set(fs_ls_regex_.get().token); ls_match.get().offset.set(fs_ls_result_.get().offset); ls_match.get().length.set(fs_ls_result_.get().length); abap.statements.append({source: ls_match, target: rt_matches}); } else { abap.statements.readTable(fs_ls_result_.get().submatches,{index: fs_ls_regex_.get().relevant_submatch, assigning: fs_ls_submatch_}); if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0)) && abap.compare.ge(fs_ls_submatch_.get().offset, abap.IntegerFactory.get(0)) && abap.compare.gt(fs_ls_submatch_.get().length, abap.IntegerFactory.get(0))) { ls_match.get().token.set(fs_ls_regex_.get().token); ls_match.get().offset.set(fs_ls_submatch_.get().offset); ls_match.get().length.set(fs_ls_submatch_.get().length); abap.statements.append({source: ls_match, target: rt_matches}); } } } } return rt_matches; } async process_line(INPUT) { let rv_line = new abap.types.String({qualifiedName: "STRING"}); let iv_line = INPUT?.iv_line; if (iv_line?.getQualifiedName === undefined || iv_line.getQualifiedName() !== "STRING") { iv_line = undefined; } if (iv_line === undefined) { iv_line = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_line); } let lt_matches = abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt"); if (abap.compare.initial(iv_line) || abap.compare.eq((await this.is_whitespace({iv_string: iv_line})), abap.builtin.abap_true)) { rv_line.set((await this.show_hidden_chars({iv_line: iv_line}))); return rv_line; } lt_matches.set((await this.parse_line({iv_line: iv_line}))); await this.order_matches({iv_line: iv_line, ct_matches: lt_matches}); await this.extend_matches({iv_line: iv_line, ct_matches: lt_matches}); rv_line.set((await this.format_line({iv_line: iv_line, it_matches: lt_matches}))); return rv_line; } async set_hidden_chars(INPUT) { let iv_hidden_chars = INPUT?.iv_hidden_chars; if (iv_hidden_chars?.getQualifiedName === undefined || iv_hidden_chars.getQualifiedName() !== "ABAP_BOOL") { iv_hidden_chars = undefined; } if (iv_hidden_chars === undefined) { iv_hidden_chars = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}).set(INPUT.iv_hidden_chars); } this.mv_hidden_chars.set(iv_hidden_chars); } async show_hidden_chars(INPUT) { let rv_line = new abap.types.String({qualifiedName: "STRING"}); let iv_line = INPUT?.iv_line; if (iv_line?.getQualifiedName === undefined || iv_line.getQualifiedName() !== "STRING") { iv_line = undefined; } if (iv_line === undefined) { iv_line = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_line); } let lv_bom = new abap.types.Hex({length: 3}); rv_line.set(iv_line); if (abap.compare.eq(this.mv_hidden_chars, abap.builtin.abap_true)) { abap.statements.replace({target: rv_line, all: true, with: abap.CharacterFactory.get(18, ' → '), of: abap.Classes['CL_ABAP_CHAR_UTILITIES'].horizontal_tab}); abap.statements.replace({target: rv_line, all: true, with: abap.CharacterFactory.get(6, '¶'), of: abap.Classes['CL_ABAP_CHAR_UTILITIES'].cr_lf}); abap.statements.replace({target: rv_line, all: true, with: abap.CharacterFactory.get(7, '↵'), of: abap.Classes['CL_ABAP_CHAR_UTILITIES'].newline}); abap.statements.replace({target: rv_line, all: true, with: abap.CharacterFactory.get(6, '¶'), of: abap.Classes['CL_ABAP_CHAR_UTILITIES'].cr_lf.getOffset({length: 1})}); abap.statements.replace({target: rv_line, all: true, with: abap.CharacterFactory.get(8, '·'), of: new abap.types.String().set(` `)}); abap.statements.replace({target: rv_line, all: true, with: abap.CharacterFactory.get(32, '<span class="red">⊝</span>'), of: abap.Classes['CL_ABAP_CHAR_UTILITIES'].form_feed}); if (abap.compare.between(abap.builtin.strlen({val: rv_line}), abap.IntegerFactory.get(1), abap.IntegerFactory.get(2))) { try { lv_bom.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].string_to_xstring({iv_str: rv_line}))); } catch (e) { if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) { } else { throw e; } } if (abap.compare.eq(lv_bom.getOffset({length: 2}), abap.Classes['CL_ABAP_CHAR_UTILITIES'].byte_order_mark_big)) { rv_line.set(abap.CharacterFactory.get(31, '<span class="red">▪</span>')); } if (abap.compare.eq(lv_bom.getOffset({length: 2}), abap.Classes['CL_ABAP_CHAR_UTILITIES'].byte_order_mark_little)) { rv_line.set(abap.CharacterFactory.get(33, '<span class="red">∘</span>')); } if (abap.compare.eq(lv_bom.getOffset({length: 3}), abap.Classes['CL_ABAP_CHAR_UTILITIES'].byte_order_mark_utf8)) { rv_line.set(abap.CharacterFactory.get(33, '<span class="red">¤</span>')); } } } return rv_line; } } abap.Classes['ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER'] = zcl_abapgit_syntax_highlighter; zcl_abapgit_syntax_highlighter.c_token_none = new abap.types.Character(1, {}); zcl_abapgit_syntax_highlighter.c_token_none.set('.'); zcl_abapgit_syntax_highlighter.ty_match = new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}); zcl_abapgit_syntax_highlighter.ty_match_tt = abap.types.TableFactory.construct(new abap.types.Structure({ "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_match-token"}), "offset": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-OFFSET"}), "length": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-LENGTH"}), "text_tag": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_MATCH-TEXT_TAG"})}, "zcl_abapgit_syntax_highlighter=>ty_match", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_syntax_highlighter=>ty_match_tt"); zcl_abapgit_syntax_highlighter.ty_rule = new abap.types.Structure({ "regex": new abap.types.ABAPObject({qualifiedName: "CL_ABAP_REGEX", RTTIName: "\\CLASS=CL_ABAP_REGEX"}), "token": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_syntax_highlighter=>ty_rule-token"}), "style": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-STYLE"}), "relevant_submatch": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_SYNTAX_HIGHLIGHTER=>TY_RULE-RELEVANT_SUBMATCH"})}, "zcl_abapgit_syntax_highlighter=>ty_rule", undefined, {}, {}); export {zcl_abapgit_syntax_highlighter}; |