mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Merge pull request #28 from evakili/master
Whitespaces after # are allowed in C++ preprocessor statements (Microsoft/monaco-editor#687)
This commit is contained in:
commit
1f4f98abc1
2 changed files with 30 additions and 1 deletions
|
|
@ -259,7 +259,7 @@ export const language = <ILanguage>{
|
|||
[/\[\[.*\]\]/, 'annotation'],
|
||||
|
||||
// Preprocessor directive
|
||||
[/^\s*#\w+/, 'keyword'],
|
||||
[/^\s*#\s*\w+/, 'keyword'],
|
||||
|
||||
// delimiters and operators
|
||||
[/[{}()\[\]]/, '@brackets'],
|
||||
|
|
|
|||
|
|
@ -747,5 +747,34 @@ testTokenization('cpp', [
|
|||
tokens: [
|
||||
{ startIndex: 0, type: 'keyword.cpp' }
|
||||
]
|
||||
}, {
|
||||
line: '# ifdef VAR',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'keyword.cpp' },
|
||||
{ startIndex: 10, type: '' },
|
||||
{ startIndex: 11, type: 'identifier.cpp' }
|
||||
]
|
||||
}, {
|
||||
line: '# define SUM(A,B) (A) + (B)',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'keyword.cpp' },
|
||||
{ startIndex: 8, type: '' },
|
||||
{ startIndex: 9, type: 'identifier.cpp' },
|
||||
{ startIndex: 12, type: 'delimiter.parenthesis.cpp' },
|
||||
{ startIndex: 13, type: 'identifier.cpp' },
|
||||
{ startIndex: 14, type: 'delimiter.cpp' },
|
||||
{ startIndex: 15, type: 'identifier.cpp' },
|
||||
{ startIndex: 16, type: 'delimiter.parenthesis.cpp' },
|
||||
{ startIndex: 17, type: '' },
|
||||
{ startIndex: 18, type: 'delimiter.parenthesis.cpp' },
|
||||
{ startIndex: 19, type: 'identifier.cpp' },
|
||||
{ startIndex: 20, type: 'delimiter.parenthesis.cpp' },
|
||||
{ startIndex: 21, type: '' },
|
||||
{ startIndex: 22, type: 'delimiter.cpp' },
|
||||
{ startIndex: 23, type: '' },
|
||||
{ startIndex: 24, type: 'delimiter.parenthesis.cpp' },
|
||||
{ startIndex: 25, type: 'identifier.cpp' },
|
||||
{ startIndex: 26, type: 'delimiter.parenthesis.cpp' }
|
||||
]
|
||||
}]
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue