Page 1 of 1

Cobra defs script

PostPosted: Mon Sep 05, 2011 6:35 pm
by Charles
Here is a little bash script to show all the class, method, etc. definitions in a directory containing Cobra code:
Code: Select all
grep -rnH --color \
   --include='*.cobra' \
   -P '^[ \t]*(namespace|class|interface|struct|mixin|enum|const|var|cue|def|get|set|pro)[ \t]+[A-Za-z0-9_\.]+\b' \
   .

Well actually that should work with any shell as long as you have "grep".

It scans all subdirs as well through the -r option.

This was fairly easy because Cobra declarations always start with "<keyword> <identifier>" such as "class Customer" and "def clear".