Skip to content

Commit

Permalink
Primitive ctags annotations
Browse files Browse the repository at this point in the history
Part of #10
  • Loading branch information
eapache committed Apr 7, 2014
1 parent 64c47a3 commit aba185b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion lib/starscope/datum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,19 @@ def self.to_s(dat)
end

def self.ctag_line(dat)
"#{dat[:name][-1]}\t#{dat[:file]}\t/^#{dat[:line]}$/;"
"#{dat[:name][-1]}\t#{dat[:file]}\t/^#{dat[:line]}$/" + self.ctag_ext(dat)
end

def self.ctag_ext(dat)
s = ";\"\t"
case dat[:type]
when :func
s << "kind:f"
when :class
s << "kind:c"
else
""
end
end

def self.cscope_mark(tbl, dat)
Expand Down
4 changes: 2 additions & 2 deletions lib/starscope/db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ def export_ctags(filename)
!_TAG_PROGRAM_URL https://github.com/eapache/starscope //
!_TAG_PROGRAM_VERSION #{StarScope::VERSION} //
END
defs = (@tables[:defs] || {}).sort
defs = (@tables[:defs] || {}).sort_by {|x| x[:name][-1]}
defs.each do |val|
file.puts StarScope::Datum.ctag_line(entry)
file.puts StarScope::Datum.ctag_line(val)
end
end
end
Expand Down

0 comments on commit aba185b

Please sign in to comment.