Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

NORMAL : syntax extended, negate, minusminus, global.

  • Loading branch information...
commit 486e02d69188efe218b0ce656ee412d485c59920 1 parent bb8505d
@VincentToups authored
Showing with 32 additions and 1 deletion.
  1. +4 −0 funcall.m
  2. +7 −0 minusminus.m
  3. +2 −0  negate.m
  4. +19 −1 parenlab.el
View
4 funcall.m
@@ -9,7 +9,11 @@
names = [names name ','];
end
names(end) = ']';
+ %try
eval(sprintf('%s = f(varargin{:});', names));
+ %catch
+ % keyboard
+ %end
varargout = {};
for i=1:nargout
varargout{i} = eval(sprintf('n%d;',i));
View
7 minusminus.m
@@ -0,0 +1,7 @@
+function r=minusminus(v,varargin)
+r = v;
+for vi=1:length(varargin)
+ item=varargin{vi};
+ r = r - item;
+end
+
View
2  negate.m
@@ -0,0 +1,2 @@
+function r = negate(v)
+r = -v;
View
20 parenlab.el
@@ -1,6 +1,7 @@
(require 'shadchen)
-(setq max-lisp-eval-depth 1000)
+(setq max-lisp-eval-depth 10000)
+(setq max-specpdl-size 2000)
(defvar pl:transplant-scripts-and-functions t)
@@ -77,6 +78,9 @@
"Return is transcoded as return."
(pl:insertf "return"))
+(defun-match- pl:transcode ((or : (list :)))
+ "Insert a naked :"
+ (pl:insertf ":"))
(defun-match pl:transcode ((p #'pl:symbol-with-indexing-syntax s))
"Symbols are mangled and inserted as variables."
@@ -129,6 +133,11 @@
"Strings are transcoded to matlab strings, escaping single quotes."
(pl:insertf "'%s'" (pl:escape-single-quotes s)))
+(defun-match pl:transcode ((list 'global (p #'symbolp name)))
+ "Transcodes a global definition."
+ (pl:insertf "global ")
+ (pl:transcode name))
+
(defun-match pl:transcode ((list 'quote form))
"Quotations are evaluated to strings whose value under eval is
the value of the forms."
@@ -263,6 +272,15 @@ regular, non-functional if statement."
(pl:transcode nil)
(pl:insertf ")"))
+(defun-match pl:transcode ((list 'try (list-rest code) (list-rest catch-clause)))
+ "Transcode a try/catch block."
+ (let ((start (point)))
+ (pl:insertf "try\n")
+ (pl:transcode-sequence code)
+ (pl:insertf "catch\n")
+ (pl:transcode-sequence catch-clause)
+ (pl:insertf "end")))
+
(defun-match pl:transcode ((list-rest 'or clauses))
(let ((n (length clauses)))
(pl:insertf "orFunction(")
Please sign in to comment.
Something went wrong with that request. Please try again.