A grep-like command which uses a meta model for each line to parse it...
Special functions:
filename(model)
: filename of processed lineline(model)
: line number of processed line
You can provide a transform function:
./build/mgrep --transform "{% filename(model) %}:{% line(model) %} imports {% model.file %}" "Model: '#include' /[\"<]/ file=/[^\">]*/ /[\">]/;" src/textx/*.h
Without transform option you get the full model object:
./build/mgrep "Model: 'cpu' 'MHz' /[^\d]+/ mhz=NUMBER;" /proc/cpuinfo
Model{mhz=900.001}
Model{mhz=1600.64}
Model{mhz=2700}
Model{mhz=2700}