Skip to content

Commit

Permalink
Add parse extends and implements
Browse files Browse the repository at this point in the history
  • Loading branch information
silverreve23 committed Feb 28, 2018
1 parent 2f822a3 commit 1db9191
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
4 changes: 2 additions & 2 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"in" : "pphpapp/app",
"out" : "pphpapp/out"
"in" : "resources/assets/php",
"out" : "."
}
41 changes: 36 additions & 5 deletions system/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,41 @@ function parseFile($filePath){

lineReader.on('line', function(line){

// Pares [class] word
line = line.replace(/@class\s.(\w+)/, function(findedStr){
// Pares [class] word
line = line.replace(/@class\s.\w+(\s?@extends\s.\w+){0,}(\s?@implements\s.\w+){0,}/, function(findedStr){

return findedStr.replace(/\@/g, '') + "{";


});

// Pares [extends] word
line = line.replace(/@extends\s.\w+(\s?@implements\s.\w+){0,}/, function(findedStr){

newFileData = newFileData.replace(/class[\s|\w]{0,}\{/, function(findedSubStr){

return findedSubStr.replace(/\{/, '');


})

return findedStr.replace(/\@/g, '') + "{";


});

// Pares [implements] word
line = line.replace(/@implements\s.\w+/, function(findedStr){

newFileData = newFileData.replace(/class[\s|\w|\n]{0,}extends[\s|\w]{0,}\{/, function(findedSubStr){

return findedSubStr.replace(/\{/, '');


})

return findedStr.replace(/[\@|\{]/g, '') + "{";

return findedStr.substr(1) + "{";

});

Expand All @@ -160,10 +191,10 @@ function parseFile($filePath){
});

// Pares [function] word
line = line.replace(/\@def(\(static\))?\s*([\+|\-|\.])\s*(\w+)\s*\([$|\w|\s|,]*\)/, function(findedStr, static, access){
line = line.replace(/\@def(s)?\s*([\+|\-|\.])\s*(\w+)\s*\([$|\w|\s|,]*\)/, function(findedStr, static, access){

if(static)
return accesseVals[access] + ' static function' + findedStr.substr(13) + "{";
return accesseVals[access] + ' static function' + findedStr.substr(6) + "{";

return accesseVals[access] + ' function' + findedStr.substr(5) + "{";

Expand Down

0 comments on commit 1db9191

Please sign in to comment.