Skip to content

Commit

Permalink
Fix ': ' within a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri1969 committed Mar 25, 2023
1 parent c7ce77b commit 788b6a2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
35 changes: 34 additions & 1 deletion src/basic-languages/yaml/yaml.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ testTokenization('yaml', [
}
],

// Comment following Value
// Comment following Value
[
{
line: 'key: value #comment',
Expand Down Expand Up @@ -633,5 +633,38 @@ testTokenization('yaml', [
}
]
}
],

// ': ' in Comment following Value
[
{
line: 'key: value #comment: also comment',
tokens: [
{
startIndex: 0,
type: 'type.yaml'
},
{
startIndex: 3,
type: 'operators.yaml'
},
{
startIndex: 4,
type: 'white.yaml'
},
{
startIndex: 5,
type: 'string.yaml'
},
{
startIndex: 10,
type: 'white.yaml'
},
{
startIndex: 11,
type: 'comment.yaml'
}
]
}
]
]);
2 changes: 1 addition & 1 deletion src/basic-languages/yaml/yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const language = <languages.IMonarchLanguage>{
[/@numberDate(?![ \t]*\S+)/, 'number.date'],

// Key:Value pair
[/(".*?"|'.*?'|[^'"]*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
[/(".*?"|'.*?'|[^#'"]*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],

{ include: '@flowScalars' },

Expand Down

0 comments on commit 788b6a2

Please sign in to comment.