runmat-parser 0.4.1

Parser for RunMat (MATLAB/Octave) producing HIR from token streams
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mod parse;
use parse::parse;

#[test]
fn parse_various_valid_seeds() {
    let seeds = [
		"A=[1 2;3 4]; B=A(:,2);",
		"try; error('RunMat:foo','msg'); catch e; id=getfield(e,'identifier'); end",
		"function y = f(x); y = x + 1; end; a = f(2);",
		"classdef C\n  properties\n    a\n  end\n  methods\n    function obj = setA(obj, v)\n      obj.a = v;\n    end\n  end\nend",
		"import pkg.*; x=1;",
	];
    for (i, src) in seeds.iter().enumerate() {
        let res = parse(src);
        assert!(res.is_ok(), "seed {} failed to parse: {:?}", i, res.err());
    }
}