Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing reserve word NULL for cpp targets #3889

Merged
merged 21 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8b7984c
Fixing minimum CXX standard required
1sand0s Sep 14, 2022
531654e
fix: Restore missing changes to v4 of go runtime
Sep 7, 2022
9e96de8
tweak spelling errors in Interpreter
parrt Sep 11, 2022
3dacdff
Describe using antlr4-tools in getting started documentation
parrt Sep 11, 2022
7a06e1f
Tweak doc
parrt Sep 11, 2022
253ef6b
Update C# release instructions
ericvergnaud Sep 4, 2022
871cf52
Add Windows doc for antlr4-tool usage
parrt Sep 11, 2022
e20088f
Fixing minimum CXX standard required
1sand0s Sep 14, 2022
6ed94f8
Fixing Reserve word NULL handling for Cpp targets
1sand0s Sep 15, 2022
82beced
Adding testcase for reserve word NULL for Cpp targets
1sand0s Sep 23, 2022
e347ffe
Update ReservedWordsEscaping_NULL.txt
1sand0s Sep 23, 2022
57cb224
Fixing Reserve word NULL handling for Cpp targets
1sand0s Sep 15, 2022
61f6aea
Adding testcase for reserve word NULL for Cpp targets
1sand0s Sep 23, 2022
d26c064
Removing unecessary escape
1sand0s Sep 23, 2022
62b1967
Fixing Reserve word NULL handling for Cpp targets
1sand0s Sep 15, 2022
f3e3d8a
Adding testcase for reserve word NULL for Cpp targets
1sand0s Sep 23, 2022
1eb5603
Update ReservedWordsEscaping_NULL.txt
1sand0s Sep 23, 2022
d08446e
Fixing Reserve word NULL handling for Cpp targets
1sand0s Sep 15, 2022
8b60b07
Adding testcase for reserve word NULL for Cpp targets
1sand0s Sep 23, 2022
bdb9d46
Removing unecessary escape
1sand0s Sep 23, 2022
8951b56
Merge branch 'Fixing_Reserve_Word_NULL_for_Cpp_Targets' of https://gi…
1sand0s Sep 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[notes]
https://github.com/antlr/antlr4/pull/3889

[type]
Lexer

[grammar]
lexer grammar L;

NULL : ('N' | 'n')('U' | 'u')('L' | 'l')('L' | 'l') ;

[input]
NULL

[output]
[@0,0:3='NULL',<1>,1:0]
[@1,4:3='<EOF>',<-1>,1:4]
4 changes: 2 additions & 2 deletions runtime/Cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ The C++ target has been the work of the following people:

### Build + Usage Notes

The minimum C++ version to compile the ANTLR C++ runtime with is C++11. The supplied projects can built the runtime either as static or dynamic library, as both 32bit and 64bit arch. The macOS project contains a target for iOS and can also be built using cmake (instead of XCode).
The minimum C++ version to compile the ANTLR C++ runtime with is C++17. The supplied projects can built the runtime either as static or dynamic library, as both 32bit and 64bit arch. The macOS project contains a target for iOS and can also be built using cmake (instead of XCode).
parrt marked this conversation as resolved.
Show resolved Hide resolved

Include the antlr4-runtime.h umbrella header in your target application to get everything needed to use the library.

If you are compiling with cmake, the minimum version required is cmake 2.8.
By default, the libraries produced by the CMake build target C++11. If you want to target a different C++ standard, you can explicitly pass the standard - e.g. `-DCMAKE_CXX_STANDARD=17`.
By default, the libraries produced by the CMake build target C++17. If you want to target a different C++ standard, you can explicitly pass the standard - e.g. `-DCMAKE_CXX_STANDARD=17`.

#### Compiling on Windows with Visual Studio using he Visual Studio projects
Simply open the VS project from the runtime folder (VS 2019+) and build it.
Expand Down
2 changes: 1 addition & 1 deletion tool/src/org/antlr/v4/codegen/Target.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected void genFile(Grammar g, ST outputFileST, String fileName)
* to a token type in the generated code.
*/
public String getTokenTypeAsTargetLabel(Grammar g, int ttype) {
String name = g.getTokenName(ttype);
String name = this.escapeIfNeeded(g.getTokenName(ttype));
parrt marked this conversation as resolved.
Show resolved Hide resolved
// If name is not valid, return the token type instead
if ( Grammar.INVALID_TOKEN_NAME.equals(name) ) {
return String.valueOf(ttype);
Expand Down
2 changes: 1 addition & 1 deletion tool/src/org/antlr/v4/codegen/model/Recognizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Recognizer(OutputModelFactory factory) {
for (Map.Entry<String, Integer> entry : g.tokenNameToTypeMap.entrySet()) {
Integer ttype = entry.getValue();
if ( ttype>0 ) {
tokens.put(entry.getKey(), ttype);
tokens.put(gen.getTarget().escapeIfNeeded(entry.getKey()), ttype);
}
}

Expand Down
4 changes: 2 additions & 2 deletions tool/src/org/antlr/v4/codegen/target/CppTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public class CppTarget extends Target {
"double", "dynamic_cast", "else", "enum", "explicit", "export",
"extern", "false", "float", "for", "friend", "goto", "if",
"inline", "int", "long", "mutable", "namespace", "new",
"noexcept", "not", "not_eq", "nullptr", "operator", "or",
"noexcept", "not", "not_eq", "nullptr", "NULL", "operator", "or",
"or_eq", "private", "protected", "public", "register",
"reinterpret_cast", "requires", "return", "short", "signed",
"sizeof", "static", "static_assert", "static_cast", "struct",
"switch", "template", "this", "thread_local", "throw", "true",
"try", "typedef", "typeid", "typename", "union", "unsigned",
"using", "virtual", "void", "volatile", "wchar_t", "while",
"xor", "xor_eq",
"xor", "xor_eq",

"rule", "parserRule"
));
Expand Down