Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

New rule for non-teminated string in yaml #48

Merged
merged 2 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/yaml/yaml.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ testTokenization('yaml', [
}]
}],

//String
[{
line: '\'\'\'',
tokens: [
{ startIndex: 0, type: 'string.yaml' },
{ startIndex: 2, type: 'string.invalid.yaml' },
]
}],

// Block Scalar
[{
line: '>',
Expand Down
4 changes: 3 additions & 1 deletion src/yaml/yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ export const language = <ILanguage>{

// Start Flow Scalars (quoted strings)
flowScalars: [
[/"([^"\\]|\\.)*$/, 'string.invalid'],
[/'([^'\\]|\\.)*$/, 'string.invalid'],
[/'[^']*'/, 'string'],
[/"/, 'string', '@doubleQuotedString']
],
Expand All @@ -197,7 +199,7 @@ export const language = <ILanguage>{
[/[^\\"]+/, 'string'],
[/@escapes/, 'string.escape'],
[/\\./, 'string.escape.invalid'],
[/"/, 'string', '@pop']
[/"/, 'string', '@pop']
],

// Start Block Scalar
Expand Down