Commit Graph

442 Commits

Author SHA1 Message Date
parrt 6ad9646382 update version in code to 4.8 2020-01-16 12:18:17 -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
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
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
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 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
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 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
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
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
Mike Lischke ec665c1b90 A small fix in the C++ documentation. 2019-01-03 10:39:59 +01: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 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
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
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 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 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
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