diff --git a/test-cases/suite1/fixtures/infinite-loop.json b/test-cases/suite1/fixtures/infinite-loop.json new file mode 100644 index 00000000..a0b5e6b3 --- /dev/null +++ b/test-cases/suite1/fixtures/infinite-loop.json @@ -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" + } + ] + } + } +} \ No newline at end of file diff --git a/test-cases/suite1/tests.json b/test-cases/suite1/tests.json index 4b349092..074139d6 100644 --- a/test-cases/suite1/tests.json +++ b/test-cases/suite1/tests.json @@ -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" + ] + } + ] + } + ] } ]