Browse Source

Update ABAP syntax (#1)

General update to ABAP 7.55 syntax, bug fixes, enhancements
Marc Bernard 3 years ago
parent
commit
b39800cf5e
2 changed files with 1255 additions and 929 deletions
  1. 162 8
      src/abap/abap.test.ts
  2. 1093 921
      src/abap/abap.ts

+ 162 - 8
src/abap/abap.test.ts

@@ -40,7 +40,7 @@ testTokenization('abap', [
 				{ startIndex: 2, type: '' },
 				{ startIndex: 3, type: 'number.abap' },
 				{ startIndex: 4, type: '' },
-				{ startIndex: 5, type: 'operator.abap' },
+				{ startIndex: 5, type: 'key.abap' },
 				{ startIndex: 6, type: '' },
 				{ startIndex: 7, type: 'number.abap' },
 				{ startIndex: 8, type: 'delimiter.abap' }
@@ -121,7 +121,7 @@ testTokenization('abap', [
 				{ startIndex: 6, type: '' },
 				{ startIndex: 7, type: 'keyword.abap' },
 				{ startIndex: 9, type: '' },
-				{ startIndex: 10, type: 'operator.abap' },
+				{ startIndex: 10, type: 'keyword.abap' },
 				{ startIndex: 13, type: '' },
 				{ startIndex: 14, type: 'keyword.abap' },
 				{ startIndex: 21, type: 'delimiter.abap' }
@@ -156,11 +156,11 @@ testTokenization('abap', [
 			tokens: [
 				{ startIndex: 0, type: 'identifier.abap' },
 				{ startIndex: 3, type: '' },
-				{ startIndex: 4, type: 'operator.abap' },
+				{ startIndex: 4, type: 'key.abap' },
 				{ startIndex: 5, type: '' },
 				{ startIndex: 6, type: 'keyword.abap' },
 				{ startIndex: 10, type: '' },
-				{ startIndex: 11, type: 'operator.abap' },
+				{ startIndex: 11, type: 'key.abap' },
 				{ startIndex: 12, type: 'delimiter.parenthesis.abap' },
 				{ startIndex: 13, type: '' },
 				{ startIndex: 14, type: 'number.abap' },
@@ -178,7 +178,7 @@ testTokenization('abap', [
 				{ startIndex: 5, type: '' },
 				{ startIndex: 6, type: 'identifier.abap' },
 				{ startIndex: 9, type: '' },
-				{ startIndex: 12, type: 'identifier.abap' },
+				{ startIndex: 10, type: 'comment.abap' },
 				{ startIndex: 18, type: 'delimiter.abap' }
 			]
 		}
@@ -189,7 +189,7 @@ testTokenization('abap', [
 			tokens: [
 				{ startIndex: 0, type: 'keyword.abap' },
 				{ startIndex: 6, type: '' },
-				{ startIndex: 7, type: 'operator.abap' },
+				{ startIndex: 7, type: 'key.abap' },
 				{ startIndex: 8, type: '' },
 				{ startIndex: 9, type: 'keyword.abap' },
 				{ startIndex: 13, type: '' },
@@ -197,10 +197,164 @@ testTokenization('abap', [
 				{ startIndex: 19, type: '' },
 				{ startIndex: 20, type: 'keyword.abap' },
 				{ startIndex: 24, type: '' },
-				{ startIndex: 25, type: 'operator.abap' },
-				{ startIndex: 26, type: 'identifier.abap' },
+				{ startIndex: 25, type: 'identifier.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' }
+			]
+		}
 	]
 ]);

File diff suppressed because it is too large
+ 1093 - 921
src/abap/abap.ts


Some files were not shown because too many files changed in this diff