File Exchange

image thumbnail

fparser: a pedestrian m-file parser and tokenizer

version 1.0.0.0 (14.5 KB) by us
lists ML-tokens and constructs (function, var, struct assignment) in a m-file or from a command line

3 Downloads

Updated 12 Dec 2005

View License

FPARSER parses a M-file or command line
and list tokens and constructs:
- functions/keywords
- variables/constants
- struct field assignments

see the accompanying published m-file for an example

Cite As

us (2021). fparser: a pedestrian m-file parser and tokenizer (https://www.mathworks.com/matlabcentral/fileexchange/3915-fparser-a-pedestrian-m-file-parser-and-tokenizer), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

Ronan

Very useful function. thanks.

Found 1 bug. Comment on lines after a function "end" seem to cause an error.

R

Charles Tatum

Excellent work! Here's a fresh bug report:

Code 'idx>0' gets tagged as a field rather than an expression.

Andrej Mosat

The file is well commented, some lines are cryptic, but thats good for learning new programming styles :-) Excellent tool for compiling a documentation of your project.
Some remarks:
variable i: (output of the fparser):
i > 11 built-in (C:\install\Matlab\toolbox\matlab\elmat\i)
That is true, but in my context I use it exclusively as a counter (for i=1:N)
And one question: what exactly represents:
.nstok nr of STRUCT.FIELD assignments ?
Thank you.

Fu-Sung Wang

The concept of parsing a MATLAB file is new to me. I guess that can help programmers to analyze the cost of the script, in a manner of minimum number of variables, functions, etc...Anyway, I have to parsing this great work first.

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

html/