Commit Graph

424 Commits

Author SHA1 Message Date
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
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
Christopher C. Aycock 0a1b3c7df6 Improved ExternalAntlr4Cpp and added CMake option for static CRT (Fixes #1872) 2018-10-29 17:20:24 -04: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
James Goppert ee92d8caf1 Add support for cpack. 2018-07-03 20:21:55 -04: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
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
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