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

Added reserved keywords #457

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions examples/cpp/FunctionNameCollision.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <zcm/zcm-cpp.hpp>

#include "types/function_name_collision_t.hpp"

int main(int argc, char *argv[])
{
function_name_collision_t msg;
return 0;
}
4 changes: 4 additions & 0 deletions examples/cpp/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ def build(ctx):
use = 'default zcm',
source = 'BandwidthTest.cpp')

ctx.program(target = 'function-name-collision',
use = 'default zcm examplezcmtypes_cpp',
source = 'FunctionNameCollision.cpp')

ctx.recurse('transport')
8 changes: 8 additions & 0 deletions examples/python/function_name_collision.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/python

blddir= os.path.dirname(os.path.realpath(__file__)) + '/../../build/examples/examples/'
sys.path.insert(0, blddir + "types/")
from function_name_collision_t import function_name_collision_t

# declare a new msg and populate it
msg = function_name_collision_t()
41 changes: 41 additions & 0 deletions examples/types/function_name_collision_t.zcm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
struct function_name_collision_t
{
boolean tmp;

// Cpp
// boolean encode;
// boolean getEncodedSize;
// boolean decode;
// boolean getHash;
// boolean getTypeName;
// boolean _encodeNoHash;
// boolean _getEncodedSizeNoHash;
// boolean _decodeNoHash;
// boolean _computeHash;

// Java
// boolean ZCM_FINGERPRINT;
// boolean ZCM_FINGERPRINT_BASE;
// boolean IS_LITTLE_ENDIAN;
// boolean _hashRecursive;
// boolean encode;
// boolean _encodeRecursive;
// boolean _decodeRecursiveFactory;
// boolean _decodeRecursive;
// boolean copy;

// Node
// boolean IS_LITTLE_ENDIAN;
// boolean __hash;

// Python
// boolean __init__;
// boolean encode;
// boolean _encode_one;
// boolean decode;
// boolean _decode_one;
// boolean _hash;
// boolean _get_hash_recursive;
// boolean _packed_fingerprint;
// boolean _get_packed_fingerprint;
}
6 changes: 5 additions & 1 deletion gen/emit/EmitCpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,5 +942,9 @@ unordered_set<string> getReservedKeywordsCpp()
"switch", "synchronized", "template", "this", "thread_local",
"throw", "true", "try", "typedef", "typeid", "typename", "union",
"unsigned", "using", "virtual", "void", "volatile", "wchar_t",
"while", "xor", "xor_eq" };
"while", "xor", "xor_eq",
/* zcm reserved keywords */
"encode", "getEncodedSize", "decode", "getHash", "getTypeName",
"_encodeNoHash", "_getEncodedSizeNoHash", "_decodeNoHash",
"_computeHash" };
}
6 changes: 5 additions & 1 deletion gen/emit/EmitJava.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,5 +690,9 @@ unordered_set<string> getReservedKeywordsJava()
"interface", "long", "native", "new", "null", "package", "private",
"protected", "public", "return", "short", "static", "strictfp",
"super", "switch", "synchronized", "this", "throw", "throws",
"transient", "true", "try", "void", "volatile", "while" };
"transient", "true", "try", "void", "volatile", "while",
/* Zcm reserved keywords */
"ZCM_FINGERPRINT", "ZCM_FINGERPRINT_BASE", "IS_LITTLE_ENDIAN",
"_hashRecursive", "encode", "_encodeRecursive",
"_decodeRecursiveFactory", "_decodeRecursive", "copy" };
}
4 changes: 3 additions & 1 deletion gen/emit/EmitNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,5 +863,7 @@ unordered_set<string> getReservedKeywordsNode()
"null", "package", "private", "protected", "public", "return",
"short", "static", "super", "switch", "synchronized", "this",
"throw", "throws", "transient", "true", "try", "typeof", "var",
"void", "volatile", "while", "with", "yield" };
"void", "volatile", "while", "with", "yield",
/* Zcm reserved keywords */
"IS_LITTLE_ENDIAN", "__hash" };
}
6 changes: 5 additions & 1 deletion gen/emit/EmitPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,5 +929,9 @@ unordered_set<string> getReservedKeywordsPython()
"for", "lambda", "try", "True", "def", "from", "nonlocal",
"while", "and", "del", "global", "not", "with", "as", "elif",
"if", "or", "yield", "assert", "else", "import", "pass", "break",
"except", "in", "raise" };
"except", "in", "raise",
/* Zcm reserved keywords */
"__init__", "encode", "_encode_one", "decode", "_decode_one",
"_hash", "_get_hash_recursive", "_packed_fingerprint",
"_get_packed_fingerprint" };
}
Loading