mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Update ABAP syntax (#1)
General update to ABAP 7.55 syntax, bug fixes, enhancements
This commit is contained in:
parent
1b8581c9aa
commit
b39800cf5e
2 changed files with 1377 additions and 956 deletions
|
|
@ -40,7 +40,7 @@ testTokenization('abap', [
|
||||||
{ startIndex: 2, type: '' },
|
{ startIndex: 2, type: '' },
|
||||||
{ startIndex: 3, type: 'number.abap' },
|
{ startIndex: 3, type: 'number.abap' },
|
||||||
{ startIndex: 4, type: '' },
|
{ startIndex: 4, type: '' },
|
||||||
{ startIndex: 5, type: 'operator.abap' },
|
{ startIndex: 5, type: 'key.abap' },
|
||||||
{ startIndex: 6, type: '' },
|
{ startIndex: 6, type: '' },
|
||||||
{ startIndex: 7, type: 'number.abap' },
|
{ startIndex: 7, type: 'number.abap' },
|
||||||
{ startIndex: 8, type: 'delimiter.abap' }
|
{ startIndex: 8, type: 'delimiter.abap' }
|
||||||
|
|
@ -121,7 +121,7 @@ testTokenization('abap', [
|
||||||
{ startIndex: 6, type: '' },
|
{ startIndex: 6, type: '' },
|
||||||
{ startIndex: 7, type: 'keyword.abap' },
|
{ startIndex: 7, type: 'keyword.abap' },
|
||||||
{ startIndex: 9, type: '' },
|
{ startIndex: 9, type: '' },
|
||||||
{ startIndex: 10, type: 'operator.abap' },
|
{ startIndex: 10, type: 'keyword.abap' },
|
||||||
{ startIndex: 13, type: '' },
|
{ startIndex: 13, type: '' },
|
||||||
{ startIndex: 14, type: 'keyword.abap' },
|
{ startIndex: 14, type: 'keyword.abap' },
|
||||||
{ startIndex: 21, type: 'delimiter.abap' }
|
{ startIndex: 21, type: 'delimiter.abap' }
|
||||||
|
|
@ -156,11 +156,11 @@ testTokenization('abap', [
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: 'identifier.abap' },
|
{ startIndex: 0, type: 'identifier.abap' },
|
||||||
{ startIndex: 3, type: '' },
|
{ startIndex: 3, type: '' },
|
||||||
{ startIndex: 4, type: 'operator.abap' },
|
{ startIndex: 4, type: 'key.abap' },
|
||||||
{ startIndex: 5, type: '' },
|
{ startIndex: 5, type: '' },
|
||||||
{ startIndex: 6, type: 'keyword.abap' },
|
{ startIndex: 6, type: 'keyword.abap' },
|
||||||
{ startIndex: 10, type: '' },
|
{ startIndex: 10, type: '' },
|
||||||
{ startIndex: 11, type: 'operator.abap' },
|
{ startIndex: 11, type: 'key.abap' },
|
||||||
{ startIndex: 12, type: 'delimiter.parenthesis.abap' },
|
{ startIndex: 12, type: 'delimiter.parenthesis.abap' },
|
||||||
{ startIndex: 13, type: '' },
|
{ startIndex: 13, type: '' },
|
||||||
{ startIndex: 14, type: 'number.abap' },
|
{ startIndex: 14, type: 'number.abap' },
|
||||||
|
|
@ -178,7 +178,7 @@ testTokenization('abap', [
|
||||||
{ startIndex: 5, type: '' },
|
{ startIndex: 5, type: '' },
|
||||||
{ startIndex: 6, type: 'identifier.abap' },
|
{ startIndex: 6, type: 'identifier.abap' },
|
||||||
{ startIndex: 9, type: '' },
|
{ startIndex: 9, type: '' },
|
||||||
{ startIndex: 12, type: 'identifier.abap' },
|
{ startIndex: 10, type: 'comment.abap' },
|
||||||
{ startIndex: 18, type: 'delimiter.abap' }
|
{ startIndex: 18, type: 'delimiter.abap' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +189,7 @@ testTokenization('abap', [
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: 'keyword.abap' },
|
{ startIndex: 0, type: 'keyword.abap' },
|
||||||
{ startIndex: 6, type: '' },
|
{ startIndex: 6, type: '' },
|
||||||
{ startIndex: 7, type: 'operator.abap' },
|
{ startIndex: 7, type: 'key.abap' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 9, type: 'keyword.abap' },
|
{ startIndex: 9, type: 'keyword.abap' },
|
||||||
{ startIndex: 13, type: '' },
|
{ startIndex: 13, type: '' },
|
||||||
|
|
@ -197,10 +197,164 @@ testTokenization('abap', [
|
||||||
{ startIndex: 19, type: '' },
|
{ startIndex: 19, type: '' },
|
||||||
{ startIndex: 20, type: 'keyword.abap' },
|
{ startIndex: 20, type: 'keyword.abap' },
|
||||||
{ startIndex: 24, type: '' },
|
{ startIndex: 24, type: '' },
|
||||||
{ startIndex: 25, type: 'operator.abap' },
|
{ startIndex: 25, type: 'identifier.abap' },
|
||||||
{ startIndex: 26, type: 'identifier.abap' },
|
|
||||||
{ startIndex: 29, type: 'delimiter.abap' }
|
{ startIndex: 29, type: 'delimiter.abap' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'li = lines( itab ).',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 2, type: '' },
|
||||||
|
{ startIndex: 3, type: 'key.abap' },
|
||||||
|
{ startIndex: 4, type: '' },
|
||||||
|
{ startIndex: 5, type: 'keyword.abap' },
|
||||||
|
{ startIndex: 10, type: 'delimiter.parenthesis.abap' },
|
||||||
|
{ startIndex: 11, type: '' },
|
||||||
|
{ startIndex: 12, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 16, type: '' },
|
||||||
|
{ startIndex: 17, type: 'delimiter.parenthesis.abap' },
|
||||||
|
{ startIndex: 18, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: "foo = 'bar' && 'baz'.",
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 3, type: '' },
|
||||||
|
{ startIndex: 4, type: 'key.abap' },
|
||||||
|
{ startIndex: 5, type: '' },
|
||||||
|
{ startIndex: 6, type: 'string.abap' },
|
||||||
|
{ startIndex: 11, type: '' },
|
||||||
|
{ startIndex: 12, type: 'key.abap' },
|
||||||
|
{ startIndex: 14, type: '' },
|
||||||
|
{ startIndex: 15, type: 'string.abap' },
|
||||||
|
{ startIndex: 20, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'DATA num TYPE n.',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.abap' },
|
||||||
|
{ startIndex: 4, type: '' },
|
||||||
|
{ startIndex: 5, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 8, type: '' },
|
||||||
|
{ startIndex: 9, type: 'keyword.abap' },
|
||||||
|
{ startIndex: 13, type: '' },
|
||||||
|
{ startIndex: 14, type: 'type.abap' },
|
||||||
|
{ startIndex: 15, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'CLASS-METHODS class_constructor.',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.abap' },
|
||||||
|
{ startIndex: 13, type: '' },
|
||||||
|
{ startIndex: 14, type: 'type.abap' },
|
||||||
|
{ startIndex: 31, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'super->constructor( ).',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'type.abap' },
|
||||||
|
{ startIndex: 5, type: 'tag.abap' },
|
||||||
|
{ startIndex: 7, type: 'type.abap' },
|
||||||
|
{ startIndex: 18, type: 'delimiter.parenthesis.abap' },
|
||||||
|
{ startIndex: 19, type: '' },
|
||||||
|
{ startIndex: 20, type: 'delimiter.parenthesis.abap' },
|
||||||
|
{ startIndex: 21, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'foo->my_method( ).',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 3, type: 'tag.abap' },
|
||||||
|
{ startIndex: 5, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 14, type: 'delimiter.parenthesis.abap' },
|
||||||
|
{ startIndex: 15, type: '' },
|
||||||
|
{ startIndex: 16, type: 'delimiter.parenthesis.abap' },
|
||||||
|
{ startIndex: 17, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'foo=>const_bar.',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 3, type: 'tag.abap' },
|
||||||
|
{ startIndex: 5, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 14, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'foo-bar+42(42).',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 7, type: '' },
|
||||||
|
{ startIndex: 8, type: 'number.abap' },
|
||||||
|
{ startIndex: 10, type: 'delimiter.parenthesis.abap' },
|
||||||
|
{ startIndex: 11, type: 'number.abap' },
|
||||||
|
{ startIndex: 13, type: 'delimiter.parenthesis.abap' },
|
||||||
|
{ startIndex: 14, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: "@EndUserText.label: 'hallo'",
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'annotation.abap' },
|
||||||
|
{ startIndex: 12, type: 'delimiter.abap' },
|
||||||
|
{ startIndex: 13, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 18, type: 'delimiter.abap' },
|
||||||
|
{ startIndex: 19, type: '' },
|
||||||
|
{ startIndex: 20, type: 'string.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'IF foo = abap_true.',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.abap' },
|
||||||
|
{ startIndex: 2, type: '' },
|
||||||
|
{ startIndex: 3, type: 'identifier.abap' },
|
||||||
|
{ startIndex: 6, type: '' },
|
||||||
|
{ startIndex: 7, type: 'key.abap' },
|
||||||
|
{ startIndex: 8, type: '' },
|
||||||
|
{ startIndex: 9, type: 'type.abap' },
|
||||||
|
{ startIndex: 18, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'LOOP AT screen.',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.abap' },
|
||||||
|
{ startIndex: 4, type: '' },
|
||||||
|
{ startIndex: 5, type: 'keyword.abap' },
|
||||||
|
{ startIndex: 7, type: '' },
|
||||||
|
{ startIndex: 8, type: 'type.abap' },
|
||||||
|
{ startIndex: 14, type: 'delimiter.abap' }
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
377
src/abap/abap.ts
377
src/abap/abap.ts
|
|
@ -4,9 +4,22 @@
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------
|
||||||
* Based on SAP ABAP Application Server 7.54
|
* ABAP Language
|
||||||
|
*
|
||||||
|
* Based on SAP ABAP Application Server 7.55
|
||||||
|
*
|
||||||
|
* Definition:
|
||||||
|
* https://github.com/microsoft/monaco-languages/blob/master/src/abap/abap.ts
|
||||||
|
*
|
||||||
* Reference:
|
* Reference:
|
||||||
* https://help.sap.com/doc/abapdocu_754_index_htm/7.54/en-US/index.htm?file=abenabap_words.htm
|
* https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm?file=abenabap_words.htm
|
||||||
|
* https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm?file=abenabap_index.htm
|
||||||
|
*
|
||||||
|
* Playground:
|
||||||
|
* https://microsoft.github.io/monaco-editor/monarch.html
|
||||||
|
*
|
||||||
|
* Themes:
|
||||||
|
* https://github.com/Microsoft/vscode/blob/master/src/vs/editor/standalone/common/themes.ts
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import type { languages } from '../fillers/monaco-editor-core';
|
import type { languages } from '../fillers/monaco-editor-core';
|
||||||
|
|
@ -21,8 +34,12 @@ export const conf: languages.LanguageConfiguration = {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const abapKeywords = [
|
export const language = <languages.IMonarchLanguage>{
|
||||||
// words
|
defaultToken: 'invalid',
|
||||||
|
ignoreCase: true,
|
||||||
|
tokenPostfix: '.abap',
|
||||||
|
|
||||||
|
keywords: [
|
||||||
'abap-source',
|
'abap-source',
|
||||||
'abbreviated',
|
'abbreviated',
|
||||||
'abstract',
|
'abstract',
|
||||||
|
|
@ -43,6 +60,7 @@ const abapKeywords = [
|
||||||
'alpha',
|
'alpha',
|
||||||
'analysis',
|
'analysis',
|
||||||
'analyzer',
|
'analyzer',
|
||||||
|
'and', // also an operator
|
||||||
'append',
|
'append',
|
||||||
'appendage',
|
'appendage',
|
||||||
'appending',
|
'appending',
|
||||||
|
|
@ -72,6 +90,7 @@ const abapKeywords = [
|
||||||
'base',
|
'base',
|
||||||
'before',
|
'before',
|
||||||
'begin',
|
'begin',
|
||||||
|
'between', // also an operator
|
||||||
'big',
|
'big',
|
||||||
'binary',
|
'binary',
|
||||||
'bintohex',
|
'bintohex',
|
||||||
|
|
@ -154,6 +173,7 @@ const abapKeywords = [
|
||||||
'concat_with_space',
|
'concat_with_space',
|
||||||
'concatenate',
|
'concatenate',
|
||||||
'cond',
|
'cond',
|
||||||
|
'condense', // also a built-in
|
||||||
'condition',
|
'condition',
|
||||||
'connect',
|
'connect',
|
||||||
'connection',
|
'connection',
|
||||||
|
|
@ -281,6 +301,7 @@ const abapKeywords = [
|
||||||
'entry',
|
'entry',
|
||||||
'enum',
|
'enum',
|
||||||
'environment',
|
'environment',
|
||||||
|
'equiv', // also an operator
|
||||||
'errormessage',
|
'errormessage',
|
||||||
'errors',
|
'errors',
|
||||||
'escaping',
|
'escaping',
|
||||||
|
|
@ -321,6 +342,7 @@ const abapKeywords = [
|
||||||
'filters',
|
'filters',
|
||||||
'filter-table',
|
'filter-table',
|
||||||
'final',
|
'final',
|
||||||
|
'find', // also a built-in
|
||||||
'first',
|
'first',
|
||||||
'first-line',
|
'first-line',
|
||||||
'fixed-point',
|
'fixed-point',
|
||||||
|
|
@ -356,7 +378,7 @@ const abapKeywords = [
|
||||||
'handle',
|
'handle',
|
||||||
'handler',
|
'handler',
|
||||||
'harmless',
|
'harmless',
|
||||||
'hashed',
|
'hashed', // also a table type
|
||||||
'having',
|
'having',
|
||||||
'hdb',
|
'hdb',
|
||||||
'header',
|
'header',
|
||||||
|
|
@ -386,13 +408,14 @@ const abapKeywords = [
|
||||||
'implicit',
|
'implicit',
|
||||||
'import',
|
'import',
|
||||||
'importing',
|
'importing',
|
||||||
|
'in', // also an operator
|
||||||
'inactive',
|
'inactive',
|
||||||
'incl',
|
'incl',
|
||||||
'include',
|
'include',
|
||||||
'includes',
|
'includes',
|
||||||
'including',
|
'including',
|
||||||
'increment',
|
'increment',
|
||||||
'index',
|
'index', // also a table type
|
||||||
'index-line',
|
'index-line',
|
||||||
'infotypes',
|
'infotypes',
|
||||||
'inheriting',
|
'inheriting',
|
||||||
|
|
@ -402,6 +425,7 @@ const abapKeywords = [
|
||||||
'inner',
|
'inner',
|
||||||
'inout',
|
'inout',
|
||||||
'input',
|
'input',
|
||||||
|
'insert', // also a built-in
|
||||||
'instance',
|
'instance',
|
||||||
'instances',
|
'instances',
|
||||||
'instr',
|
'instr',
|
||||||
|
|
@ -442,6 +466,7 @@ const abapKeywords = [
|
||||||
'levels',
|
'levels',
|
||||||
'like',
|
'like',
|
||||||
'line',
|
'line',
|
||||||
|
'lines', // also a built-in
|
||||||
'line-count',
|
'line-count',
|
||||||
'linefeed',
|
'linefeed',
|
||||||
'line-selection',
|
'line-selection',
|
||||||
|
|
@ -474,6 +499,7 @@ const abapKeywords = [
|
||||||
'margin',
|
'margin',
|
||||||
'mark',
|
'mark',
|
||||||
'mask',
|
'mask',
|
||||||
|
'match', // also a built-in
|
||||||
'matchcode',
|
'matchcode',
|
||||||
'max',
|
'max',
|
||||||
'maximum',
|
'maximum',
|
||||||
|
|
@ -513,24 +539,25 @@ const abapKeywords = [
|
||||||
'new-section',
|
'new-section',
|
||||||
'next',
|
'next',
|
||||||
'no',
|
'no',
|
||||||
'node',
|
|
||||||
'nodes',
|
|
||||||
'no-display',
|
'no-display',
|
||||||
'no-extension',
|
'no-extension',
|
||||||
'no-gap',
|
'no-gap',
|
||||||
'no-gaps',
|
'no-gaps',
|
||||||
'no-grouping',
|
'no-grouping',
|
||||||
'no-heading',
|
'no-heading',
|
||||||
'non-unicode',
|
|
||||||
'non-unique',
|
|
||||||
'no-scrolling',
|
'no-scrolling',
|
||||||
'no-sign',
|
'no-sign',
|
||||||
'no-title',
|
'no-title',
|
||||||
'no-topofpage',
|
'no-topofpage',
|
||||||
'no-zero',
|
'no-zero',
|
||||||
|
'node',
|
||||||
|
'nodes',
|
||||||
|
'non-unicode',
|
||||||
|
'non-unique',
|
||||||
|
'not', // also an operator
|
||||||
'null',
|
'null',
|
||||||
'number',
|
'number',
|
||||||
'object',
|
'object', // also a data type
|
||||||
'objects',
|
'objects',
|
||||||
'obligatory',
|
'obligatory',
|
||||||
'occurrence',
|
'occurrence',
|
||||||
|
|
@ -546,6 +573,7 @@ const abapKeywords = [
|
||||||
'option',
|
'option',
|
||||||
'optional',
|
'optional',
|
||||||
'options',
|
'options',
|
||||||
|
'or', // also an operator
|
||||||
'order',
|
'order',
|
||||||
'other',
|
'other',
|
||||||
'others',
|
'others',
|
||||||
|
|
@ -637,6 +665,7 @@ const abapKeywords = [
|
||||||
'reject',
|
'reject',
|
||||||
'remote',
|
'remote',
|
||||||
'renaming',
|
'renaming',
|
||||||
|
'replace', // also a built-in
|
||||||
'replacement',
|
'replacement',
|
||||||
'replacing',
|
'replacing',
|
||||||
'report',
|
'report',
|
||||||
|
|
@ -710,7 +739,7 @@ const abapKeywords = [
|
||||||
'some',
|
'some',
|
||||||
'sort',
|
'sort',
|
||||||
'sortable',
|
'sortable',
|
||||||
'sorted',
|
'sorted', // also a table type
|
||||||
'source',
|
'source',
|
||||||
'specified',
|
'specified',
|
||||||
'split',
|
'split',
|
||||||
|
|
@ -720,7 +749,7 @@ const abapKeywords = [
|
||||||
'sqlscript',
|
'sqlscript',
|
||||||
'stable',
|
'stable',
|
||||||
'stamp',
|
'stamp',
|
||||||
'standard',
|
'standard', // also a table type
|
||||||
'starting',
|
'starting',
|
||||||
'start-of-editing',
|
'start-of-editing',
|
||||||
'start-of-selection',
|
'start-of-selection',
|
||||||
|
|
@ -761,6 +790,7 @@ const abapKeywords = [
|
||||||
'system-exit',
|
'system-exit',
|
||||||
'tab',
|
'tab',
|
||||||
'tabbed',
|
'tabbed',
|
||||||
|
'table',
|
||||||
'tables',
|
'tables',
|
||||||
'tableview',
|
'tableview',
|
||||||
'tabstrip',
|
'tabstrip',
|
||||||
|
|
@ -794,6 +824,7 @@ const abapKeywords = [
|
||||||
'transaction',
|
'transaction',
|
||||||
'transfer',
|
'transfer',
|
||||||
'transformation',
|
'transformation',
|
||||||
|
'translate', // also a built-in
|
||||||
'transporting',
|
'transporting',
|
||||||
'trmac',
|
'trmac',
|
||||||
'truncate',
|
'truncate',
|
||||||
|
|
@ -860,7 +891,149 @@ const abapKeywords = [
|
||||||
'yymmdd',
|
'yymmdd',
|
||||||
'zero',
|
'zero',
|
||||||
'zone',
|
'zone',
|
||||||
// built-ins
|
// since 7.55:
|
||||||
|
'abap_system_timezone',
|
||||||
|
'abap_user_timezone',
|
||||||
|
'access',
|
||||||
|
'action',
|
||||||
|
'adabas',
|
||||||
|
'adjust_numbers',
|
||||||
|
'allow_precision_loss',
|
||||||
|
'allowed',
|
||||||
|
'amdp',
|
||||||
|
'applicationuser',
|
||||||
|
'as_geo_json',
|
||||||
|
'as400',
|
||||||
|
'associations',
|
||||||
|
'balance',
|
||||||
|
'behavior',
|
||||||
|
'breakup',
|
||||||
|
'bulk',
|
||||||
|
'cds',
|
||||||
|
'cds_client',
|
||||||
|
'check_before_save',
|
||||||
|
'child',
|
||||||
|
'clients',
|
||||||
|
'corr',
|
||||||
|
'corr_spearman',
|
||||||
|
'cross',
|
||||||
|
'cycles',
|
||||||
|
'datn_add_days',
|
||||||
|
'datn_add_months',
|
||||||
|
'datn_days_between',
|
||||||
|
'dats_from_datn',
|
||||||
|
'dats_tims_to_tstmp',
|
||||||
|
'dats_to_datn',
|
||||||
|
'db2',
|
||||||
|
'db6',
|
||||||
|
'ddl',
|
||||||
|
'dense_rank',
|
||||||
|
'depth',
|
||||||
|
'deterministic',
|
||||||
|
'discarding',
|
||||||
|
'entities',
|
||||||
|
'entity',
|
||||||
|
'error',
|
||||||
|
'failed',
|
||||||
|
'finalize',
|
||||||
|
'first_value',
|
||||||
|
'fltp_to_dec',
|
||||||
|
'following',
|
||||||
|
'fractional',
|
||||||
|
'full',
|
||||||
|
'graph',
|
||||||
|
'grouping',
|
||||||
|
'hierarchy',
|
||||||
|
'hierarchy_ancestors',
|
||||||
|
'hierarchy_ancestors_aggregate',
|
||||||
|
'hierarchy_descendants',
|
||||||
|
'hierarchy_descendants_aggregate',
|
||||||
|
'hierarchy_siblings',
|
||||||
|
'incremental',
|
||||||
|
'indicators',
|
||||||
|
'lag',
|
||||||
|
'last_value',
|
||||||
|
'lead',
|
||||||
|
'leaves',
|
||||||
|
'like_regexpr',
|
||||||
|
'link',
|
||||||
|
'locale_sap',
|
||||||
|
'lock',
|
||||||
|
'locks',
|
||||||
|
'many',
|
||||||
|
'mapped',
|
||||||
|
'matched',
|
||||||
|
'measures',
|
||||||
|
'median',
|
||||||
|
'mssqlnt',
|
||||||
|
'multiple',
|
||||||
|
'nodetype',
|
||||||
|
'ntile',
|
||||||
|
'nulls',
|
||||||
|
'occurrences_regexpr',
|
||||||
|
'one',
|
||||||
|
'operations',
|
||||||
|
'oracle',
|
||||||
|
'orphans',
|
||||||
|
'over',
|
||||||
|
'parent',
|
||||||
|
'parents',
|
||||||
|
'partition',
|
||||||
|
'pcre',
|
||||||
|
'period',
|
||||||
|
'pfcg_mapping',
|
||||||
|
'preceding',
|
||||||
|
'privileged',
|
||||||
|
'product',
|
||||||
|
'projection',
|
||||||
|
'rank',
|
||||||
|
'redirected',
|
||||||
|
'replace_regexpr',
|
||||||
|
'reported',
|
||||||
|
'response',
|
||||||
|
'responses',
|
||||||
|
'root',
|
||||||
|
'row',
|
||||||
|
'row_number',
|
||||||
|
'sap_system_date',
|
||||||
|
'save',
|
||||||
|
'schema',
|
||||||
|
'session',
|
||||||
|
'sets',
|
||||||
|
'shortdump',
|
||||||
|
'siblings',
|
||||||
|
'spantree',
|
||||||
|
'start',
|
||||||
|
'stddev',
|
||||||
|
'string_agg',
|
||||||
|
'subtotal',
|
||||||
|
'sybase',
|
||||||
|
'tims_from_timn',
|
||||||
|
'tims_to_timn',
|
||||||
|
'to_blob',
|
||||||
|
'to_clob',
|
||||||
|
'total',
|
||||||
|
'trace-entry',
|
||||||
|
'tstmp_to_dats',
|
||||||
|
'tstmp_to_dst',
|
||||||
|
'tstmp_to_tims',
|
||||||
|
'tstmpl_from_utcl',
|
||||||
|
'tstmpl_to_utcl',
|
||||||
|
'unbounded',
|
||||||
|
'utcl_add_seconds',
|
||||||
|
'utcl_current',
|
||||||
|
'utcl_seconds_between',
|
||||||
|
'uuid',
|
||||||
|
'var',
|
||||||
|
'verbatim'
|
||||||
|
],
|
||||||
|
|
||||||
|
//
|
||||||
|
// Built-in Functions
|
||||||
|
//
|
||||||
|
// Functions that are also statements have been moved to keywords
|
||||||
|
//
|
||||||
|
builtinFunctions: [
|
||||||
'abs',
|
'abs',
|
||||||
'acos',
|
'acos',
|
||||||
'asin',
|
'asin',
|
||||||
|
|
@ -874,7 +1047,7 @@ const abapKeywords = [
|
||||||
'cmax',
|
'cmax',
|
||||||
'cmin',
|
'cmin',
|
||||||
'concat_lines_of',
|
'concat_lines_of',
|
||||||
'condense',
|
// 'condense', // moved to keywords
|
||||||
'contains',
|
'contains',
|
||||||
'contains_any_not_of',
|
'contains_any_not_of',
|
||||||
'contains_any_of',
|
'contains_any_of',
|
||||||
|
|
@ -887,27 +1060,27 @@ const abapKeywords = [
|
||||||
'distance',
|
'distance',
|
||||||
'escape',
|
'escape',
|
||||||
'exp',
|
'exp',
|
||||||
'find',
|
// 'find', // moved to keywords
|
||||||
'find_any_not_of',
|
'find_any_not_of',
|
||||||
'find_any_of',
|
'find_any_of',
|
||||||
'find_end',
|
'find_end',
|
||||||
'floor',
|
'floor',
|
||||||
'frac',
|
'frac',
|
||||||
'from_mixed',
|
'from_mixed',
|
||||||
'insert',
|
// 'insert', // moved to keywords
|
||||||
'ipow',
|
'ipow',
|
||||||
'line_exists',
|
'line_exists',
|
||||||
'line_index',
|
'line_index',
|
||||||
'lines',
|
// 'lines', // moved to keywords
|
||||||
'log',
|
'log',
|
||||||
'log10',
|
'log10',
|
||||||
'match',
|
// 'match', // moved to keywords
|
||||||
'matches',
|
'matches',
|
||||||
'nmax',
|
'nmax',
|
||||||
'nmin',
|
'nmin',
|
||||||
'numofchar',
|
'numofchar',
|
||||||
'repeat',
|
'repeat',
|
||||||
'replace',
|
// 'replace', // moved to keywords
|
||||||
'rescale',
|
'rescale',
|
||||||
'reverse',
|
'reverse',
|
||||||
'round',
|
'round',
|
||||||
|
|
@ -929,23 +1102,22 @@ const abapKeywords = [
|
||||||
'to_lower',
|
'to_lower',
|
||||||
'to_mixed',
|
'to_mixed',
|
||||||
'to_upper',
|
'to_upper',
|
||||||
'translate',
|
// 'translate', // moved to keywords
|
||||||
'trunc',
|
'trunc',
|
||||||
'utclong_add', // since 7.54
|
'utclong_add', // since 7.54
|
||||||
'utclong_current', // since 7.54
|
'utclong_current', // since 7.54
|
||||||
'utclong_diff', // since 7.54
|
'utclong_diff', // since 7.54
|
||||||
'xsdbool',
|
'xsdbool',
|
||||||
'xstrlen'
|
'xstrlen'
|
||||||
];
|
],
|
||||||
|
|
||||||
export const language = <languages.IMonarchLanguage>{
|
|
||||||
defaultToken: 'invalid',
|
|
||||||
ignoreCase: true,
|
|
||||||
tokenPostfix: '.abap',
|
|
||||||
keywords: abapKeywords,
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Data Types
|
||||||
|
//
|
||||||
|
// Data types that are also part of statements have been moved to keywords
|
||||||
|
//
|
||||||
typeKeywords: [
|
typeKeywords: [
|
||||||
// built-in data types
|
// built-in abap types
|
||||||
'b',
|
'b',
|
||||||
'c',
|
'c',
|
||||||
'd',
|
'd',
|
||||||
|
|
@ -967,33 +1139,34 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'clike',
|
'clike',
|
||||||
'csequence',
|
'csequence',
|
||||||
'decfloat',
|
'decfloat',
|
||||||
|
// 'object', // moved to keywords
|
||||||
'numeric',
|
'numeric',
|
||||||
'simple',
|
'simple',
|
||||||
'xsequence',
|
'xsequence',
|
||||||
// generic table types
|
// ddic/sql data types
|
||||||
'table',
|
|
||||||
// 'any table',
|
|
||||||
'hashed', // 'hashed table',
|
|
||||||
'index', // 'index table',
|
|
||||||
'sorted', // 'sorted table',
|
|
||||||
'standard', // 'standard table',
|
|
||||||
// ddic data types
|
|
||||||
'accp',
|
'accp',
|
||||||
'char',
|
'char',
|
||||||
'clnt',
|
'clnt',
|
||||||
'cuky',
|
'cuky',
|
||||||
'curr',
|
'curr',
|
||||||
|
'datn', // since 7.55
|
||||||
'dats',
|
'dats',
|
||||||
|
'd16d', // since 7.55
|
||||||
|
'd16n', // since 7.55
|
||||||
|
'd16r', // since 7.55
|
||||||
|
'd34d', // since 7.55
|
||||||
|
'd34n', // since 7.55
|
||||||
|
'd34r', // since 7.55
|
||||||
'dec',
|
'dec',
|
||||||
'df16_dec',
|
'df16_dec',
|
||||||
'df16_raw',
|
'df16_raw',
|
||||||
'df34_dec',
|
'df34_dec',
|
||||||
'df34_raw',
|
'df34_raw',
|
||||||
'fltp',
|
'fltp',
|
||||||
|
'geom_ewkb', // since 7.55
|
||||||
'int1',
|
'int1',
|
||||||
'int2',
|
'int2',
|
||||||
'int4',
|
'int4',
|
||||||
// 'int8', built-in since 7.54
|
|
||||||
'lang',
|
'lang',
|
||||||
'lchr',
|
'lchr',
|
||||||
'lraw',
|
'lraw',
|
||||||
|
|
@ -1002,22 +1175,87 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'raw',
|
'raw',
|
||||||
'rawstring',
|
'rawstring',
|
||||||
'sstring',
|
'sstring',
|
||||||
|
'timn', // since 7.55
|
||||||
'tims',
|
'tims',
|
||||||
'unit',
|
'unit',
|
||||||
|
'utcl', // since 7.55
|
||||||
// ddic data types (obsolete)
|
// ddic data types (obsolete)
|
||||||
'df16_scl',
|
'df16_scl',
|
||||||
'df34_scl',
|
'df34_scl',
|
||||||
'prec',
|
'prec',
|
||||||
'varc',
|
'varc',
|
||||||
// special data types
|
// special data types and constants
|
||||||
'abap_bool',
|
'abap_bool',
|
||||||
'space',
|
'abap_false',
|
||||||
|
'abap_true',
|
||||||
|
'abap_undefined',
|
||||||
'me',
|
'me',
|
||||||
'syst',
|
'screen',
|
||||||
|
'space',
|
||||||
|
'super',
|
||||||
'sy',
|
'sy',
|
||||||
'screen'
|
'syst',
|
||||||
|
'table_line',
|
||||||
|
// obsolete data object
|
||||||
|
'*sys*'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
builtinMethods: [
|
||||||
|
'class_constructor',
|
||||||
|
'constructor'
|
||||||
|
],
|
||||||
|
|
||||||
|
derivedTypes: [
|
||||||
|
'%CID',
|
||||||
|
'%CID_REF',
|
||||||
|
'%CONTROL',
|
||||||
|
'%DATA',
|
||||||
|
'%ELEMENT',
|
||||||
|
'%FAIL',
|
||||||
|
'%KEY',
|
||||||
|
'%MSG',
|
||||||
|
'%PARAM',
|
||||||
|
'%PID',
|
||||||
|
'%PID_ASSOC',
|
||||||
|
'%PID_PARENT',
|
||||||
|
'%_HINTS'
|
||||||
|
],
|
||||||
|
|
||||||
|
cdsLanguage: [
|
||||||
|
'@AbapAnnotation',
|
||||||
|
'@AbapCatalog',
|
||||||
|
'@AccessControl',
|
||||||
|
'@API',
|
||||||
|
'@ClientDependent',
|
||||||
|
'@ClientHandling',
|
||||||
|
'@CompatibilityContract',
|
||||||
|
'@DataAging',
|
||||||
|
'@EndUserText',
|
||||||
|
'@Environment',
|
||||||
|
'@LanguageDependency',
|
||||||
|
'@MappingRole',
|
||||||
|
'@Metadata',
|
||||||
|
'@MetadataExtension',
|
||||||
|
'@ObjectModel',
|
||||||
|
'@Scope',
|
||||||
|
'@Semantics',
|
||||||
|
'$EXTENSION',
|
||||||
|
'$SELF'
|
||||||
|
],
|
||||||
|
|
||||||
|
selectors: [
|
||||||
|
'->',
|
||||||
|
'->*',
|
||||||
|
'=>',
|
||||||
|
'~',
|
||||||
|
'~*'
|
||||||
|
],
|
||||||
|
|
||||||
|
//
|
||||||
|
// Operators
|
||||||
|
//
|
||||||
|
// Operators that can be part of statements have been moved to keywords
|
||||||
|
//
|
||||||
operators: [
|
operators: [
|
||||||
// arithmetic operators
|
// arithmetic operators
|
||||||
' +',
|
' +',
|
||||||
|
|
@ -1031,6 +1269,14 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'=',
|
'=',
|
||||||
'#',
|
'#',
|
||||||
'@',
|
'@',
|
||||||
|
'+=',
|
||||||
|
'-=',
|
||||||
|
'*=',
|
||||||
|
'/=',
|
||||||
|
'**=',
|
||||||
|
'&&=',
|
||||||
|
// casting operator
|
||||||
|
'?=',
|
||||||
// concat operators
|
// concat operators
|
||||||
'&',
|
'&',
|
||||||
'&&',
|
'&&',
|
||||||
|
|
@ -1043,20 +1289,20 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'o',
|
'o',
|
||||||
'z',
|
'z',
|
||||||
// boolean operators
|
// boolean operators
|
||||||
'and',
|
// 'and', // moved to keywords
|
||||||
'equiv',
|
// 'equiv', // moved to keywords
|
||||||
'not',
|
// 'not', // moved to keywords
|
||||||
'or',
|
// 'or', // moved to keywords
|
||||||
// comparison operators
|
// comparison operators
|
||||||
' < ',
|
'<',
|
||||||
' > ',
|
' >', // todo: separate from -> and =>
|
||||||
'<=',
|
'<=',
|
||||||
'>=',
|
'>=',
|
||||||
'<>',
|
'<>',
|
||||||
'><', // obsolete
|
'><', // obsolete
|
||||||
'=<', // obsolete
|
'=<', // obsolete
|
||||||
'=>', // obsolete
|
'=>', // obsolete
|
||||||
'between',
|
// 'between', // moved to keywords
|
||||||
'bt',
|
'bt',
|
||||||
'byte-ca',
|
'byte-ca',
|
||||||
'byte-cn',
|
'byte-cn',
|
||||||
|
|
@ -1072,14 +1318,20 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
'eq', // obsolete
|
'eq', // obsolete
|
||||||
'ge', // obsolete
|
'ge', // obsolete
|
||||||
'gt', // obsolete
|
'gt', // obsolete
|
||||||
'in',
|
// 'in', // moved to keywords
|
||||||
'le', // obsolete
|
'le', // obsolete
|
||||||
'lt', // obsolete
|
'lt', // obsolete
|
||||||
'na',
|
'na',
|
||||||
'nb',
|
'nb',
|
||||||
'ne', // obsolete
|
'ne', // obsolete
|
||||||
'np',
|
'np',
|
||||||
'ns'
|
'ns',
|
||||||
|
// cds
|
||||||
|
'*/',
|
||||||
|
'*:',
|
||||||
|
'--',
|
||||||
|
'/*',
|
||||||
|
'//'
|
||||||
],
|
],
|
||||||
|
|
||||||
symbols: /[=><!~?&+\-*\/\^%#@]+/,
|
symbols: /[=><!~?&+\-*\/\^%#@]+/,
|
||||||
|
|
@ -1087,12 +1339,16 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
tokenizer: {
|
tokenizer: {
|
||||||
root: [
|
root: [
|
||||||
[
|
[
|
||||||
/[a-z_$][\w-$]*/,
|
/[a-z_\/$%@]([\w\/$%]|-(?!>))*/, // exclude '->' selector
|
||||||
{
|
{
|
||||||
cases: {
|
cases: {
|
||||||
'@typeKeywords': 'keyword',
|
'@typeKeywords': 'type',
|
||||||
'@keywords': 'keyword',
|
'@keywords': 'keyword',
|
||||||
'@operators': 'operator',
|
'@cdsLanguage': 'annotation',
|
||||||
|
'@derivedTypes': 'type',
|
||||||
|
'@builtinFunctions': 'type',
|
||||||
|
'@builtinMethods': 'type',
|
||||||
|
'@operators': 'key',
|
||||||
'@default': 'identifier'
|
'@default': 'identifier'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1100,13 +1356,24 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
|
|
||||||
[/<[\w]+>/, 'identifier'], // field symbols
|
[/<[\w]+>/, 'identifier'], // field symbols
|
||||||
|
|
||||||
|
[/##[\w|_]+/, 'comment'], // pragmas
|
||||||
|
|
||||||
{ include: '@whitespace' },
|
{ include: '@whitespace' },
|
||||||
|
|
||||||
[/[:,.]/, 'delimiter'],
|
[/[:,.]/, 'delimiter'],
|
||||||
|
|
||||||
[/[{}()\[\]]/, '@brackets'],
|
[/[{}()\[\]]/, '@brackets'],
|
||||||
|
|
||||||
[/@symbols/, { cases: { '@operators': 'operator', '@default': '' } }],
|
[
|
||||||
|
/@symbols/,
|
||||||
|
{
|
||||||
|
cases: {
|
||||||
|
'@selectors': 'tag',
|
||||||
|
'@operators': 'key',
|
||||||
|
'@default': ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
[/'/, { token: 'string', bracket: '@open', next: '@stringquote' }],
|
[/'/, { token: 'string', bracket: '@open', next: '@stringquote' }],
|
||||||
[/`/, { token: 'string', bracket: '@open', next: '@stringping' }],
|
[/`/, { token: 'string', bracket: '@open', next: '@stringping' }],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue