diff options
| author | Joel Martin <github@martintribe.org> | 2015-02-09 00:23:10 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-02-09 00:23:10 -0600 |
| commit | 7f567f36457b937c36345becdb7c1101566dcdf3 (patch) | |
| tree | 6481177a8a297475b3b361503e66315e5698b11d /matlab/reader.m | |
| parent | b550d8b72a16aa83de1de9e76ac66ab000a0ef2f (diff) | |
| download | mal-7f567f36457b937c36345becdb7c1101566dcdf3.tar.gz mal-7f567f36457b937c36345becdb7c1101566dcdf3.zip | |
matlab: stepA, perf test, comments.
Diffstat (limited to 'matlab/reader.m')
| -rw-r--r-- | matlab/reader.m | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/matlab/reader.m b/matlab/reader.m index 968e5a1..0a985e8 100644 --- a/matlab/reader.m +++ b/matlab/reader.m @@ -2,9 +2,11 @@ classdef reader methods (Static = true) function tokens = tokenize(str) - re = '[\s,]*(~@|[\[\]{}()''`~^@]|"(?:\\.|[^\\"])*"|;.*|[^\s\[\]{}(''"`,;)]*)'; + re = '[\s,]*(~@|[\[\]{}()''`~^@]|"(?:\\.|[^\\"])*"|;[^\n]*|[^\s\[\]{}(''"`,;)]*)'; % extract the capture group (to ignore spaces and commas) tokens = cellfun(@(x) x(1), regexp(str, re, 'tokens')); + comments = cellfun(@(x) length(x) > 0 && x(1) == ';', tokens); + tokens = tokens(~comments); end function atm = read_atom(rdr) |
