From f008b9d1a5b4e418f205f59eb20039d8cce64f72 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sabadosh Date: Wed, 28 Feb 2018 14:32:34 +0200 Subject: [PATCH] Change README.md --- README.md | 90 +++++++++++++++++++++++++++------------------ system/processor.js | 4 +- 2 files changed, 56 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 194228b..23f0c70 100644 --- a/README.md +++ b/README.md @@ -8,80 +8,98 @@ This package is for those who like beautiful, orderly and easily program code!

+### API + +Class patterns: + +* @php => class +* @extends => extends +* @implements => implements +* @var[+/-/.] => [public/private/protected] variable +* @vars[+/-/.] => [public/private/protected] static variable +* @def[+/-/.] => [public/private/protected] function +* @defs[+/-/.] => [public/private/protected] static function + +Construction patterns: + +* @foreach => foreach +* @if => if +* @end => close construction + ### Example: -#### Source In -##### This package in developer mode!! +Source in: -``` +```php @php -@class Test +namespace App\Http\Controllers; - @var+ $testPublic = array(); - @var- $testPrivate = 20; - @var. $testProtected = 'test'; +use Illuminate\Http\Request; +use App\Http\Controllers\Controller; +use Illuminate\Support\Facades\DB; +use App\Classes\Contracts\ReplacerInterface; - @var(static). $testStatic = 'static'; +@class TestController - @def+ test() + @extends MainController + @implements ReplacerInterface - @foreach(@this.test as $key => $val) + use Request; - echo $key.$val; + @vars. $staticVar = 'TEST'; - @end + @def+ __construct() - @end + parent::__construct(); - @def(static)- staticTest($test) + @end - @if($test) + @defs+ testFunction($params) - return true; + return true; - @end - - @end + @end @end ``` -#### Source Out +Source out: ```php test as $key => $val){ + extends MainController + implements ReplacerInterface{ - echo $key.$val; + use Request; - } + protected static $staticVar = 'TEST'; - } + public function __construct(){ - private static function staticTest($test){ + parent::__construct(); - if($test){ + } - return true; + public static function testFunction($params){ - } + return true; - } + } } diff --git a/system/processor.js b/system/processor.js index 811004b..9e0a663 100644 --- a/system/processor.js +++ b/system/processor.js @@ -181,10 +181,10 @@ function parseFile($filePath){ }); // Pares [variable] word - line = line.replace(/\@var(\(static\))?\s{0,}([\+|\-|\.]){0,}[$|\w|\s|,|=]{1,}/, function(findedStr, static, access){ + line = line.replace(/\@var(s)?\s{0,}([\+|\-|\.]){0,}[$|\w|\s|,|=]{1,}/, function(findedStr, static, access){ if(static) - return accesseVals[access] + ' static ' + findedStr.substr(14); + return accesseVals[access] + ' static ' + findedStr.substr(7); return accesseVals[access] + findedStr.substr(5);