Commit Graph

3029 Commits

Author SHA1 Message Date
parrt 666131841c [maven-release-plugin] prepare for next development iteration 2020-01-16 12:24:30 -08:00
parrt d569f91795 [maven-release-plugin] prepare release 4.8 2020-01-16 12:24:22 -08:00
parrt 6ad9646382 update version in code to 4.8 2020-01-16 12:18:17 -08:00
parrt 441fea52b1 update to 4.3 version 2020-01-16 12:05:03 -08:00
Mike Lischke e47fd9d918 Brought back a lost comment and fixed a description. 2020-01-03 14:57:04 +01:00
Mike Lischke d295462e2e Doc update for C++ target and fixes for VS 2019 builds 2020-01-03 11:54:30 +01:00
Mike Lischke c487b1a580 Create pre-built binaries for VS 2017/19 instead of older VS versions 2020-01-03 09:01:13 +01:00
Terence Parr 4da24a261f
Merge pull request #2673 from zqlu/fix-javascript-pkg-main
Fix main entry point for JavaScript runtime npm package
2019-12-15 09:03:10 -08:00
Markus Zancolo 1565143529
Merge branch 'master' into fix/CppEmscripten 2019-12-12 10:56:42 +01:00
Terence Parr 8be60804ab
Merge pull request #2532 from WalterCouto/test2
don't unnecessary fetch all tokens when grabbing an interval of text …
2019-12-11 08:48:54 -08:00
WalterCouto f650a0be67 Separate bug fix to Java runtimes 2019-12-11 00:40:20 -05:00
Felix N 5be29fd61d
Merge branch 'master' into master 2019-12-09 10:53:50 +01:00
Mark Lilback 3bd5465881
[Swift] fixed compiler warnings about using var instead of let 2019-11-18 13:42:07 -08:00
Ewan Mellor a701f2b099
[Swift] Replace all uses of NSStringFromClass.
Bridging from NSString to String in Swift 5 is a transcoding operation, so
it is expensive.  Use String(describing:) instead of NSStringFromClass
to avoid this cost.
2019-11-18 13:24:28 -08:00
Ewan Mellor 509eeefa4a
[Swift] Migrate Swift runtime to Swift 5.
This switches from using the deprecated hashValue to hash(into:).
It also switches from using index to firstIndex (matching the change in
the standard library).

In the test template, we switch to using String directly instead of
String.characters.

This also switches all the Travis macOS tests to use the Xcode 10.2 / Mojave
image and changes the Linux Swift tests to download Swift 5.0.1.
2019-11-18 13:24:28 -08:00
Felix Nieuwenhuizen 9029af3ef4 Fix for CMake 3.14 2019-11-17 14:09:35 +01:00
Gerasimos Dimitriadis 437c5a7b9a
Merge branch 'master' into master 2019-11-14 23:52:19 +02:00
jerry_liu fa4b498fc2 Add pretty print AST 2019-11-11 21:33:04 +08:00
Alexei Averchenko 4f86ad5c17
Merge branch 'master' into master 2019-10-31 18:15:30 +03:00
Mike Lischke 3ae5d90296 Fixed an error regarding wrong unique_ptr usage
Also added VS 2019 project files.
2019-10-30 13:35:22 +01:00
zqlu c37ef7e0ea Fix main entry point for JavaScript runtime npm package 2019-10-22 20:31:36 +08:00
Markus Franke 76c0a65d19
Merge branch 'master' into master 2019-10-11 15:24:09 +02:00
Mike Lischke 4d649fbf71 Another attempt at solving this issue
There was already a patch to fix this issue, but it had some problems and was closed by the author after a while.
2019-10-11 14:47:39 +02:00
Mike Lischke 9723e4b9c9 C++ code cleanup
Converted back all TO_DO items to TODO (they were renamed ANTLR4 TODO items, but I had some for C++ which I all wanted to fix).
Also removed some default copy assignment operators which clang warned about.
2019-10-11 14:44:53 +02:00
Mike Lischke e208be701d Merge branch 'master-upstream' 2019-10-11 09:58:31 +02:00
Terence Parr 15e6619ddc
Merge branch 'master' into patch-1 2019-10-10 10:43:40 -07:00
miliu 35fcde7d69 add missed change 2019-09-29 20:51:31 -07:00
miliu 4a8eca579e resolve comments 2019-09-29 20:46:30 -07:00
miliu 033bb7f8c5 fix toString() 2019-09-29 13:57:20 -07:00
Terence Parr 818c6be691
Merge branch 'master' into fix-javascript-hashing-bug 2019-09-22 08:46:37 -07:00
Marcos Passos 789d746636 PHP Target 2019-09-14 09:39:58 -03:00
neko1235 f88f763983
Remove the match_calls counter
This fixes the potential data race caused by unsynchronized concurrent access.
2019-09-10 22:44:42 -07:00
neko1235 db0a57c6ee
Increment match_calls atomically
This ensures the correctness of the counter value, i.e. the value is the number of calls to the match() method.
2019-09-10 21:16:49 -07:00
neko1235 e2b1ae7c79
Fix data race in LexerATNSimulator
There is a potential memory consistency problem.
2019-09-10 16:01:16 -07:00
João Henrique ae28213343 Python3 XPath: Use Token.INVALID_TYPE instead of -1 on getXPathElement 2019-09-05 14:29:25 -03:00
João Henrique b0eb1825fb Spaces/Tabs mishap 2019-09-04 16:43:12 -03:00
João Henrique 8da2ce3044 Added XPath test on Python3 target 2019-09-04 16:02:39 -03:00
João Henrique f15a9f7628 Prevent XPath from returning the same node multiple times in Python3 2019-09-04 15:53:02 -03:00
João Henrique ae2a689a68 Fixed missing XPathLexer.STRING case 2019-09-04 15:33:24 -03:00
João Henrique 4c2f091e8c Style touch-ups on Python3 XPath implementation 2019-09-04 14:34:19 -03:00
João Henrique ff1283affb General XPath fixes for the Python3 runtime 2019-09-03 19:21:42 -03:00
Markus Franke 5a711ac79c Fix escaping of angle brackets 2019-08-27 13:28:40 +02:00
Eric Vergnaud 56eb0a3fab fix 2 erroneous calls, thanks @akaJes 2019-08-24 01:47:12 +08:00
Eric Vergnaud 3e258c5d9d avoid hashCode == 0 2019-08-24 01:46:11 +08:00
Eric Vergnaud 165dfa2b70 use same hash code whether readOnly or not 2019-08-24 01:45:31 +08:00
Eric Vergnaud badee1ffe1 fix minor issue in deserializer 2019-08-24 01:44:53 +08:00
Eric Vergnaud 32470dbab4 align on other runtimes 2019-08-24 01:44:36 +08:00
Mike Lischke 91a50749f9 Added cmake build informations as reported in antlr4/#2606 2019-08-21 10:34:21 +02:00
Mike Lischke d93857c8fe Applied recommended settings after XCode upgrade. 2019-08-18 12:27:50 +02:00
Mike Lischke 8651498f41 Merge branch 'master-upstream' 2019-08-18 11:18:41 +02:00
olowo726 06cee866d2 Made converters thread_local instead of local to function for performance 2019-07-11 19:20:20 +02:00
Terence Parr aa51ef297a
Merge branch 'master' into master 2019-06-23 15:45:10 -07:00
Thomas 3534089ddf Fix formating 2019-05-14 08:57:18 +02:00
Thomas 409b207bf1 Fix formating 2019-05-14 08:57:01 +02:00
Thomas c57996e589 Fix formating 2019-05-14 08:56:48 +02:00
Thomas 264db10290 Revert "Typo fix in XPath #2464"
This reverts commit d9c51b1525.
2019-05-13 22:38:49 +02:00
Thomas e7660d6cfa Align overlap condition on java implementation 2019-05-13 22:38:06 +02:00
Thomas 6fbc156f6c Align overlap condition on java implementation 2019-05-13 22:33:43 +02:00
Thomas 9a6b4e8fe8 Align overlap condition on java implementation 2019-05-13 22:33:16 +02:00
Thomas 0b0e521a8d Align overlap condition on java implementation 2019-05-13 22:25:42 +02:00
Thomas 17d626bc73 Align overlap condition on java implementation 2019-05-13 22:23:06 +02:00
Thomas f3184e9c8d Align overlap condition on java implementation 2019-05-13 22:19:19 +02:00
Thomas d9c51b1525 Typo fix in XPath #2464 2019-05-08 15:01:31 +02:00
Thomas 8d48f1a851 Fix overlaping condition 2019-05-08 14:26:11 +02:00
WalterCouto 31f4dcc7cf don't unnecessary fetch all tokens when grabbing an interval of text (match C# logic)
When an exception is thrown, it calls getText to get the text of the tokens invloved but the current C++ and Java implemention first fetches the rest of the tokens instead of  just using the tokens it already has.  C#'s version is correct (fill() is called only when asking for the entire stream's text).
2019-04-17 20:10:37 -04:00
Alexei Averchenko 4cf4883514 Fixed -Wreorder warning 2019-04-09 09:20:04 +03:00
Gerasimos Dimitriadis d69e7c4d0f Avoid double deletion when NoViableAltException is thrown
When ownership of the configurations set is passed to a NoViableAltException,
it get deleted more than once if the exception happens to get copied.
2019-02-23 20:31:19 +02:00
Terence Parr dade65a895
Merge pull request #2463 from youkaichao/python/test
update test script
2019-02-23 08:57:40 -08:00
Ralu de58c28a24
Fix off by one error in getChild 2019-02-06 10:41:38 +01:00
Markus Zancolò 4fec5f9f7c fix cpp cmake for emscripten
Emscripten can do C++11. added it to the compilercheck in CMakeLists
2019-01-16 14:55:03 +01:00
You Kaichao 45a4cdc67b update test script 2019-01-04 09:17:36 +08:00
You Kaichao 18e2a605c1 update python runtime doc 2019-01-03 19:29:56 +08:00
Mike Lischke ec665c1b90 A small fix in the C++ documentation. 2019-01-03 10:39:59 +01:00
You Kaichao 157afd1a8d update code on updated master 2019-01-02 19:06:36 +08:00
Eric Vergnaud 90854967ca fix broken API calls 2019-01-01 15:04:20 +01:00
Eric Vergnaud 3ad118f87e fix invalid test sequence 2019-01-01 13:31:01 +01:00
Eric Vergnaud cccf6e87da Fix API inconsistency, where getText would expect a tuple named interval, leading to lots of confusion 2019-01-01 13:20:23 +01:00
Eric Vergnaud 108854f986 remove misleading API 2019-01-01 13:19:38 +01:00
Alexey Khoroshilov f73ae702f2 LexerATNSimulator: avoid repeatable import of Lexer
Importing module is quite expensive operation for using it
in a lexer during normal operations.

The patch avoids it by caching the required properties
in LexerATNSimulator object.

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
2019-01-01 15:18:46 +03:00
Terence Parr 6808f9c4b4
Merge pull request #2447 from WalterCouto/test2
Change bitset upperbound to another higher arbitrary value to allow f…
2018-12-26 09:26:13 -07:00
Terence Parr fa19ded837
Merge pull request #2446 from WalterCouto/test
C++ avoid warning in visual studio build due to clang specific directive
2018-12-21 12:01:22 -07:00
Terence Parr fa466c42a1
Merge pull request #2445 from WalterCouto/master
C++: fix bug in PredictionContext::mergeArrays
2018-12-21 12:01:08 -07:00
Terence Parr ce3b5a4cb4
Merge pull request #2176 from niccroad/atnsimulator_memleak
This resolves the recently opened issue 2175 (a memory leak).
2018-12-21 12:00:36 -07:00
WalterCouto 6195ec749b Change bitset upperbound to another higher arbitrary value to allow for larger number of rules
We had a complex grammar file hit past this upperbound.  One solution is to put this up higher, another is to refactor into a container that can grow.
2018-12-20 11:18:16 -05:00
WalterCouto 2d28400234 C++ avoid warning in visual studio build due to clang specific directive
The revently added clang directive cause a new warning for Visual Studio build. Need to include the new code with a directive checking for visual studio
2018-12-20 11:02:35 -05:00
WalterCouto 936db23a40 C++ runtime version of previousTokenOnChannel doesn't handle edge case correctly #2343
<!--
Before submitting an issue to ANTLR, please check off these boxes:

- [x] I am not submitting a question on how to use ANTLR; instead, go to [antlr4-discussion google group](https://groups.google.com/forum/#!forum/antlr-discussion) or ask at [stackoverflow](http://stackoverflow.com/questions/tagged/antlr4)
- [ x] I have done a search of the existing issues to make sure I'm not sending in a duplicate

Please include information about the expected behavior, actual behavior, and the smallest grammar or code that reproduces the behavior. If appropriate, please indicate the code generation targets such as Java, C#, ...  Pointers into offending code regions are also very welcome.
-->
As documented previousTokenOnChannel, should "return -1 if there are no tokens on channel between i and 0."  but the C++ version of the runtime returns 0 not -1 as can be seen below:

```
while (true) {
    Token *token = _tokens[i].get();
    if (token->getType() == Token::EOF || token->getChannel() == channel) {
      return i;
    }

    if (i == 0)
      break;
    i--;
  }
```

Looking at the Java implementation, it would seem the C++ code should instead be:
```
while (true) {
    Token *token = _tokens[i].get();
    if (token->getType() == Token::EOF || token->getChannel() == channel) {
      return i;
    }

    if (i == 0)
      return -1;
    i--;
  }
```
This bug causes getHiddenTokensToLeft() to miss hidden tokens that come before the first non-hidden token.  There would also be a potential bug in CommonTokenStream::LB as the "< 0" case would never happen.
2018-12-20 10:24:49 -05:00
WalterCouto 27c8eb5c6a C++: fix bug in PredictionContext::mergeArrays
In the orignal PredictionContext::mergeArrays there was a bug on Line 281 where the logic differs from java: It currently is:
bool both$ = payload == EMPTY_RETURN_STATE && a_parent && b_parent;
and should instead match java as:
bool both$ = payload == EMPTY_RETURN_STATE && !a_parent && !b_parent;
2018-12-20 10:07:59 -05:00
parrt 70d9ddcd0a [maven-release-plugin] prepare for next development iteration 2018-12-18 10:35:34 -08:00
parrt be58ebffde [maven-release-plugin] prepare release 4.7.2 2018-12-18 10:35:24 -08:00
parrt 8fab6b98b3 [maven-release-plugin] rollback the release of 4.7.2 2018-12-18 10:33:52 -08:00
parrt 573cb86705 [maven-release-plugin] prepare release 4.7.2 2018-12-18 10:31:44 -08:00
parrt 9f6dfb1809 Merge branch 'master' of github.com:antlr/antlr4 2018-12-17 14:43:34 -08:00
Terence Parr 96890a3505
Merge branch 'master' into patch-1 2018-12-17 15:40:30 -07:00
parrt 38a95da397 manual edits of 4.7.1 -> 4.7.2 2018-12-17 14:32:39 -08:00
ralf 7fdec95d15 added virtual dtor to polymorphic class template ParseTreeProperty 2018-11-29 10:44:47 +01:00
Eric Vergnaud 56186d9e9f fix NPE 2018-11-26 01:03:36 +08:00
Terence Parr 0308999f06
Merge pull request #2413 from nxtstep/fix/mutex-free
[Swift-runtime] Make sure mutexes are being freed accordingly
2018-11-18 09:13:57 -08:00
Eric Vergnaud 77c830e6e1 fix #1955 for Javascript 2018-11-18 19:44:33 +08:00
Eric Vergnaud 43e529ca73 fix #1955 for Python 2018-11-18 19:41:47 +08:00
Eric Vergnaud f6537bf4ac fix #1955 for Chsarp 2018-11-18 19:31:47 +08:00
Terence Parr d714d7ba9c
Merge pull request #2409 from amykyta3/master
Fix install dependency for 'typing' library in python3.4
2018-11-17 09:30:40 -08:00
Terence Parr 6080a0639c
Merge pull request #2411 from ewanmellor/swift-fix-2369
[Swift] Syntax error in antlr4/runtime/Swift/boot.py
2018-11-16 08:48:09 -08:00
nxtstep 4e744043a3 Make sure mutexes are being freed accordingly 2018-11-16 17:26:52 +01:00
Ewan Mellor 9d29f116cb
[Swift] Syntax error in antlr4/runtime/Swift/boot.py
Make boot.py work under both Python 2 and 3.  This fixes #2369.

Add an extra exception handler, for neater error messages.
2018-11-15 21:49:58 -08:00
Ewan Mellor 0f1614dd99
[Swift] Tidy-ups around addDFAEdge.
Do some tidy-ups around addDFAEdge, improving the handling of nils so that
we're not forcing or nil-checking so much.
2018-11-15 21:25:47 -08:00
Ewan Mellor 8f42439943
[Swift] Remove unused constructors.
Remove unused constructors from ATNConfig and DFAState, and merge two
by using a default parameter instead.
2018-11-15 21:25:47 -08:00
Ewan Mellor 176d92d373
[Swift] Tighten up the permissions on lots of fields
Tighten up the permissions on lots of fields, for debuggability.
2018-11-15 21:25:47 -08:00
Ewan Mellor 623fe00fb7
[Swift] Change a whole bunch of "final var" to "let".
I think that there was some confusion when the original port from Java
was done, because "final" in Java is not the same as "final" in Swift.
2018-11-15 21:25:47 -08:00
Ewan Mellor e01d0be92c
[Swift] Remove implicitly unwrapped optional from ATN.grammarType.
This is set in the constructor and is never nil, so this wasn't doing
anything.
2018-11-15 21:25:47 -08:00
Ewan Mellor 9ca1a9e158
[Swift] Remove ATNState.INITIAL_NUM_TRANSITIONS.
This was brought over from the Java runtime in the initial port, but there
it was used as an array capacity hint.  We're not using it in Swift so
this is useless.
2018-11-15 21:25:47 -08:00
Ewan Mellor 8a34dcdcf9
[Swift] Move doc-comment.
This was attached to the incorrect method in the initial port from Java.
2018-11-15 21:25:47 -08:00
Ewan Mellor 3deb4d91e6
[Swift] Remove OrderedATNConfigSet.
This is a subclass that only exists to have a different constructor.  There
is no need for this construction in Swift, since we have named parameters,
so we can remove the entire subclass and make ATNConfigSet final instead.
2018-11-15 21:25:47 -08:00
Ewan Mellor 657ab4b3b4
[Swift] Remove OrderedATNConfig.
This is unused.
2018-11-15 21:25:47 -08:00
Alex Mykyta 2a3530f513 Fix install dependency for python3.4
Add install dependency for "typing" backport if using anything older than Python3.5
2018-11-15 20:15:39 -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 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
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
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
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 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
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
Sergey Chupov a3e7099dac
Merge branch 'master' into patch-1 2018-11-12 11:00:48 +02:00
Terence Parr b06169c785
Merge branch 'master' into antlr_clang_patches 2018-11-11 09:26:42 -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
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
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
Mike Lischke 3d764a39fd Applied C++ changes for PR #1955.
Also applied recommended XCode settings.
2018-11-09 09:32:24 +01:00
Terence Parr 25b30623c0
Merge branch 'master' into master 2018-11-08 13:46:09 -08:00
Terence Parr 39a1aa5c0f
Merge pull request #2156 from ewanmellor/swift-stream-tidyups
[Swift] Minor tidyups in the stream code.
2018-11-08 13:45:30 -08:00
Terence Parr 54131a074e
Merge pull request #2155 from ewanmellor/swift-ATNDeserializationOptions-struct
[Swift] Make ATNDeserializationOptions a simple struct.
2018-11-08 13:45:16 -08:00
Terence Parr 0c63b68e18
Merge pull request #2154 from ewanmellor/swift-remove-hashmap
[Swift] Remove HashMap and fix Parser caches.
2018-11-08 13:44:59 -08:00
Terence Parr f1b195765a
Merge pull request #2165 from niccroad/vs2017projects
Add Visual Studio 2017 project to Cpp runtime. Also change define for static library setting to be ANTLR4CPP_STATIC, in all projects.
2018-11-08 13:42:22 -08:00
Terence Parr f45e36509c
Merge branch 'master' into cppruntime-non-appleclang-macosx 2018-11-08 13:41:32 -08:00
Terence Parr e25ff7105c
Merge pull request #2338 from m-novikov/stdin-stream
Allow importing StdinStream from antlr4 package
2018-11-08 13:26:51 -08:00
Christopher C. Aycock 5a7912abde Parenthetical spacing in CMake files is more consistent 2018-10-30 12:48:58 -04:00
Christopher C. Aycock 4285979cad Fixed file name managling and added ability to list zip file 2018-10-30 01:42:47 -04:00
Christopher C. Aycock 0a1b3c7df6 Improved ExternalAntlr4Cpp and added CMake option for static CRT (Fixes #1872) 2018-10-29 17:20:24 -04:00
Edir Garcia Lazo 9a42ff33f4 Use proper spacing formatting for this repo 2018-10-18 11:20:38 -07:00
Edir Garcia Lazo 0af9611215 Properly build and pass in decisionToDFA 2018-10-18 11:16:55 -07:00
Andreas Skaar 10f8cac7f4 Update runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/SingletonPredictionContext.cs
NullReferenceException in CSharp target #2304
2018-10-08 22:05:05 +02:00
Terence Parr d86365d0d6
Merge branch 'master' into cpack 2018-09-05 13:08:32 -07:00
ENDOH takanao 411960b187 remove double dots in the filename
some tools are can not handling files that have double dots in the filename
2018-08-03 16:16:04 +07:00
Maxim Novikov c956fbbbc6 Allow importing StdinStream from antlr4 package 2018-07-31 07:04:48 +02:00
Maksim Novikov ad603efe91 Add StdninStream for python3 runtime. Closes: #2271 2018-07-27 20:37:34 +02:00
Terence Parr fc01366f35
Merge pull request #2196 from robertbrignull/visit_null_children
JavaScript parse tree visitor: check if ctx.children is non-null in visitChildren
2018-07-24 15:54:06 -07:00
Terence Parr 7dbc5ddc15
Merge branch 'master' into master 2018-07-24 12:59:04 -07:00
Terence Parr 73170a2076
Merge branch 'master' into master 2018-07-24 12:57:38 -07:00
Terence Parr c9df334af8
Merge pull request #2302 from ericvergnaud/python-3-fix-2301
Fixes #2301
2018-07-24 12:56:46 -07:00
James Goppert ee92d8caf1 Add support for cpack. 2018-07-03 20:21:55 -04:00
Sergey Chupov 788fd9a1b4
Merge branch 'master' into patch-1 2018-06-18 14:05:32 +03:00
Sergey Chupov 804353e217
Avoid StringIndexOutOfBoundException
This fixes https://github.com/antlr/antlr4/issues/2138#issuecomment-397271786. Clearly it's been an oversight, since the same code has been fixed for CodePoint8Bit in this commit: ac9f75303e
2018-06-14 16:03:17 +03:00
Eric Vergnaud d134b6a12d Fixes #2301 2018-06-03 11:21:37 +08:00
sinopsysHK 58ef6bbc96 Enable running debug mode of ParserATNSimulator
This is to have appropriate logs during debug and avoid crashing in some occasions when startIndex=stopIndex

range(startIndex, stopIndex) is equivalent to an array of values from startIndex to stopIndex-1 thus when startIndex=stopIndex range(startIndex, stopIndex+1) = [startIndex] which is not exactly an interval and would break getText that is expecting an interval as a Tuple.
2018-05-16 23:37:21 +08:00
Zongyuan Zuo 2d08b9f414
Merge branch 'master' into master 2018-03-26 20:36:50 +08:00
EternalPhane 8fb3b42ded rewrite with std::is_nothrow_copy_constructible 2018-03-26 20:31:51 +08:00
Terence Parr 6ffc59d63c
Merge pull request #2223 from io7m/master
Add an Automatic-Module-Name
2018-03-18 15:33:40 -07:00
Marcus Ong 0ef96334c7 Added line breaks on README 2018-03-12 12:14:50 -05:00
uvguy bb516f0e91
add note android build 2018-03-10 12:53:39 +07:00
Daniel Clifford 6e213a09c5 Changes to cpp runtime to make antlr work with Chromium build 2018-03-08 14:38:19 +01:00
Terence Parr 30ef969e76
Merge pull request #2177 from mike-lischke/threading-fix
Patch for multi-threaded parsing with the C++ runtime
2018-03-01 09:29:29 -08:00
Marcus Ong e455af199e Fixed indentation 2018-02-28 20:27:09 -06:00
Marcus Ong e4d6457999 Added support to Xcode 2018-02-28 20:18:10 -06:00
ChaseOxide c1365684c3 Added support for OSX 2018-02-28 16:36:33 -06:00
Marcus Ong 2ee1a19654 Updated README.md formatting 2018-02-28 14:30:19 -06:00
Marcus Ong 526e6cdb9d (Visual C++) Added CMake option to link CRT
Previously Visual C++ users were forced to link CRT statically,
i.e. use /MT flag whenever they want to use the static library.
Linker have an error if user tries to link a /MT static library
to a /MD executable.

This commit defaults the build to statically link with CRT, but
may be turned off if needed.
2018-02-28 14:09:01 -06:00
Marcus Ong f296b75473 Improved ExternalAntlr4Cpp (Fixes #1872)
Removed the old macro antlr4cpp_process_grammar as it has a lot of
parameters which may not be what the user needs.
2018-02-28 12:27:07 -06:00
Marcus Ong d83536ffbc Fixed indentation 2018-02-26 11:15:32 -06:00
Zongyuan Zuo b4a43a886d
fix typos 2018-02-26 19:55:51 +08:00
Zongyuan Zuo 54297cd329
rewrite + add patch to all stl containers 2018-02-26 19:51:21 +08:00
Marcus Ong 3fd8931d9d Avoid forward declare std::exception on clang-cl
It will prevent clang-cl to output the warning [ignored-attributes].
2018-02-25 18:55:17 -06:00
Marcus Ong afb85ea34e Fixed warning from MingGW and error from Clang Windows
This commit fixes:
- In MingGW
  warning: declaration 'class std::exception' does not declare anything
- In Clang (I tested with clang-tidy on Windows specifically)
  error: forward declaration of class cannot have a nested name
    specifier [clang-diagnostic-error]
2018-02-25 18:17:46 -06:00
Mark Raynsford b5b3a3c5fc
Add an Automatic-Module-Name
This adds an Automatic-Module-Name entry to the runtime jar in order to
provide a stable name upon which other modules can depend. The module
name chosen was "org.antlr.antlr4.runtime". This closely matches the
Maven artifact name with the obviously change that the module name
doesn't contain a hyphen (hyphens can't be used in module names at
the language level in Java).

Fix #2163
2018-02-11 13:06:19 +00:00
Raz Friman c0cfcdf23c
Update README.md
Make the NuGet package name more visible and add a link to the official package
2018-02-08 14:02:59 +11:00
Kyle Sletten 6e5155c943
Merge branch 'master' into remove-unused-_loadString-parameter 2018-02-07 09:24:05 -07:00
EternalPhane 6b8e9824a6 fix #2211 2018-02-03 17:12:09 +08:00
EternalPhane d027f00aca add patch to std::vector 2018-01-30 00:17:41 +08:00
EternalPhane 940e174b5e fix typos 2018-01-29 21:38:15 +08:00
EternalPhane 2c8542b514 let Any::Derived<T>::clone depend on whether T is copy-constructible 2018-01-29 20:48:07 +08:00
Sönke Schau be8b865276 It turned out that the implemented CMake function generating the runtime files didn't work for combined lexer/parser files.
Added a third required parameter which specifies the type of input file.
2018-01-16 15:57:26 +01:00
Sönke Schau 6bd439959b
Update Antlr4Package.md 2018-01-15 19:16:59 +01:00
Sönke Schau e6a05ef60f Merge branch 'master' of https://github.com/xgcssch/antlr4 2018-01-15 19:10:53 +01:00
Sönke Schau 8e2126a9e5 Change/Add documentation of the CMake package feature 2018-01-15 19:10:27 +01:00
Soenke Schau 0218f5454a Changed the compiler detection code for Clang so that FreeBSD is supported too 2018-01-15 18:10:19 +01:00
Sönke Schau 10d7878ed1 Add code to optionaly generate two cmake package during install when 'ANTLR4_INSTALL' is set:
'antlr4-runtime' which imports the required runtime targets and
'antlr4-generator' which provides a convenient function to use the generator.
Only the latter one has a dependency to the Java package.
2018-01-15 17:31:14 +01:00
Robert 87725e65c9
Add an explicit return statement 2018-01-05 11:26:31 +00:00
Robert Brignull dd3af945fd Only visit is ctx.children is non-null 2018-01-03 12:49:52 +00:00
jkmar 6326725270 [Python2] return result instead of None in visitor 2018-01-01 20:29:40 +01:00
jkmar dfba8c68db [Python3] return result instead of None in visitor 2017-12-27 22:22:49 +01:00
Kyle Sletten a7f3efb7eb
Remove unused parameter in `_loadString`
The usage of this method was removed in commit 51edf3cece, but the parameter remained.
2017-12-20 11:39:57 -07:00
parrt 74779f334a tweak comment to be consistent with code. Fixes #2172 2017-12-19 12:33:09 -08:00
Mike Lischke 4c8fd4e4bb Reference can be const. 2017-12-19 15:19:44 +01:00
Mike Lischke 4ea90b5976 Fixes #2175 (mem-leak) 2017-12-19 15:14:03 +01:00
Ajay Panyala 505f672ca1 Remove suggested fix comment 2017-12-17 08:09:55 -08:00
Ajay Panyala 18bdbb5a22 suggest alternative fix 2017-12-16 17:36:06 -08:00
Ajay Panyala 07d7bd1f36 Add missing -std=c++11 flag when using non-appleclang compiler on macosx 2017-12-16 17:20:54 -08:00
Nicolas e7b6521431 Merge branch 'master' into vs2017projects 2017-12-15 19:57:07 +13:00
Nicolas 26d0d3143e Update projects to the static library configurations define
ANTLR4CPP_STATIC rather than ANTLR4CPP_EXPORT.
2017-12-15 19:33:32 +13:00
Nicolas f3f8cb877f Add visual studio 2017 version of cpp runtime projects. 2017-12-15 19:22:28 +13:00
Mike Lischke ceb4ca7ce7 Merge branch 'master-upstream' 2017-12-14 13:26:02 +01:00
Mike Lischke f17319a9a5 Fixed multi-threading issue in C++ runtime.
The shared s0 state in a DFA was deleted when setting a new one (from the DFA entries possibly). That could led to a situation where a valid reference was deleted, even though it's still needed.

Additionally fixed some formattings and updated the XCode projects in the demo.
2017-12-14 13:25:12 +01:00
Jan Lindemann 4e3c5ddffb Make C++ Parser::exitRule() non-virtual
Parser::exitRule() in the C++ runtime is a virtual function which is not
reimplemented anywhere. OTOH, it is invoked during the execution of
every rule, which can cause a noticeable performance hit. This commit
removes its virtual qualifier. It should make a difference particularly
for large grammars, because the number of rules corresponds to the
number of the Parser object's virtual functions, and, consequently, its
vtable lookup time.

Tested with a VHDL grammar of 436 rules, where it brings down parsing
time from 75 to 44 seconds on unoptimized compilation, i.e. a 40% speed
gain.  Still a lot slower than an equivalent java parser, though, which
takes 2.64 seconds for the same input.
2017-12-13 12:07:19 +01:00
Jan Lindemann 2634246b07 Add missing override keyword to virtual functions
Add missing override markers to the following functions of the C++
runtime:

  - TokensStartState::getStateType()
  - TagChunk::toString()
  - TextChunk::toString()

The missing markers made builds against the API with -Wsuggest-override
choke.
2017-12-13 12:04:50 +01:00
enessoylu 0668b53083 update license string 2017-12-13 02:14:57 -05:00
parrt ba47b092e9 update setup.py to use setuptools not distutils (Python 3) 2017-12-10 12:32:52 -08:00
parrt d674274f99 update setup.py to use setuptools not distutils 2017-12-10 12:28:05 -08:00
parrt 17b6277502 [maven-release-plugin] prepare for next development iteration 2017-12-09 12:04:26 -08:00
parrt bdc05c87be [maven-release-plugin] prepare release 4.7.1 2017-12-09 12:04:17 -08:00
Ewan Mellor 35b9bbfe17
[Swift] Minor tidyups in the stream code.
No semantic change.
2017-12-08 16:36:00 -08:00
Ewan Mellor b4f3a619fd
[Swift] Make ATNDeserializationOptions a simple struct.
The previous code was ported from Java, which resulted in 70 lines of code
to hold two bools.  Use a struct instead.
2017-12-08 16:35:21 -08:00
Ewan Mellor f8e63d53c5
[Swift] Remove HashMap and fix Parser caches.
Remove HashMap, and replace all uses of it with dictionaries.  There's
no need for us to have a custom HashMap implementation (mirroring the Java
standard library) when Swift's standard dictionaries work just fine.

Fix Parser.bypassAltsAtnCache.  This was declared as a Parser instance
variable, when in the Java runtime it is static (and therefore the cache
outlives the Parser instances).  It was also being handled in a
thread-unsafe manner, because the cache was being read outside of the
mutex that was supposed to be protecting it.  Fix both issues by moving
the cache and the mutex so that they are static to the Parser module and
rewriting getATNWithBypassAlts.

Remove Parser.decisionToDFAMutex.  The Java code uses a synchronized block
on ParserATNSimulator.decisionToDFA, but the translation to Swift had put
a mutex in Parser.  The decisionToDFA value is shared between Parser,
ParserATNSimulator, and the generated parser, so a mutex in
ParserATNSimulator isn't blocking all possible accesses, so it's useless.
Since this is only code for debugging anyway, just remove the useless mutex
and simplify getDFAStrings and dumpDFA.
2017-12-08 16:32:51 -08:00
parrt 763a1242b7 update version number and tweak doc 2017-12-08 12:47:11 -08:00
Mike Lischke baf8b95b1c Updated XCode project + fixed a gotcha in ATNState::removeTransition. 2017-12-08 09:33:33 +01:00
Terence Parr 7259baaf8a
Merge pull request #2151 from davesisson/hidden-tokens
Export GetHiddenTokens routines
2017-12-07 09:55:05 -08:00
Terence Parr 5987936a86
Merge pull request #2150 from davesisson/trees
Fix issue with tree finding when the underlying slice needs to be resized.
2017-12-07 09:54:52 -08:00
David Sisson a2bfeeb760 update tests too 2017-12-06 11:27:52 -08:00
David Sisson b66cc174b9 Export GetHiddenTokens routines. 2017-12-06 11:25:42 -08:00
David Sisson 1e1e132a91 Fix issue with tree finding when the underlying slice needs to be resized. 2017-12-06 11:22:22 -08:00
David Sisson 2d71d94386 Updated formatting. 2017-12-06 11:04:31 -08:00
David Sisson 7e39515dfe Changed rotation to support 32 and 64-bit architectures as noted in issue #2060. 2017-12-06 11:01:19 -08:00
parrt b9adef5878 set version for C# dotnet to 4.7.1.1 for publishing 2017-12-04 14:12:20 -08:00
Terence Parr b5e6147cd5
Merge pull request #2123 from ewanmellor/swift-fix-parse-cancellation
[Swift] Fix parse-cancellation in BailErrorStrategy.
2017-11-29 09:56:09 -08:00
Terence Parr bd4f1a9365
Merge pull request #2122 from ewanmellor/swift-remove-recognizer-caches
[Swift] Remove Recognizer.tokenTypeMapCache and .ruleIndexMapCache.
2017-11-29 09:55:53 -08:00
Terence Parr 756fcdd5ec
Merge pull request #2121 from ewanmellor/swift-fix-interpreter-dfas
[Swift] Fix initialization of {Lexer,Parser}Interpreter.decisionToDFA.
2017-11-29 09:55:38 -08:00
Terence Parr c586a592ce
Merge pull request #2120 from ewanmellor/swift-remove-arraylist
[Swift] Remove ArrayList.
2017-11-29 09:55:23 -08:00
Terence Parr 406b1816c8
Merge pull request #2119 from ewanmellor/swift-remove-triple
[Swift] Remove Triple.swift.
2017-11-29 09:55:11 -08:00
Terence Parr 633de4aeab
Merge pull request #2118 from ewanmellor/swift-let-sharedcontextcache
[Swift] Make ATNSimulator.sharedContextCache non-optional.
2017-11-29 09:54:52 -08:00
Terence Parr aec23acb24
Merge pull request #2117 from ewanmellor/swift-remove-modeNameToStartState
[Swift] Remove unused ATN.modeNameToStartState.
2017-11-29 09:54:26 -08:00
Terence Parr ed37fa23e6
Merge pull request #2115 from ewanmellor/swift-minor-tidups
[Swift] Some minor tidyups.
2017-11-29 09:54:13 -08:00
Terence Parr 3536a84b52
Merge pull request #2114 from ewanmellor/swift-let-precedencedfa
[Swift] Make DFA.precedenceDfa be a "let" rather than a "var".
2017-11-29 09:53:57 -08:00
Terence Parr aaca1b9f3c
Merge pull request #2113 from ewanmellor/swift-makereadonly
[Swift] Replace IntervalSet.setReadonly with makeReadonly.
2017-11-29 09:53:40 -08:00
Terence Parr 8c1a46d87a
Merge pull request #2112 from ewanmellor/swift-mutexes-let
[Swift] Make all the mutexes "let" rather than "var".
2017-11-29 09:53:11 -08:00
Terence Parr d691f4d086
Merge pull request #2108 from ewanmellor/swift-tidyups-parser
Tidy-ups inside the Swift runtime around ParseTree, ParserRuleContext
2017-11-29 09:52:54 -08:00
Terence Parr 84e9a46932
Merge pull request #2107 from ewanmellor/swift-fix-deprecated-string-methods
Remove use of deprecated String functions
2017-11-29 09:52:27 -08:00
Terence Parr 6bcde64abf
Merge pull request #2106 from ewanmellor/swift-open-error-strategy
Open the error strategies to subclasses.
2017-11-29 09:50:03 -08:00
Terence Parr e11e707a38
Merge pull request #2105 from gendalph/cmake
The correction for cmake depends on the demo
2017-11-29 09:49:38 -08:00
Terence Parr 14880cb3b4
Merge branch 'master' into support_intel_compiler 2017-11-29 09:47:51 -08:00
Terence Parr 9a701ef57f
Merge pull request #2103 from ewanmellor/swift-tidy-atndeserializer
Tidy ATNDeserializer.
2017-11-29 09:47:19 -08:00
Terence Parr 8b86af6654
Merge pull request #2102 from ewanmellor/swift-antlrfilestream-report-errors
Report errors in ANTLRFileStream.
2017-11-29 09:47:04 -08:00
Terence Parr a7af99b17f
Merge pull request #2101 from ewanmellor/swift-fix-uuid-extension
Implement UUID.init(mostSigBits, leastSigBits) in the Swift runtime.
2017-11-29 09:46:29 -08:00
Terence Parr afa2574862
Merge pull request #2100 from ewanmellor/swift-fix-parsetreepatternmatcher
Fix ParseTreePatternMatcher.split in the Swift runtime.
2017-11-29 09:46:03 -08:00
Terence Parr 963d44f930
Merge pull request #2024 from kaedvann/master
[CSharp] #2021 fixes nuget packaging options to avoid missing dll exceptions
2017-11-25 12:17:15 -08:00