summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Andersson <j.a.e.andersson@gmail.com>2016-07-05 17:38:45 -0500
committerJoel Andersson <j.a.e.andersson@gmail.com>2016-07-05 17:38:45 -0500
commit38af59f3bae7354b4575d7b8985de137a2850e27 (patch)
tree99961b6e78be8e190458b923e53f0ba4e3554306
parente9a5a52f67561c96de2d583dd924411317fe9be9 (diff)
downloadswig-38af59f3bae7354b4575d7b8985de137a2850e27.tar.gz
Issue #67 Added list of MATLAB keywords
-rw-r--r--Lib/matlab/matlab.swg2
-rw-r--r--Lib/matlab/matlabkw.swg48
2 files changed, 49 insertions, 1 deletions
diff --git a/Lib/matlab/matlab.swg b/Lib/matlab/matlab.swg
index bb64f9b8a..ef7842ad1 100644
--- a/Lib/matlab/matlab.swg
+++ b/Lib/matlab/matlab.swg
@@ -4,8 +4,8 @@
%include <matlabuserdir.swg>
%include <matlabtypemaps.swg>
%include <matlabopers.swg>
+%include <matlabkw.swg>
%define %docstring %feature("docstring") %enddef
%define %matlabsetup %insert("matlabsetup") %enddef
-
diff --git a/Lib/matlab/matlabkw.swg b/Lib/matlab/matlabkw.swg
new file mode 100644
index 000000000..8110bdb69
--- /dev/null
+++ b/Lib/matlab/matlabkw.swg
@@ -0,0 +1,48 @@
+/*
+ Warnings for MATLAB keywords, built-in names and bad names.
+*/
+
+#define MATLABKW(x) %keywordwarn("'" `x` "' is a MATLAB keyword, renaming to '" `x` "1'", rename="%s1") `x`
+#define MATLABBN(x) %builtinwarn("'" `x` "' conflicts with a built-in name in MATLAB") `x`
+
+
+/*
+ MATLAB keywords
+*/
+
+MATLABKW(break);
+MATLABKW(case);
+MATLABKW(catch);
+MATLABKW(classdef);
+MATLABKW(continue);
+MATLABKW(else);
+MATLABKW(elseif);
+MATLABKW(end);
+MATLABKW(for);
+MATLABKW(function);
+MATLABKW(global);
+MATLABKW(if);
+MATLABKW(otherwise);
+MATLABKW(parfor);
+MATLABKW(persistent);
+MATLABKW(return);
+MATLABKW(spmd);
+MATLABKW(switch);
+MATLABKW(try);
+MATLABKW(while);
+
+
+/*
+ built-in names
+*/
+MATLABBN(true);
+MATLABBN(false);
+
+
+/*
+ 'self' is also a bad Name
+*/
+MATLABKW(self);
+
+#undef MATLABBN
+#undef MATLABKW