Open KvanTTT opened 6 years ago
This could probably be done efficiently by adding a check to the code that calculates the closure from an ATNConfigSet. This code is typically called frequently in long running operations but avoided on performance critical paths.
@sharwell Sorry but I don't see where to add the check.
Btw is it in plans to support visitAsync ? How can I in my .g4 customize the Accept to change it in Async method ?
@KvanTTT @sharwell Any chances this can be implemented and merged ?
Sometimes parsing works too much time especially for very big files with ambiguous grammars.
But we can stop parsing in .NET by several ways:
Thread.About
.CancellationToken
withThrowIfCancellationRequested
.The first way is not safe because of state corruption, see also What's wrong with using Thread.Abort() . Moreover, it's not supported in .NET Core: Can't find Abort method in Thread .
The second way is too slow if there are many files. Moreover, it's harder to implement.
The third way is the best but requires
ThrowIfCancellationRequested
calls from parsing code.By the way, Roslyn supports cancellation tokens and async methods.