1/*--------------------------------------------------------------------------------------------- 2 * Copyright (c) Microsoft Corporation. All rights reserved. 3 * Licensed under the MIT License. See License.txt in the project root for license information. 4 *--------------------------------------------------------------------------------------------*/ 5'use strict'; 6export var conf = { 7 comments: { 8 lineComment: '*', 9 }, 10 brackets: [ 11 ['[', ']'], 12 ['(', ')'], 13 ], 14}; 15var abapKeywords = [ 16 'abstract', 17 'add', 18 'add-corresponding', 19 'adjacent', 20 'alias', 21 'aliases', 22 'all', 23 'append', 24 'appending', 25 'ascending', 26 'as', 27 'assert', 28 'assign', 29 'assigned', 30 'assigning', 31 'association', 32 'authority-check', 33 'back', 34 'begin', 35 'binary', 36 'block', 37 'bound', 38 'break-point', 39 'by', 40 'byte', 41 'class', 42 'call', 43 'cast', 44 'changing', 45 'check', 46 'class-data', 47 'class-method', 48 'class-methods', 49 'clear', 50 'close', 51 'cnt', 52 'collect', 53 'commit', 54 'cond', 55 'character', 56 'corresponding', 57 'communication', 58 'component', 59 'compute', 60 'concatenate', 61 'condense', 62 'constants', 63 'conv', 64 'count', 65 'controls', 66 'convert', 67 'create', 68 'currency', 69 'data', 70 'descending', 71 'default', 72 'define', 73 'deferred', 74 'delete', 75 'describe', 76 'detail', 77 'display', 78 'divide', 79 'divide-corresponding', 80 'display-mode', 81 'duplicates', 82 'deleting', 83 'editor-call', 84 'end', 85 'endexec', 86 'endfunction', 87 'ending', 88 'endmodule', 89 'end-of-definition', 90 'end-of-page', 91 'end-of-selection', 92 'end-test-injection', 93 'end-test-seam', 94 'exit-command', 95 'endclass', 96 'endmethod', 97 'endform', 98 'endinterface', 99 'endprovide', 100 'endselect', 101 'endtry', 102 'endwhile', 103 'enum', 104 'event', 105 'events', 106 'exec', 107 'exit', 108 'export', 109 'exporting', 110 'extract', 111 'exception', 112 'exceptions', 113 'field-symbols', 114 'field-groups', 115 'field', 116 'first', 117 'fetch', 118 'fields', 119 'format', 120 'frame', 121 'free', 122 'from', 123 'function', 124 'find', 125 'for', 126 'found', 127 'function-pool', 128 'generate', 129 'get', 130 'handle', 131 'hide', 132 'hashed', 133 'include', 134 'import', 135 'importing', 136 'index', 137 'infotypes', 138 'initial', 139 'initialization', 140 'id', 141 'is', 142 'in', 143 'interface', 144 'interfaces', 145 'init', 146 'input', 147 'insert', 148 'instance', 149 'into', 150 'key', 151 'left-justified', 152 'leave', 153 'like', 154 'line', 155 'line-count', 156 'line-size', 157 'load', 158 'local', 159 'log-point', 160 'length', 161 'left', 162 'leading', 163 'lower', 164 'matchcode', 165 'method', 166 'mesh', 167 'message', 168 'message-id', 169 'methods', 170 'modify', 171 'module', 172 'move', 173 'move-corresponding', 174 'multiply', 175 'multiply-corresponding', 176 'match', 177 'new', 178 'new-line', 179 'new-page', 180 'new-section', 181 'next', 182 'no', 183 'no-gap', 184 'no-gaps', 185 'no-sign', 186 'no-zero', 187 'non-unique', 188 'number', 189 'occurrence', 190 'object', 191 'obligatory', 192 'of', 193 'output', 194 'overlay', 195 'optional', 196 'others', 197 'occurrences', 198 'occurs', 199 'offset', 200 'options', 201 'pack', 202 'parameters', 203 'perform', 204 'places', 205 'position', 206 'print-control', 207 'private', 208 'program', 209 'protected', 210 'provide', 211 'public', 212 'put', 213 'radiobutton', 214 'raising', 215 'ranges', 216 'receive', 217 'receiving', 218 'redefinition', 219 'reduce', 220 'reference', 221 'refresh', 222 'regex', 223 'reject', 224 'results', 225 'requested', 226 'ref', 227 'replace', 228 'report', 229 'reserve', 230 'restore', 231 'result', 232 'return', 233 'returning', 234 'right-justified', 235 'rollback', 236 'read', 237 'read-only', 238 'rp-provide-from-last', 239 'run', 240 'scan', 241 'screen', 242 'scroll', 243 'search', 244 'select', 245 'select-options', 246 'selection-screen', 247 'stamp', 248 'source', 249 'subkey', 250 'separated', 251 'set', 252 'shift', 253 'single', 254 'skip', 255 'sort', 256 'sorted', 257 'split', 258 'standard', 259 'stamp', 260 'starting', 261 'start-of-selection', 262 'sum', 263 'subtract-corresponding', 264 'statics', 265 'step', 266 'stop', 267 'structure', 268 'submatches', 269 'submit', 270 'subtract', 271 'summary', 272 'supplied', 273 'suppress', 274 'section', 275 'syntax-check', 276 'syntax-trace', 277 'system-call', 278 'switch', 279 'tables', 280 'table', 281 'task', 282 'testing', 283 'test-seam', 284 'test-injection', 285 'then', 286 'time', 287 'times', 288 'title', 289 'titlebar', 290 'to', 291 'top-of-page', 292 'trailing', 293 'transfer', 294 'transformation', 295 'translate', 296 'transporting', 297 'types', 298 'type', 299 'type-pool', 300 'type-pools', 301 'unassign', 302 'unique', 303 'uline', 304 'unpack', 305 'update', 306 'upper', 307 'using', 308 'value', 309 'when', 310 'while', 311 'window', 312 'write', 313 'where', 314 'with', 315 'work', 316 'at', 317 'case', 318 'catch', 319 'continue', 320 'do', 321 'elseif', 322 'else', 323 'endat', 324 'endcase', 325 'enddo', 326 'endif', 327 'endloop', 328 'endon', 329 'if', 330 'loop', 331 'on', 332 'raise', 333 'try', 334 'abs', 335 'sign', 336 'ceil', 337 'floor', 338 'trunc', 339 'frac', 340 'acos', 341 'asin', 342 'atan', 343 'cos', 344 'sin', 345 'tan', 346 'cosh', 347 'sinh', 348 'tanh', 349 'exp', 350 'log', 351 'log10', 352 'sqrt', 353 'strlen', 354 'xstrlen', 355 'charlen', 356 'lines', 357 'numofchar', 358 'dbmaxlen', 359 'round', 360 'rescale', 361 'nmax', 362 'nmin', 363 'cmax', 364 'cmin', 365 'boolc', 366 'boolx', 367 'xsdbool', 368 'contains', 369 'contains_any_of', 370 'contains_any_not_of', 371 'matches', 372 'line_exists', 373 'ipow', 374 'char_off', 375 'count', 376 'count_any_of', 377 'count_any_not_of', 378 'distance', 379 'condense', 380 'concat_lines_of', 381 'escape', 382 'find', 383 'find_end', 384 'find_any_of', 385 'find_any_not_of', 386 'insert', 387 'match', 388 'repeat', 389 'replace', 390 'reverse', 391 'segment', 392 'shift_left', 393 'shift_right', 394 'substring', 395 'substring_after', 396 'substring_from', 397 'substring_before', 398 'substring_to', 399 'to_upper', 400 'to_lower', 401 'to_mixed', 402 'from_mixed', 403 'translate', 404 'bit-set', 405 'line_index', 406 'definition', 407 'implementation', 408 'public', 409 'inheriting', 410 'final', 411]; 412export var language = { 413 defaultToken: 'invalid', 414 ignoreCase: true, 415 tokenPostfix: '.abap', 416 keywords: abapKeywords, 417 typeKeywords: [ 418 'abap_bool', 419 'string', 420 'xstring', 421 'any', 422 'clike', 423 'csequence', 424 'numeric', 425 'xsequence', 426 'c', 427 'n', 428 'i', 429 'p', 430 'f', 431 'd', 432 't', 433 'x', 434 ], 435 operators: [ 436 '+', 437 '-', 438 '/', 439 '*', 440 '=', 441 '<', 442 '>', 443 '<=', 444 '>=', 445 '<>', 446 '><', 447 '=<', 448 '=>', 449 'EQ', 450 'NE', 451 'GE', 452 'LE', 453 'CS', 454 'CN', 455 'CA', 456 'CO', 457 'CP', 458 'NS', 459 'NA', 460 'NP', 461 ], 462 symbols: /[=><!~?&+\-*\/\^%]+/, 463 tokenizer: { 464 root: [ 465 [ 466 /[a-z_$][\w$]*/, 467 { 468 cases: { 469 '@typeKeywords': 'keyword', 470 '@keywords': 'keyword', 471 '@default': 'identifier', 472 }, 473 }, 474 ], 475 { include: '@whitespace' }, 476 [/[:,.]/, 'delimiter'], 477 [/[{}()\[\]]/, '@brackets'], 478 [/@symbols/, { cases: { '@operators': 'operator', '@default': '' } }], 479 [/'/, { token: 'string', bracket: '@open', next: '@stringquote' }], 480 [/\|/, { token: 'string', bracket: '@open', next: '@stringtemplate' }], 481 [/\d+/, 'number'], 482 ], 483 stringtemplate: [ 484 [/[^\\\|]+/, 'string'], 485 [/\\\|/, 'string'], 486 [/\|/, { token: 'string', bracket: '@close', next: '@pop' }], 487 ], 488 stringquote: [ 489 [/[^\\']+/, 'string'], 490 [/'/, { token: 'string', bracket: '@close', next: '@pop' }], 491 ], 492 whitespace: [ 493 [/[ \t\r\n]+/, ''], 494 [/^\*.*$/, 'comment'], 495 [/\".*$/, 'comment'], 496 ], 497 }, 498}; 499