Commit Graph

7055 Commits

Author SHA1 Message Date
Ewan Mellor 481f517fec
[.NET] Make the .NET Travis tests use netstandard1.3.
Add -f netstandard1.3 to the dotnet build command used on Travis.

This has been necessary since PR #2024, and the build has been silently failing
all this time.
2018-11-15 15:33:10 -08:00
Ewan Mellor 768a0a66e6
[Swift] Build and test error checking.
Change all the subprocess calls in boot.py to check whether they succeeded,
and set the script status appropriately.

In particular, when our unit tests fail, we need the script to exit
with a failure code so that we actually notice on Travis.
2018-11-15 15:33:10 -08:00
Ewan Mellor 4201dd9cf3
[Swift] Don't catch exceptions inside the test apps.
We get much more info if we let the exception rise to the top level.
2018-11-15 15:33:10 -08:00
Ewan Mellor e54607d2ae
Change the test asserts so that we can see all the values.
Change the unit test asserts so that we can see all the values in the
event of a failure.  When debugging an error, it's useful to see both
the stdout and stderr for the failure.  Previously we would only see
one or the other (whichever one failed the assert).

This adds a helper function BaseRuntimeTest.assertCorrectOutput.

This also removes SpecialRuntimeTestAssert, which has not been used for
2 years.
2018-11-15 15:33:10 -08:00
Ewan Mellor 3699ea5412
Exclude intermediate build products from the runtime-testsuite jar.
This means that if you build in an unclean source tree, you don't end up with
intermediate classes in the jar.  (This hasn't broken anything that I noticed,
but it bloats the jar and I wanted to make sure it wasn't messing anything up.)

This excludes .build (the Swift runtime's build directory), target (the Java
runtime's build directory) and Swift/*.xcodeproj (which is not in the source tree
but can be created by devs who are using Xcode).
2018-11-15 15:33:10 -08:00
Ewan Mellor c2d69af6db
Write any dumpstream files into the Travis logs.
This means that we will see the errors if Surefire is bailing for any
reason.
2018-11-15 15:33:10 -08:00
Ewan Mellor 0f6581e480
Fix mvn clean's deleting of the Swift .build directory.
Thanks, Maven.
2018-11-15 15:33:10 -08:00
Ewan Mellor d275a8c97f
[Swift] Make ParserATNSimulator.precedenceTransition return a nullable value.
This was always clearly a possibility, looking at the body of the method.
The newly-enabled performance tests expose this bug (and I don't know how
we've gotten away with it otherwise for so long).

The Java runtime also returns null at this point.
2018-11-15 15:28:47 -08:00
Terence Parr 237ba0f9e1
Merge pull request #2406 from vinoski/cpp-any-fix-is
Do not throw std::bad_cast from antlrcpp::Any::is
2018-11-15 13:21:53 -08:00
Terence Parr 19ebc9da67
Merge pull request #2407 from ewanmellor/swift-4.2
Move the Swift runtime to Swift 4.2
2018-11-15 12:33:37 -08:00
Ewan Mellor 19ac145081
[Swift] Add version info to the documentation.
Add a documention note about which versions of Antlr require which versions
of Swift.
2018-11-15 11:26:09 -08:00
Ewan Mellor 8cd798431d
[Swift] Change getStateToAltMap to use Int as the dictionary key, not ATNState.
The ATNState hashValue and == override are just using the stateNumber field, so
using the Int directly is equivalent, and saves bouncing through those methods.

This also seems to be a correctness issue with the new Hashable protocol changes in
Swift 4.2 (though I admit that I don't know why).

Remove PredictionMode.getStateToAltMap, which was just a stub onto
ATNConfigSet.getStateToAltMap and didn't seem to be doing anything useful.
2018-11-15 11:26:09 -08:00
Ewan Mellor 1184c67f72
[Swift] Swift-Runtime error after XCode 10 / iOS 12 update
Avoid adding to closureBusy before all ATNConfig properties are set.

This fixes #2372.

This is a port of c8805ab from the Java runtime.  That was PR #1955.
2018-11-15 11:26:09 -08:00
Ewan Mellor 75d4d867ef
[Swift] Suppress "Optional" in the output when printing a value.
Suppress "Optional" in the output when printing a value in the tests and
some debugging messages.

This is a change in behavior in Swift 4.2 (SE-0054) that implicitly
unwrapped optionals are now seen as plain Optional at runtime, and so
print doesn't implicitly unwrap them any more.
2018-11-15 11:26:09 -08:00
Ewan Mellor 938883d516
[Swift] Fix MurmurHash calculations under Swift 4.2.
This was working before because calling hashValue on a boxed UInt32 gave
back the value itself.  This is apparently no longer true.

It's not something we should have been doing anyway.  We were needlessly
boxing the intermediate hash values, and passing them into a generic
method, just to unbox them again.

Fix this by creating a helper method, and calling that directly when
updating intermediate hash values.
2018-11-15 11:26:09 -08:00
Ewan Mellor e327e4a13e
Change uses of functions deprecated in Swift 4.2.
This is three instances of flatMap changing to compactMap, and
one instance of UnsafeMutablePointer.deallocate(capacity:) changing
to UnsafeMutablePointer.deallocate().
2018-11-15 11:26:09 -08:00
Ewan Mellor 23bc423259
Move Travis tests to Swift 4.2 and Xcode 10.1.
Move Travis Swift, .NET, and C++ macOS tests from Xcode 9 to Xcode 10.1.
Move Travis Linux Swift tests from Trusty to Xenial and to Swift 4.2.1.

Remove the dirname call when setting JAVA_HOME, it seems to be incorrect.
Print the JAVA_HOME that Travis ends up with.

Moving to Xcode 10.1 / Swift 4.2 exposes the issue discussed in #2372
so this cset will fail automated tests without the relevant fixes.
2018-11-15 11:25:37 -08:00
Ewan Mellor 8e9b6f1147
Switch to using maven-jdk-tools-wrapper to find tools.jar.
This is in different locations on JDK 9 and up.  maven-jdk-tools-wrapper
does the right thing on all JDK releases.

This was mentioned in a side comment on PR #2280.
2018-11-15 11:24:54 -08:00
Terence Parr f261c36bc4
Merge pull request #2400 from nxtstep/fix/st4-dependency
Fix ST4 Snapshot dependency
2018-11-15 09:29:42 -08:00
Terence Parr dc15fe9133
Merge pull request #2404 from ewanmellor/swift-repeated-epsilon-transitions
[Swift] Remove repeated epsilon transitions in ATN.
2018-11-15 09:28:26 -08:00
Terence Parr d87a55576a
Merge pull request #2403 from ewanmellor/swift-perf-tests
Enable some performance tests on Swift.
2018-11-15 09:27:59 -08:00
Terence Parr 66e5b3bfbb
Merge pull request #2402 from ewanmellor/swift-1922
[Swift] Report InputMismatchException with original context information
2018-11-15 09:27:10 -08:00
Steve Vinoski 562eab817c Do not throw std::bad_cast from antlrcpp::Any::is
The antlrcpp::Any::is function should not throw a std::bad_cast
exception if the contained type can't be cast to the requested type,
but should instead just return a boolean result. Add a boolean
parameter to the private getDerived helper function to allow callers
to specify whether or not they want the cast results checked. In the
is() function, pass false for this parameter; in the as() functions,
pass true.
2018-11-15 11:08:09 -05:00
Ewan Mellor c88fe83578
[Swift] Remove repeated epsilon transitions in ATN.
Port the cset 125a509e from the Java runtime.  This adds checks to ATNState
to remove any repeated edges.  This was PR #1369 for the Java runtime.
2018-11-14 21:11:27 -08:00
Ewan Mellor e6feaeb489
Enable some performance tests on Swift.
These were skipped for the Javascript backends because they're still
too slow, but Swift is fine.  (Go is also excluded from these, maybe
that's a mistake, but I don't know.)
2018-11-14 20:29:56 -08:00
Ewan Mellor 842d3d7597
[Swift] Report InputMismatchException with original context information
Port 0803c74 from the Java runtime to Swift.  This was issue #1922.
Enable the corresponding tests for Swift.
2018-11-14 20:28:24 -08:00
nxtstep 36621bda6d
Fix ST4 Snapshot dependency 2018-11-15 00:13:02 +01:00
Terence Parr 11d601348e
Merge pull request #2280 from solussd/master
File path handling fixes
2018-11-13 13:27:52 -08:00
Joseph Smith 6f057dbc59 Use STGroupFile filename constructor
- URL constructor unnecessary
2018-11-13 14:59:12 -06:00
Joe R. Smith 7fcadaa9f7
Use release version of st4 2018-11-13 11:23:39 -06:00
Terence Parr 7983e25ff6
Merge pull request #2399 from vinoski/cpp-any-const-accessors
Add const accessors to antlrcpp::Any C++ class
2018-11-13 09:02:26 -08:00
Joe R. Smith 61d8aea398
Merge branch 'master' into master 2018-11-13 10:57:42 -06:00
Joseph Smith 6899cc5c76 update st4 dep 2018-11-13 10:56:25 -06:00
Steve Vinoski 875aa034d2 Add const accessors to antlrcpp::Any C++ class
To make it easier to work with the const antlrcpp::Any arguments to
the AbstractParseTreeVisitor class aggregateResult and
shouldVisitNextChild functions, add a public const overload for the
antlrcpp::Any::as member function to return a const StorageType&, and
add a public const overloaded conversion operator returning a const
instance of the type contained within the Any.

Add the private antlrcpp::Any::getDerived function to avoid
duplicating the dynamic_cast of the internal pointer, and call it from
the overloaded Any::as functions and also the Any::is function.
2018-11-12 15:25:30 -05:00
Terence Parr dc3b43376c
Merge pull request #2244 from dannoc/antlr_clang_patches
Changes to cpp runtime to make antlr work with Chromium build
2018-11-11 09:27:04 -08:00
Terence Parr b06169c785
Merge branch 'master' into antlr_clang_patches 2018-11-11 09:26:42 -08:00
Terence Parr 2159d15da7
Merge pull request #2248 from uvguy/master
Add support c++ target on android
2018-11-11 09:26:09 -08:00
Terence Parr 7ef7770db1
Merge branch 'master' into master 2018-11-11 09:25:33 -08:00
Terence Parr e230ae7d69
Merge pull request #2203 from xgcssch/master
Support for CMake Packages in the Cpp Runtime
2018-11-11 09:24:32 -08:00
Terence Parr 42275a6de2
Merge pull request #2398 from mike-lischke/issue-2164
Fix for antlr#2164.
2018-11-11 09:22:52 -08:00
Sönke Schau 444fe24bb0
Merge branch 'master' into master 2018-11-11 13:21:57 +01:00
Mike Lischke 95fecce8ed Fix for memory leak in function `ParserATNSimulator::execATNWithFullContext` 2018-11-11 12:06:35 +01:00
parrt a02c2fa5a6 Merge branch 'master' of github.com:antlr/antlr4 2018-11-10 14:54:56 -08:00
parrt 8047283de7 use latest ST4 2018-11-10 14:54:42 -08:00
Terence Parr 40e883a0aa
Merge pull request #2162 from janlinde/make-exit-rule-non-virtual
C++ runtime: Make Parser::exitRule() non-virtual
2018-11-10 08:54:09 -08:00
Terence Parr 07cb53b0ff
Merge branch 'master' into make-exit-rule-non-virtual 2018-11-10 08:54:00 -08:00
Terence Parr 2471d7ec71
Merge pull request #2232 from ChaseOxide/master
Fixed warning from MingGW and error from Clang Windows
2018-11-09 11:40:51 -08:00
parrt f6c6217804 Force usage of previousContext in Cpp 2018-11-09 11:31:59 -08:00
parrt 5aa0df9c45 Fixes #2350 2018-11-09 11:28:30 -08:00
Terence Parr 27d5cc7163
Merge pull request #2396 from mike-lischke/master
Applied C++ changes for PR #1955.
2018-11-09 11:25:52 -08:00