Change to support import of lexer grammars containing modes into other
lexer grammars. The semantics for this are,
* sets of channels from all grammars are merged
* rules of modes found in an imported grammar which are in the root
grammar are merged into the root grammar mode.
* modes which are not in the root grammar are added to the root
grammar, excluding modes which become empty due to a re-definition of
rules in the root grammar.
Add an accessLevel parser option. Use this to specify the access level
(public, etc) used on the classes and protocols in the generated
parser / lexer / listeners. This required adding the option to
tool.Grammar.parserOptions so that it was known as a valid option, and
to codegen.model.{Recognizer,ListenerFile,VisitorFile} so that it was
available to the template in all the necessary contexts.
The Swift template has been extended to recognize this option, and generate
classes and members using "open", "public" or "internal" as appropriate.
This is only fully implemented for Swift. The option is generic, but
the language-specific templates will need to be updated for any language
that would like similar support.
Closes#1597.
Issue #2078 is a crash (SIGILL) inside the dotnet runtime when running on
macOS on Travis. This is intermittent, so a retry may help. Retry this
specific exit status inside runProcess.
Switch to .NET Core SDK 1.1.4 for the Travis macOS tests. This is
the LTS release at the moment.
Issue #2078 is starting to look like a crash (SIGILL) inside the dotnet
runtime, so this upgrade may help with that.
Log the command / stdout / stderr / exit status at three places
during the C# runtime tests.
At these places we are executing subprocesses, but if those fail we
weren't logging the info that we may need to diagnose the problem.
Assert that the dotnet restore / build commands succeeded. If we
get a failure at this point, the test is obviously going to fail, and
we're masking the error by trying to push on with other commands.
BailErrorStrategy is supposed to throw an error that's different from
the ordinary recognition error, specifically so that it can be handled
differently by client code. This was not ported over from Java correctly.
Fix this by moving parseCancellation from ANTLRError to ANTLRException,
adding its RecognitionException argument, and throwing it from the
two handlers in BailErrorStrategy.
Also remove ANTLRException.cannotInvokeStartRule, which is unused.
(The Java runtime uses it when ParseTreePatternMatcher throws a generic
exception, but we don't have that.)