Skip to content

Commit

Permalink
Interface processing added.
Browse files Browse the repository at this point in the history
  • Loading branch information
oct8cat committed Aug 20, 2012
1 parent dce862e commit 67a8992
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Base File.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"phpdox": {
"patterns": {
"class" : "^\\s*(?P<abstract>abstract|)\\s*class\\s+(?P<name_class>\\w+)\\s*(extends|)\\s*(?P<name_parent>\\w+|\\s*).*",
"function": "^\\s*(?P<access>public|protected|private|)\\s*(?P<static>static|)\\s*function\\s+(?P<name>\\w+)\\s*\\((?P<params>.*)\\).*",
"variable": "^\\s*(?P<access>public|protected|private|var)\\s*(?P<static>static|)\\s*(?P<name>\\$\\w+)\\s*(\\s*=\\s*|)(?P<value>.*|);.*"
"class" : "^\\s*(?P<abstract>abstract|)\\s*class\\s+(?P<name_class>\\w+)\\s*(extends|)\\s*(?P<name_parent>\\w+|\\s*).*",
"interface": "^\\s*interface\\s+(?P<name_interface>\\w+)\\s*(extends|)\\s*(?P<name_parent>\\w+|\\s*).*",
"function" : "^\\s*(?P<access>public|protected|private|)\\s*(?P<static>static|)\\s*function\\s+(?P<name>\\w+)\\s*\\((?P<params>.*)\\).*",
"variable" : "^\\s*(?P<access>public|protected|private|var)\\s*(?P<static>static|)\\s*(?P<name>\\$\\w+)\\s*(\\s*=\\s*|)(?P<value>.*|);.*"
}
}
}
18 changes: 18 additions & 0 deletions PhpDox.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ class PhpdoxCommand(sublime_plugin.TextCommand):
* @link ${{4:http://www.example.com}}
**/""",

# Interface template
'interface':"""
/**
* ${{1:{0}}}
*
* @uses {1}
*
* @category ${{2:Category}}
* @package ${{3:Package}}
* @author ${{TM_FULLNAME}} <${{TM_EMAIL}}>
* @license GNU GPL v3.0 {{@link http://www.gnu.org/copyleft/gpl.html}}
* @link ${{4:http://www.example.com}}
**/""",

# Function template
'function':"""
/**
Expand Down Expand Up @@ -75,6 +89,10 @@ def dox_class(self, match):
"""Resolves class's PHPDoc by given match"""
return self.templates['class'].format(*match.group('name_class', 'name_parent'))

def dox_interface(self, match):
"""Resolves interface's PHPDoc by given match"""
return self.templates['interface'].format(*match.group('name_interface', 'name_parent'))

def dox_function(self, match):
"""Resolves function's PHPDoc by given match"""
tokens = {
Expand Down

0 comments on commit 67a8992

Please sign in to comment.