2014-12-23 05:51:24 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
wakatime.languages.dotnet
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Parse dependencies from .NET code.
|
|
|
|
|
2014-12-23 07:24:48 +00:00
|
|
|
:copyright: (c) 2014 Alan Hamlett.
|
2014-12-23 05:51:24 +00:00
|
|
|
:license: BSD, see LICENSE for more details.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from . import TokenParser
|
|
|
|
|
|
|
|
|
|
|
|
class CSharpParser(TokenParser):
|
|
|
|
|
2015-09-26 20:04:35 +00:00
|
|
|
def parse(self):
|
2014-12-23 05:51:24 +00:00
|
|
|
for index, token, content in self.tokens:
|
|
|
|
self._process_token(token, content)
|
|
|
|
return self.dependencies
|
|
|
|
|
|
|
|
def _process_token(self, token, content):
|
2015-09-16 21:59:30 +00:00
|
|
|
if self.partial(token) == 'Namespace':
|
2014-12-23 05:51:24 +00:00
|
|
|
self._process_namespace(token, content)
|
|
|
|
else:
|
|
|
|
self._process_other(token, content)
|
|
|
|
|
|
|
|
def _process_namespace(self, token, content):
|
2014-12-23 06:33:49 +00:00
|
|
|
if content != 'import' and content != 'package' and content != 'namespace':
|
2014-12-25 05:09:15 +00:00
|
|
|
self.append(content, truncate=True)
|
2014-12-23 05:51:24 +00:00
|
|
|
|
|
|
|
def _process_other(self, token, content):
|
|
|
|
pass
|