Commit Graph

7809 Commits

Author SHA1 Message Date
Terence Parr 2b119be553
Merge pull request #2854 from nburles/fix_u8string_cpp20
[C++ codegen] Remove use of the u8"" string literal prefix
2020-09-10 10:52:46 -07:00
Terence Parr 630e4c0b7d
Merge pull request #2865 from nburles/fix_switch_missing_default_case
[C++ codegen] Add default cases to AltBlock and OptionalBlock
2020-09-10 10:52:25 -07:00
Terence Parr 86b88f697b
Merge pull request #2887 from stevenjohnstone/master
Fix C++ target README example
2020-09-10 10:51:12 -07:00
Terence Parr a161845829
Merge branch 'master' into master 2020-09-10 10:51:02 -07:00
Terence Parr 40df0c169f
Merge pull request #2899 from ArthurSonzogni/bug-2898
Fix clang compile error with --stdlib=libc++
2020-09-10 10:50:08 -07:00
Kilian Kilger cdf67a5ed2
Merge branch 'master' into master 2020-09-10 18:36:54 +02:00
Kilian Kilger 19adda3a58 Add thread_local again in StringUtils.h due to better performance 2020-09-10 18:33:08 +02:00
Pablo Blanco Celdrán 7d10669421
Merge branch 'master' into master 2020-09-10 17:55:55 +02:00
irabeson af53acd2a2 Merge branch 'master' into cpp_vocabulary_cleanup 2020-09-10 10:42:36 -04:00
Tian Siyuan 2a573927ea
add a missing space 2020-09-10 16:31:15 +08:00
ArthurSonzogni f68c47a988 Fix clang compile error with --stdlib=libc++
On linux. Most users haven't installed libc++-dev, but ANTLR is passing
the "--stdlib=libc++" argument. As a result, this won't compile. Users
will see:
```
/tmp/antlr4/runtime/Cpp/runtime/src/antlr4-common.h:8:10: fatal error:
'algorithm' file not found
```

This is caused by the "WITH_LIBCXX" option.
It was introduced by:
d46ef90aa0

It causes the option "--stdlib=libc++" to be appended by default.

I believe its default value should have been left as "Off".

With "off" by default, clang will use its default C++ library, which is
always available.

The WITH_LIBCXX option is kept, being able to change the C++ library
might be useful?

BUG=https://github.com/antlr/antlr4/issues/2898
2020-09-06 15:30:54 +02:00
ericliu f2007278bb
fix a typo 2020-08-27 14:14:47 +08:00
Stevie Johnstone 8270f329ad Fix C++ target README example
tree::ParseTreeWalker::DEFAULT is not a pointer
2020-08-22 17:48:15 +01:00
Terence Parr be881fa6b9
Merge pull request #2806 from felixn/no-extra-semi
C++ target: don't generate extra/duplicate semicolons
2020-08-20 08:52:24 -07:00
Felix Nieuwenhuizen 68e9a25bbe don't generate extra/duplicate semicolons 2020-08-19 18:25:19 +02:00
Terence Parr 533f63382a
Merge pull request #2883 from lingyv-li/pin-dart-version
Fix travis ci for Dart pin version
2020-08-19 09:20:15 -07:00
Larry Li 0b34136a44 fix dart sdk url 2020-08-19 13:31:32 +10:00
Larry Li d47db45180 fix travis ci for pinned dart sdk version 2020-08-19 12:31:02 +10:00
Terence Parr b173138a3b
Merge pull request #2882 from lingyv-li/pin-dart-version
Pin dart version to 2.8.4 to get unit tests passing
2020-08-18 15:09:04 -07:00
Larry Li 1eb6c3ee52 pin dart version to 2.8.4 2020-08-19 07:16:58 +10:00
Larry Li c8571060f0 pin dart version to 2.8.4 to get unit tests passing 2020-08-19 06:36:32 +10:00
Terence Parr 2ba38605b9
Merge pull request #2728 from lingyv-li/dart-clean
Dart Target
2020-07-31 17:55:19 -07:00
Terence Parr dfc7ffc39c
Merge branch 'master' into dart-clean 2020-07-27 11:33:40 -07:00
Nathan Burles 8b706e2427 Add default cases to AltBlock and OptionalBlock
All other switch statements have a default case (either "break" or
"<error>"), but these are missing.

Does not change functionality, simply fixes a warning - and allows a
project to build with -Werror.
2020-07-15 14:33:59 +01:00
Terence Parr eb1adaa8a7
Merge pull request #2864 from antlr/fix-javascript-NPE
Fix a NPE
2020-07-12 09:27:34 -07:00
Eric Vergnaud 2bfce77e91 Fix a NPE 2020-07-12 22:12:02 +08:00
Nathan Burles 1692ed2a17 Add explicit keyword to constructors
To avoid unexpected implicit casts.
2020-07-03 15:10:26 +01:00
Terence Parr 3d9351f61e
Merge pull request #2858 from sha-N/master
fix for issues in #1759
2020-07-01 09:15:29 -07:00
Shan M e744435463
Adds LL1Analyzer to exports list 2020-07-01 12:10:47 +03:00
Shan M 795cd3b682
adds IntervalSet to the export list 2020-07-01 12:01:44 +03:00
Shan M f780421da7
Adds DefaultErrorStrategy to export list 2020-07-01 12:00:41 +03:00
Shan M 5f3654dea7
Sign contributors.txt 2020-07-01 11:59:04 +03:00
Martin van Wingerden a62ca70327
Merge branch 'master' into patch-1 2020-06-30 08:27:28 +02:00
Terence Parr 7a6db6a50a
Merge pull request #2805 from felixn/master
C++ target: escape ? character to prevent accidental trigraphs
2020-06-22 08:29:14 -07:00
Nathan Burles 09eb905332 Remove use of the u8"" string literal prefix
Prior to C++20, the type of a "UTF-8 encoded string literal" is char
const * - i.e. it is exactly the same as a non-prefixed string literal
(they are semantically different, but technically the same).

Since C++20, the type of a UTF-8 encoded string literal is changed to
char8_t const * - which is not convertable to char const *.  Even in
C++20, there is no actual change to how characters are stored, only the
type is changed (they are now semantically different, and supposed to be
technically different - but nothing in the language actually uses the
semantics).

In short, removing the u8"" prefix has no effect prior to C++20, and
simply allows compilation to succeed since c++20.
2020-06-22 10:07:01 +01:00
Felix Nieuwenhuizen c134dac863 escape ? character in c++ codegen to prevent accidental trigraphs
(using an override of shouldUseUnicodeEscapeForCodePointInDoubleQuotedString in CppTarget)
2020-06-21 22:04:51 +02:00
Akos Kiss 835bd709a8 Be more precise in documentation of char set when escaping is needed 2020-06-19 01:05:13 +02:00
parrt ae5efa8a30 tweak contrib 2020-06-16 13:38:04 -07:00
Nathan Burles 254b144bf2 Add AntlrInputStream(std::string_view) constructor
Guarded by the __cplusplus macro so it is only available in C++17 or
newer.
2020-06-15 12:11:44 +01:00
Nathan Burles a1d2d47da8 Avoid defining static const members in headers
Defining a static const member in a header breaks ODR, as the object will be
defined in every translation unit that includes the header.

Instead, the members should either be declared `inline` (which is
implicitly the case for `constexpr` members) or initialized in a cpp.
Alternatively, using an anonymous enum allows the definition to remain
inside the header meaning that the compiler can still choose to inline
values.
2020-06-15 08:40:57 +01:00
Pablo Blanco Celdrán 739cb0b668
Merge branch 'master' into master 2020-06-06 19:59:20 +02:00
Terence Parr 0b35a76e9b
Merge pull request #2833 from d-markey/master
Avoid stepping through ANTLR generated code when debugging (C#)
2020-06-06 09:51:12 -07:00
irabeson 3c0dbd83dd [C++ runtime] Optimizations of Vocabulary::fromTokenNames
This commit doesn't change the behavior, it contains few small improvements:
- prevent useless copy when creating the variable tokenName
- avoid to check if tokenName is empty twice
- use std::string::empty() instead of creating an empty string to compare with
- use std::string::clear() instead of assigning an empty C string to clear a string
2020-06-04 23:25:12 -04:00
Pablo Blanco Celdrán e7a10a070a Fixed deprecation warning for CPP targets > 17 2020-06-04 15:55:39 +02:00
Kilian Kilger 88dffba62e Improve coding style of auto usages 2020-06-03 20:48:19 +02:00
David MARKEY 2191c38619
Prefer "DebuggerNonUserCode" 2020-05-31 23:27:42 +02:00
David MARKEY 4cfbe5bd78
Update CSharp.stg 2020-05-31 19:07:13 +02:00
David MARKEY bcd88c719e
Register as a contribuor 2020-05-31 19:05:01 +02:00
Larry Li 55e55a0d4b Update docs for creating a target 2020-05-31 00:52:57 +10:00
Larry Li 150ecabfff Add docs for Dart target 2020-05-31 00:35:07 +10:00