Mercurial > octave-nkf
comparison scripts/testfun/test.m @ 6024:500d884ae373
[project @ 2006-10-03 14:27:33 by jwe]
author | jwe |
---|---|
date | Tue, 03 Oct 2006 14:27:34 +0000 |
parents | 9c134531c2c4 |
children | 34f96dd5441b |
comparison
equal
deleted
inserted
replaced
6023:75a828280d68 | 6024:500d884ae373 |
---|---|
477 ## find [start,end] of fn in 'function [a,b] = fn' | 477 ## find [start,end] of fn in 'function [a,b] = fn' |
478 function pos = function_name(def) | 478 function pos = function_name(def) |
479 pos = []; | 479 pos = []; |
480 | 480 |
481 ## Find the end of the name | 481 ## Find the end of the name |
482 right = min(find(def=='(')); | 482 right = find(def=='(', 1); |
483 if isempty(right), return; endif | 483 if isempty(right), return; endif |
484 right = max(find(def(1:right-1) != ' ')); | 484 right = find(def(1:right-1) != ' ', 1, "last"); |
485 | 485 |
486 ## Find the beginning of the name | 486 ## Find the beginning of the name |
487 left = max([find(def(1:right)==' '),find(def(1:right)=='=')]); | 487 left = max([find(def(1:right)==' ', 1, "last"),find(def(1:right)=='=', 1, "last")]); |
488 if isempty(left), return; endif | 488 if isempty(left), return; endif |
489 left++; | 489 left++; |
490 | 490 |
491 ## Return the end points of the name | 491 ## Return the end points of the name |
492 pos = [left,right]; | 492 pos = [left,right]; |