abap.js 7.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. define(["require", "exports"], function (require, exports) {
  6. 'use strict';
  7. Object.defineProperty(exports, "__esModule", { value: true });
  8. exports.conf = {
  9. comments: {
  10. lineComment: '*',
  11. },
  12. brackets: [
  13. ['[', ']'],
  14. ['(', ')']
  15. ],
  16. };
  17. var abapKeywords = [
  18. 'abstract', 'add', 'add-corresponding', 'adjacent', 'alias', 'aliases', 'all', 'append', 'appending', 'ascending', 'as', 'assert', 'assign', 'assigned', 'assigning', 'association', 'authority-check',
  19. 'back', 'begin', 'binary', 'block', 'bound', 'break-point', 'by', 'byte',
  20. 'class', 'call', 'cast', 'changing', 'check', 'class-data', 'class-method', 'class-methods', 'clear', 'close', 'cnt', 'collect', 'commit', 'cond', 'character',
  21. 'corresponding', 'communication', 'component', 'compute', 'concatenate', 'condense', 'constants', 'conv', 'count',
  22. 'controls', 'convert', 'create', 'currency',
  23. 'data', 'descending', 'default', 'define', 'deferred', 'delete', 'describe', 'detail', 'display', 'divide', 'divide-corresponding', 'display-mode', 'duplicates',
  24. 'deleting',
  25. 'editor-call', 'end', 'endexec', 'endfunction', 'ending', 'endmodule', 'end-of-definition', 'end-of-page', 'end-of-selection', 'end-test-injection', 'end-test-seam', 'exit-command', 'endclass', 'endmethod', 'endform', 'endinterface',
  26. 'endprovide', 'endselect', 'endtry', 'endwhile', 'enum', 'event', 'events', 'exec', 'exit', 'export',
  27. 'exporting', 'extract', 'exception', 'exceptions',
  28. 'field-symbols', 'field-groups', 'field', 'first', 'fetch', 'fields', 'format', 'frame', 'free', 'from', 'function', 'find', 'for', 'found', 'function-pool',
  29. 'generate', 'get',
  30. 'handle', 'hide', 'hashed',
  31. 'include', 'import', 'importing', 'index', 'infotypes', 'initial', 'initialization',
  32. 'id', 'is', 'in', 'interface', 'interfaces', 'init', 'input', 'insert', 'instance', 'into',
  33. 'key',
  34. 'left-justified', 'leave', 'like', 'line', 'line-count', 'line-size', 'load', 'local', 'log-point', 'length', 'left', 'leading', 'lower',
  35. 'matchcode', 'method', 'mesh', 'message', 'message-id', 'methods', 'modify', 'module', 'move', 'move-corresponding', 'multiply', 'multiply-corresponding', 'match',
  36. 'new', 'new-line', 'new-page', 'new-section', 'next', 'no', 'no-gap', 'no-gaps', 'no-sign', 'no-zero', 'non-unique', 'number',
  37. 'occurrence', 'object', 'obligatory', 'of', 'output', 'overlay', 'optional', 'others', 'occurrences', 'occurs', 'offset', 'options',
  38. 'pack', 'parameters', 'perform', 'places', 'position', 'print-control', 'private', 'program', 'protected', 'provide', 'public', 'put',
  39. 'radiobutton', 'raising', 'ranges', 'receive', 'receiving', 'redefinition', 'reduce', 'reference', 'refresh', 'regex', 'reject', 'results', 'requested',
  40. 'ref', 'replace', 'report', 'reserve', 'restore', 'result', 'return', 'returning', 'right-justified', 'rollback', 'read', 'read-only', 'rp-provide-from-last', 'run',
  41. 'scan', 'screen', 'scroll', 'search', 'select', 'select-options', 'selection-screen', 'stamp', 'source', 'subkey',
  42. 'separated', 'set', 'shift', 'single', 'skip', 'sort', 'sorted', 'split', 'standard', 'stamp', 'starting', 'start-of-selection', 'sum', 'subtract-corresponding', 'statics', 'step', 'stop', 'structure', 'submatches', 'submit', 'subtract', 'summary', 'supplied', 'suppress', 'section', 'syntax-check', 'syntax-trace', 'system-call', 'switch',
  43. 'tables', 'table', 'task', 'testing', 'test-seam', 'test-injection', 'then', 'time', 'times', 'title', 'titlebar', 'to', 'top-of-page', 'trailing', 'transfer', 'transformation', 'translate', 'transporting', 'types', 'type', 'type-pool', 'type-pools',
  44. 'unassign', 'unique', 'uline', 'unpack', 'update', 'upper', 'using',
  45. 'value',
  46. 'when', 'while', 'window', 'write', 'where', 'with', 'work',
  47. 'at', 'case', 'catch', 'continue', 'do', 'elseif', 'else', 'endat', 'endcase', 'enddo', 'endif', 'endloop', 'endon', 'if', 'loop', 'on', 'raise', 'try',
  48. 'abs', 'sign', 'ceil', 'floor', 'trunc', 'frac', 'acos', 'asin', 'atan', 'cos', 'sin', 'tan', 'cosh', 'sinh', 'tanh', 'exp', 'log', 'log10', 'sqrt', 'strlen', 'xstrlen', 'charlen', 'lines', 'numofchar', 'dbmaxlen', 'round', 'rescale', 'nmax', 'nmin', 'cmax', 'cmin', 'boolc', 'boolx', 'xsdbool', 'contains', 'contains_any_of', 'contains_any_not_of', 'matches', 'line_exists', 'ipow', 'char_off', 'count', 'count_any_of', 'count_any_not_of', 'distance', 'condense', 'concat_lines_of', 'escape', 'find', 'find_end', 'find_any_of', 'find_any_not_of', 'insert', 'match', 'repeat', 'replace', 'reverse', 'segment', 'shift_left', 'shift_right', 'substring', 'substring_after', 'substring_from', 'substring_before', 'substring_to', 'to_upper', 'to_lower', 'to_mixed', 'from_mixed', 'translate', 'bit-set', 'line_index',
  49. 'definition', 'implementation', 'public', 'inheriting', 'final'
  50. ];
  51. exports.language = {
  52. defaultToken: 'invalid',
  53. ignoreCase: true,
  54. tokenPostfix: '.abap',
  55. keywords: abapKeywords,
  56. typeKeywords: [
  57. 'abap_bool', 'string', 'xstring', 'any', 'clike', 'csequence', 'numeric',
  58. 'xsequence', 'c', 'n', 'i', 'p', 'f', 'd', 't', 'x'
  59. ],
  60. operators: [
  61. '+', '-', '/', '*',
  62. '=', '<', '>', '<=', '>=', '<>', '><', '=<', '=>',
  63. 'EQ', 'NE', 'GE', 'LE',
  64. 'CS', 'CN', 'CA', 'CO', 'CP', 'NS', 'NA', 'NP',
  65. ],
  66. symbols: /[=><!~?&+\-*\/\^%]+/,
  67. tokenizer: {
  68. root: [
  69. [/[a-z_$][\w$]*/, { cases: { '@typeKeywords': 'keyword',
  70. '@keywords': 'keyword',
  71. '@default': 'identifier' } }],
  72. { include: '@whitespace' },
  73. [/[:,.]/, 'delimiter'],
  74. [/[{}()\[\]]/, '@brackets'],
  75. [/@symbols/, { cases: { '@operators': 'operator',
  76. '@default': '' } }],
  77. [/'/, { token: 'string', bracket: '@open', next: '@stringquote' }],
  78. [/\|/, { token: 'string', bracket: '@open', next: '@stringtemplate' }],
  79. [/\d+/, 'number'],
  80. ],
  81. stringtemplate: [
  82. [/[^\\\|]+/, 'string'],
  83. [/\\\|/, 'string'],
  84. [/\|/, { token: 'string', bracket: '@close', next: '@pop' }]
  85. ],
  86. stringquote: [
  87. [/[^\\']+/, 'string'],
  88. [/'/, { token: 'string', bracket: '@close', next: '@pop' }]
  89. ],
  90. whitespace: [
  91. [/[ \t\r\n]+/, ''],
  92. [/^\*.*$/, 'comment'],
  93. [/\".*$/, 'comment'],
  94. ],
  95. },
  96. };
  97. });