more tests and fixes

This commit is contained in:
larshp 2019-09-12 16:27:20 +02:00
parent 5bdff0c4a7
commit 70dcf9020c
2 changed files with 16 additions and 3 deletions

View file

@ -80,4 +80,16 @@ testTokenization('abap', [
{ startIndex: 20, type: 'delimiter.abap' },
]
}],
[{
line: '\'he\'\' llo\'',
tokens: [
{ startIndex: 0, type: 'string.abap' },
]
}],
[{
line: '|hel\\|lo|',
tokens: [
{ startIndex: 0, type: 'string.abap' },
]
}],
]);

View file

@ -87,7 +87,7 @@ export const language = <ILanguage> {
[/@symbols/, { cases: { '@operators': 'operator',
'@default' : '' } } ],
[/'/, { token: 'string', bracket: '@open', next: '@string' } ],
[/'/, { token: 'string', bracket: '@open', next: '@stringquote' } ],
[/\|/, { token: 'string', bracket: '@open', next: '@stringtemplate' } ],
[/\d+/, 'number'],
@ -95,10 +95,11 @@ export const language = <ILanguage> {
stringtemplate: [
[/[^\\\|]+/, 'string'],
[/\\\|/, 'string'],
[/\|/, { token: 'string', bracket: '@close', next: '@pop' } ]
],
string: [
stringquote: [
[/[^\\']+/, 'string'],
[/'/, { token: 'string', bracket: '@close', next: '@pop' } ]
],