diff --git a/.gitignore b/.gitignore index 22c5a97d..27d956ae 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ /triage/BasicTypeSize.md /triage/Roadmap.md triage/system/* +tags diff --git a/makefile b/makefile index 5c0ee241..7bc29843 100644 --- a/makefile +++ b/makefile @@ -91,8 +91,10 @@ usage: @echo " make bootstrap - Update bootstrap C source directories." @echo " make revertbootstrap - Use git checkout to restore bootstrap C source directories" - - +# Code navigation helper +.PHONY: tags +tags: + ctags -R --options=oberon.ctags --extras=+q # Generate config files Configuration.Make and Configuration.Mod FORCE: diff --git a/oberon.ctags b/oberon.ctags new file mode 100644 index 00000000..de5a1cf8 --- /dev/null +++ b/oberon.ctags @@ -0,0 +1,32 @@ +# ctags -R --options=oberon.ctags --extras=+q + +--langdef=Oberon{_autoFQTag} + +--map-Oberon=+.mod +--map-Oberon=+.Mod + +--kinddef-Oberon=m,module,modules +--kinddef-Oberon=p,procedure,procedures + +--regex-Oberon=/^\s*MODULE\s+([a-zA-Z][a-zA-Z0-9]*)\s*;/\1/m/{scope=push} +--regex-Oberon=/^\s*END\s+([a-zA-Z][a-zA-Z0-9]*)\s*\./\1/m/{scope=pop} +--regex-Oberon=/^\s*PROCEDURE(\s*\^|-)?\s*([a-zA-Z][a-zA-Z0-9]*)/\2/p/{scope=ref} +# NOTE Oberon-2 receiver procedures not supported + +### using ctags with vim +# examples: +# vim -t "Compiler" +# vim -t "OPS.Get" +# vim -c ":ts Platform.Read" +# +# when inside the editor you need to jump to the fully qualified tag, +# not just procedure name e.g. when you have Platform.Write, you +# can't just place cursor on W then and expect it to resolve +# correctly all the time. +# your better options are +# autocmd FileType oberon setlocal iskeyword+=. +# autocmd FileType modula2 setlocal iskeyword+=. +# :ta Platform.Write +# v 3e +# :ts Platform.Write +# g