parsem

Another input parser, very easy to use.

https://gitlab.com/tommsch/m

이 제출물을 팔로우합니다

Another input parser, very easy to use
Most recent version can probably be found at gitlab: https://gitlab.com/tommsch/m

Features:
- parsing of:
- flags: check which flag of a set of flags is given (see Note (A) )
- name-value pairs: incl. support of alias names, position independent
- key-words: for simple arguments taking only boolean values
- input checks
- set/conditionally-set/read options
- help text generation
- check for unkown options
- passing of unkown options to other parsers
- fully documented
- no splitting of parsing informations between place-of-definition and place-of-parsing

Note:
(A) *** This type of parsing is, to my knowledge, only possible with this parsing function `parsem()` and with `ltfatarghelper()`, the latter part of the LTFAT library, available at github. In particular, Matlabs inputParser also does not support this
(B) Roughly 2x slower than Matlabs inputParser

Example:
varargin = {'abc', 'tommsch',4, 'opt2'};
[ val ] = parsem( 'tommsch', varargin, 2 );
% yields: val=4;

varargin = {'abc', 'tommsch',4, 'opt2'};
[ val ] = parsem( 'tommsch', varargin, 2, 'expect',{0,1,2} );
% yields: val=4;
% and a warning that 'tommsch' only wants values 0, 1 or 2.

varargin = {'abc', 'tommsch',4, 'opt2'};
[val,arg] = parsem( 'Olga', varargin );
% yields: val=false; arg={'abc', 'tommsch',4, 'opt2'},
% Since 'Olga' was not given, val is set to false
% Output argument arg contains all so-far unparsed parts of varargin

varargin = {'abc', 'tommsch',4, 'opt2'};
[val,arg,cc] = parsem( {'opt1','opt2','opt3'}, varargin );
%yields: val=1, cc='opt2', arg={'abc', 'tommsch',4},
% val indicates that one of the options 'op1','opt2','opt3' has been found
% in cc it is stored which option was passed exactly

More options are available.

If you like my parser, please let me know,
Furthermore, please report any bugs you found.

인용 양식

tommsch (2026). parsem (https://kr.mathworks.com/matlabcentral/fileexchange/83293-parsem), MATLAB Central File Exchange. 검색 날짜: .

일반 정보

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux
버전 퍼블리시됨 릴리스 정보 Action
1.0.1

Only changed description

1.0.0