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

Commit

Permalink
New rule for non-teminated string in yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoDanin committed Oct 3, 2018
1 parent 66b5497 commit 0c23914
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/yaml/yaml.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,23 @@ testTokenization('yaml', [
}]
}],

//Strings
[{
line: '\'test\'',
tokens: [
{ startIndex: 0, type: 'string.ts' },
{ startIndex: 5, type: 'string.ts' },
]
}],

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

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

// Start Flow Scalars (quoted strings)
flowScalars: [
[/"([^"\\]|\\.)*$/, 'string.invalid'],
[/'([^'\\]|\\.)*$/, 'string.invalid'],
[/"/, 'string', '@string."'],
[/'/, 'string', '@string.\'']
],
Expand Down

0 comments on commit 0c23914

Please sign in to comment.