implement a test pattern for issue #145

This commit is contained in:
msftrncs 2021-01-23 22:05:30 -06:00
Родитель 7fe8ca7784
Коммит 0906b05c84
2 изменённых файлов: 175 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,79 @@
{
"name": "infinite-loop-grammar",
"scopeName": "source.infinite-loop",
"patterns": [
{
"name": "start",
"begin": "\\A",
"end": "$",
"patterns": [
{
"name": "negative-look-ahead",
"match": "(?!a)"
}
]
},
{
"include": "#test"
},
{
"include": "#not_a_problem"
}
],
"repository": {
"test": {
"name": "test",
"begin": "(?=test)",
"end": "$",
"patterns": [
{
"include": "#test_this"
}
]
},
"test_this": {
"name": "test_this",
"begin": "(?=test this)",
"end": "$",
"patterns": [
{
"include": "#test_this_line"
}
]
},
"test_this_line": {
"name": "test_this_line",
"begin": "(?=test this line)",
"end": "$",
"patterns": [
{
"include": "#test"
}
]
},
"spaces":
{
"name": "spaces",
"begin": "^(?=\\s)",
"end": "(?=\\S)"
},
"not_a_problem":
{
"name": "not_a_problem",
"begin": "(?=not)",
"end": "\\z",
"patterns": [
{
"name": "not",
"match": "\\Gnot"
},
{
"include": "#not_a_problem"
},
{
"include": "#spaces"
}
]
}
}
}

Просмотреть файл

@ -1710,5 +1710,101 @@
]
}
]
},
{
"grammars": [
"fixtures/infinite-loop.json"
],
"grammarPath": "fixtures/infinite-loop.json",
"desc": "Issue #145",
"lines": [
{
"line": "abc",
"tokens": [
{
"value": "a",
"scopes": [
"source.infinite-loop",
"start"
]
},
{
"value": "bc",
"scopes": [
"source.infinite-loop"
]
}
]
},
{
"line": "test this line",
"tokens": [
{
"value": "test this line",
"scopes": [
"source.infinite-loop",
"test",
"test_this",
"test_this_line"
]
}
]
},
{
"line": "not",
"tokens": [
{
"value": "not",
"scopes": [
"source.infinite-loop",
"test",
"test_this",
"test_this_line"
]
}
]
},
{
"line": " not",
"tokens": [
{
"value": " ",
"scopes": [
"source.infinite-loop"
]
},
{
"value": "not",
"scopes": [
"source.infinite-loop",
"not_a_problem",
"not"
]
}
]
},
{
"line": " not",
"tokens": [
{
"value": " ",
"scopes": [
"source.infinite-loop",
"not_a_problem",
"spaces"
]
},
{
"value": "not",
"scopes": [
"source.infinite-loop",
"not_a_problem",
"not_a_problem",
"not"
]
}
]
}
]
}
]