@@ -5,5 +5,5 @@ |
||
5 | 5 | class RadioButton extends Control |
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.RadioButton'; |
8 | - protected ?string $assembly = 'System.Windows.Forms'; |
|
8 | + protected ?string $assembly = 'System.Windows.Forms'; |
|
9 | 9 | } |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class RadioButton extends Control |
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.RadioButton'; |
8 | - protected ?string $assembly = 'System.Windows.Forms'; |
|
8 | + protected ?string $assembly = 'System.Windows.Forms'; |
|
9 | 9 | } |
@@ -11,22 +11,22 @@ |
||
11 | 11 | protected ?string $classname; |
12 | 12 | protected ?string $assembly; |
13 | 13 | |
14 | - public function __construct (...$args) |
|
14 | + public function __construct(...$args) |
|
15 | 15 | { |
16 | - parent::__construct ($this->classname, $this->assembly, ...$args); |
|
16 | + parent::__construct($this->classname, $this->assembly, ...$args); |
|
17 | 17 | |
18 | - Components::add ($this); |
|
18 | + Components::add($this); |
|
19 | 19 | } |
20 | 20 | |
21 | - public function dispose (): void |
|
21 | + public function dispose(): void |
|
22 | 22 | { |
23 | - VoidCore::removeObjects ($this->selector); |
|
24 | - Components::remove ($this->selector); |
|
23 | + VoidCore::removeObjects($this->selector); |
|
24 | + Components::remove($this->selector); |
|
25 | 25 | } |
26 | 26 | |
27 | - public function __destruct () |
|
27 | + public function __destruct() |
|
28 | 28 | { |
29 | - if (VoidCore::destructObject ($this->selector)) |
|
30 | - $this->dispose (); |
|
29 | + if (VoidCore::destructObject($this->selector)) |
|
30 | + $this->dispose(); |
|
31 | 31 | } |
32 | 32 | } |
@@ -26,7 +26,8 @@ |
||
26 | 26 | |
27 | 27 | public function __destruct () |
28 | 28 | { |
29 | - if (VoidCore::destructObject ($this->selector)) |
|
30 | - $this->dispose (); |
|
29 | + if (VoidCore::destructObject ($this->selector)) { |
|
30 | + $this->dispose (); |
|
31 | + } |
|
31 | 32 | } |
32 | 33 | } |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class ImageList extends Control |
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.ImageList'; |
8 | - protected ?string $assembly = 'System.Windows.Forms'; |
|
8 | + protected ?string $assembly = 'System.Windows.Forms'; |
|
9 | 9 | } |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class ImageList extends Control |
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.ImageList'; |
8 | - protected ?string $assembly = 'System.Windows.Forms'; |
|
8 | + protected ?string $assembly = 'System.Windows.Forms'; |
|
9 | 9 | } |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class Timer extends Control |
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.Timer'; |
8 | - protected ?string $assembly = 'System.Windows.Forms'; |
|
8 | + protected ?string $assembly = 'System.Windows.Forms'; |
|
9 | 9 | } |
@@ -5,5 +5,5 @@ |
||
5 | 5 | class Timer extends Control |
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.Timer'; |
8 | - protected ?string $assembly = 'System.Windows.Forms'; |
|
8 | + protected ?string $assembly = 'System.Windows.Forms'; |
|
9 | 9 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | abstract class CommonDialog extends Component |
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.CommonDialog'; |
8 | - protected ?string $assembly = 'System.Windows.Forms'; |
|
8 | + protected ?string $assembly = 'System.Windows.Forms'; |
|
9 | 9 | |
10 | 10 | public function execute (): int |
11 | 11 | { |
@@ -5,10 +5,10 @@ |
||
5 | 5 | abstract class CommonDialog extends Component |
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.CommonDialog'; |
8 | - protected ?string $assembly = 'System.Windows.Forms'; |
|
8 | + protected ?string $assembly = 'System.Windows.Forms'; |
|
9 | 9 | |
10 | - public function execute (): int |
|
10 | + public function execute(): int |
|
11 | 11 | { |
12 | - return $this->callMethod ('ShowDialog'); |
|
12 | + return $this->callMethod('ShowDialog'); |
|
13 | 13 | } |
14 | 14 | } |
@@ -6,8 +6,8 @@ |
||
6 | 6 | { |
7 | 7 | protected ?string $classname = 'System.Windows.Forms.FolderBrowserDialog'; |
8 | 8 | |
9 | - public function get_path () |
|
9 | + public function get_path() |
|
10 | 10 | { |
11 | - return $this->getProperty ('SelectedPath'); |
|
11 | + return $this->getProperty('SelectedPath'); |
|
12 | 12 | } |
13 | 13 | } |
@@ -7,8 +7,8 @@ |
||
7 | 7 | protected ?string $classname = 'System.Windows.Forms.MessageBox'; |
8 | 8 | protected ?string $assembly = 'System.Windows.Forms'; |
9 | 9 | |
10 | - public function __construct () |
|
10 | + public function __construct() |
|
11 | 11 | { |
12 | - parent::__construct ($this->classname, $this->assembly); |
|
12 | + parent::__construct($this->classname, $this->assembly); |
|
13 | 13 | } |
14 | 14 | } |
@@ -6,28 +6,28 @@ |
||
6 | 6 | |
7 | 7 | class Process extends Component |
8 | 8 | { |
9 | - protected ?string $classname = 'System.Diagnostics.Process'; |
|
10 | - protected ?string $assembly = 'System'; |
|
9 | + protected ?string $classname = 'System.Diagnostics.Process'; |
|
10 | + protected ?string $assembly = 'System'; |
|
11 | 11 | |
12 | - public function __construct (int $pid = null) |
|
13 | - { |
|
12 | + public function __construct (int $pid = null) |
|
13 | + { |
|
14 | 14 | $this->selector = VoidCore::getClass ($this->classname, $this->assembly); |
15 | 15 | |
16 | - if ($pid !== null) |
|
16 | + if ($pid !== null) |
|
17 | 17 | $this->selector = $pid == getmypid () ? |
18 | 18 | VoidCore::callMethod ($this->selector, 'GetCurrentProcess') : |
19 | 19 | VoidCore::callMethod ($this->selector, 'GetProcessById', $pid); |
20 | 20 | |
21 | - Components::add ($this); |
|
22 | - } |
|
21 | + Components::add ($this); |
|
22 | + } |
|
23 | 23 | |
24 | - public static function getProcessById (int $pid) |
|
25 | - { |
|
26 | - return new self ($pid); |
|
27 | - } |
|
24 | + public static function getProcessById (int $pid) |
|
25 | + { |
|
26 | + return new self ($pid); |
|
27 | + } |
|
28 | 28 | |
29 | - public static function getCurrentProcess () |
|
30 | - { |
|
31 | - return new self (getmypid ()); |
|
32 | - } |
|
29 | + public static function getCurrentProcess () |
|
30 | + { |
|
31 | + return new self (getmypid ()); |
|
32 | + } |
|
33 | 33 | } |
@@ -9,25 +9,24 @@ |
||
9 | 9 | protected ?string $classname = 'System.Diagnostics.Process'; |
10 | 10 | protected ?string $assembly = 'System'; |
11 | 11 | |
12 | - public function __construct (int $pid = null) |
|
12 | + public function __construct(int $pid = null) |
|
13 | 13 | { |
14 | - $this->selector = VoidCore::getClass ($this->classname, $this->assembly); |
|
14 | + $this->selector = VoidCore::getClass($this->classname, $this->assembly); |
|
15 | 15 | |
16 | 16 | if ($pid !== null) |
17 | - $this->selector = $pid == getmypid () ? |
|
18 | - VoidCore::callMethod ($this->selector, 'GetCurrentProcess') : |
|
19 | - VoidCore::callMethod ($this->selector, 'GetProcessById', $pid); |
|
17 | + $this->selector = $pid == getmypid() ? |
|
18 | + VoidCore::callMethod($this->selector, 'GetCurrentProcess') : VoidCore::callMethod($this->selector, 'GetProcessById', $pid); |
|
20 | 19 | |
21 | - Components::add ($this); |
|
20 | + Components::add($this); |
|
22 | 21 | } |
23 | 22 | |
24 | - public static function getProcessById (int $pid) |
|
23 | + public static function getProcessById(int $pid) |
|
25 | 24 | { |
26 | - return new self ($pid); |
|
25 | + return new self($pid); |
|
27 | 26 | } |
28 | 27 | |
29 | - public static function getCurrentProcess () |
|
28 | + public static function getCurrentProcess() |
|
30 | 29 | { |
31 | - return new self (getmypid ()); |
|
30 | + return new self(getmypid()); |
|
32 | 31 | } |
33 | 32 | } |
@@ -13,10 +13,11 @@ |
||
13 | 13 | { |
14 | 14 | $this->selector = VoidCore::getClass ($this->classname, $this->assembly); |
15 | 15 | |
16 | - if ($pid !== null) |
|
17 | - $this->selector = $pid == getmypid () ? |
|
16 | + if ($pid !== null) { |
|
17 | + $this->selector = $pid == getmypid () ? |
|
18 | 18 | VoidCore::callMethod ($this->selector, 'GetCurrentProcess') : |
19 | 19 | VoidCore::callMethod ($this->selector, 'GetProcessById', $pid); |
20 | + } |
|
20 | 21 | |
21 | 22 | Components::add ($this); |
22 | 23 | } |
@@ -20,33 +20,33 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return AST - возвращает AST дерево разметки |
22 | 22 | */ |
23 | - public static function parse (string $vst): AST |
|
23 | + public static function parse(string $vst): AST |
|
24 | 24 | { |
25 | 25 | $tree = new AST; |
26 | 26 | $objects = new Stack; |
27 | 27 | |
28 | - if (file_exists ($vst)) |
|
29 | - $vst = file_get_contents ($vst); |
|
28 | + if (file_exists($vst)) |
|
29 | + $vst = file_get_contents($vst); |
|
30 | 30 | |
31 | - $lines = explode (self::$divider, $vst); |
|
31 | + $lines = explode(self::$divider, $vst); |
|
32 | 32 | $skip_at = -1; |
33 | 33 | |
34 | 34 | foreach ($lines as $line_num => $line) |
35 | 35 | { |
36 | 36 | // \VoidEngine\pre ($line_num .', '. ($skip_at > $line_num ? 'skip' : 'not skip') .': '. $line); |
37 | 37 | |
38 | - if ($skip_at > $line_num || !self::filter ($line)) |
|
38 | + if ($skip_at > $line_num || !self::filter($line)) |
|
39 | 39 | continue; |
40 | 40 | |
41 | - $height = self::getHeight ($line); |
|
42 | - $words = array_filter (explode (' ', $line), 'VLF\Parser::filter'); |
|
41 | + $height = self::getHeight($line); |
|
42 | + $words = array_filter(explode(' ', $line), 'VLF\Parser::filter'); |
|
43 | 43 | $poped = false; |
44 | 44 | |
45 | 45 | # Очищаем стек объектов |
46 | - while ($objects->size () > 0) |
|
47 | - if ($objects->current ()->height >= $height) |
|
46 | + while ($objects->size() > 0) |
|
47 | + if ($objects->current()->height >= $height) |
|
48 | 48 | { |
49 | - $objects->pop (); |
|
49 | + $objects->pop(); |
|
50 | 50 | |
51 | 51 | $poped = true; |
52 | 52 | } |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | else break; |
55 | 55 | |
56 | 56 | # Создаём новую ссылку на объект |
57 | - if ($poped && $objects->size () > 0) |
|
57 | + if ($poped && $objects->size() > 0) |
|
58 | 58 | { |
59 | - $object = $objects->pop (); |
|
59 | + $object = $objects->pop(); |
|
60 | 60 | |
61 | - $objects->push (new Node (array_merge ($object->export (), ['nodes' => []]))); |
|
62 | - $tree->push ($objects->current ()); |
|
61 | + $objects->push(new Node(array_merge($object->export(), ['nodes' => []]))); |
|
62 | + $tree->push($objects->current()); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | if (isset ($words[0][1])) |
74 | 74 | { |
75 | 75 | if ($words[0][1] == '^') |
76 | - $skip_at = self::parseSubtext ($lines, $line_num, $height)[1]; |
|
76 | + $skip_at = self::parseSubtext($lines, $line_num, $height)[1]; |
|
77 | 77 | |
78 | - else throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1)); |
|
78 | + else throw new \Exception('Unknown char founded after comment definition at line '.($line_num + 1)); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | continue; |
@@ -86,30 +86,30 @@ discard block |
||
86 | 86 | */ |
87 | 87 | elseif ($words[0][0] == '.') |
88 | 88 | { |
89 | - $pos = strpos ($line, ':'); |
|
89 | + $pos = strpos($line, ':'); |
|
90 | 90 | $parents = null; |
91 | 91 | |
92 | 92 | if ($pos !== false) |
93 | 93 | { |
94 | - $name = trim (substr ($line, 1, $pos - 1)); |
|
94 | + $name = trim(substr($line, 1, $pos - 1)); |
|
95 | 95 | |
96 | 96 | if (isset ($line[$pos])) |
97 | 97 | { |
98 | - $parents = trim (substr ($line, $pos + 1)); |
|
98 | + $parents = trim(substr($line, $pos + 1)); |
|
99 | 99 | |
100 | - if (strlen ($parents) == 0) |
|
100 | + if (strlen($parents) == 0) |
|
101 | 101 | $parents = null; |
102 | 102 | |
103 | - else $parents = array_map ('trim', explode (',', $parents)); |
|
103 | + else $parents = array_map('trim', explode(',', $parents)); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - else $name = trim (substr ($line, 1)); |
|
107 | + else $name = trim(substr($line, 1)); |
|
108 | 108 | |
109 | - if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height) |
|
110 | - $parents = [$objects->current ()->args['name']]; |
|
109 | + if ($parents === null && $objects->size() > 0 && $objects->current()->height < $height) |
|
110 | + $parents = [$objects->current()->args['name']]; |
|
111 | 111 | |
112 | - $objects->push (new Node ([ |
|
112 | + $objects->push(new Node([ |
|
113 | 113 | 'type' => \VLF\STYLE_DEFINITION, |
114 | 114 | 'line' => $line, |
115 | 115 | 'words' => $words, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ] |
123 | 123 | ])); |
124 | 124 | |
125 | - $tree->push ($objects->current ()); |
|
125 | + $tree->push($objects->current()); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -130,30 +130,30 @@ discard block |
||
130 | 130 | */ |
131 | 131 | elseif ($words[0][0] == '*') |
132 | 132 | { |
133 | - $pos = strpos ($line, ':'); |
|
133 | + $pos = strpos($line, ':'); |
|
134 | 134 | $parents = null; |
135 | 135 | |
136 | 136 | if ($pos !== false) |
137 | 137 | { |
138 | - $name = trim (substr ($line, 1, $pos - 1)); |
|
138 | + $name = trim(substr($line, 1, $pos - 1)); |
|
139 | 139 | |
140 | 140 | if (isset ($line[$pos])) |
141 | 141 | { |
142 | - $parents = trim (substr ($line, $pos + 1)); |
|
142 | + $parents = trim(substr($line, $pos + 1)); |
|
143 | 143 | |
144 | - if (strlen ($parents) == 0) |
|
144 | + if (strlen($parents) == 0) |
|
145 | 145 | $parents = null; |
146 | 146 | |
147 | - else $parents = array_map ('trim', explode (',', $parents)); |
|
147 | + else $parents = array_map('trim', explode(',', $parents)); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - else $name = trim (substr ($line, 1)); |
|
151 | + else $name = trim(substr($line, 1)); |
|
152 | 152 | |
153 | - if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height) |
|
154 | - $parents = [$objects->current ()->args['name']]; |
|
153 | + if ($parents === null && $objects->size() > 0 && $objects->current()->height < $height) |
|
154 | + $parents = [$objects->current()->args['name']]; |
|
155 | 155 | |
156 | - $objects->push (new Node ([ |
|
156 | + $objects->push(new Node([ |
|
157 | 157 | 'type' => \VLF\STYLE_DEFINITION, |
158 | 158 | 'line' => $line, |
159 | 159 | 'words' => $words, |
@@ -166,35 +166,35 @@ discard block |
||
166 | 166 | ] |
167 | 167 | ])); |
168 | 168 | |
169 | - $tree->push ($objects->current ()); |
|
169 | + $tree->push($objects->current()); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Установка свойства |
174 | 174 | */ |
175 | - elseif (($pos = strpos ($line, ':')) !== false) |
|
175 | + elseif (($pos = strpos($line, ':')) !== false) |
|
176 | 176 | { |
177 | - if ($objects->size () == 0) |
|
178 | - throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1)); |
|
177 | + if ($objects->size() == 0) |
|
178 | + throw new \Exception('Trying to set property to unknown object at line '.($line_num + 1)); |
|
179 | 179 | |
180 | 180 | if (!isset ($words[1])) |
181 | - throw new \Exception ('Trying to set void property value at line '. ($line_num + 1)); |
|
181 | + throw new \Exception('Trying to set void property value at line '.($line_num + 1)); |
|
182 | 182 | |
183 | - $propertyName = substr ($line, 0, $pos); |
|
184 | - $propertyValue = substr ($line, $pos + 1); |
|
183 | + $propertyName = substr($line, 0, $pos); |
|
184 | + $propertyValue = substr($line, $pos + 1); |
|
185 | 185 | |
186 | 186 | /** |
187 | 187 | * Обработка многострочных свойств |
188 | 188 | */ |
189 | 189 | if ($line[$pos + 1] == '^') |
190 | 190 | { |
191 | - $parsed = self::parseSubtext ($lines, $line_num, $height); |
|
191 | + $parsed = self::parseSubtext($lines, $line_num, $height); |
|
192 | 192 | |
193 | - $propertyValue = substr ($propertyValue, 1) . $parsed[0]; |
|
193 | + $propertyValue = substr($propertyValue, 1).$parsed[0]; |
|
194 | 194 | $skip_at = $parsed[1]; |
195 | 195 | } |
196 | 196 | |
197 | - $objects->current ()->push (new Node ([ |
|
197 | + $objects->current()->push(new Node([ |
|
198 | 198 | 'type' => \VLF\PROPERTY_SET, |
199 | 199 | 'line' => $line, |
200 | 200 | 'words' => $words, |
@@ -212,26 +212,26 @@ discard block |
||
212 | 212 | */ |
213 | 213 | elseif (isset ($words[0][1]) && $words[0][0] == '-' && $words[0][1] == '>') |
214 | 214 | { |
215 | - if ($objects->size () == 0) |
|
216 | - throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1)); |
|
215 | + if ($objects->size() == 0) |
|
216 | + throw new \Exception('Trying to call method from unknown object at line '.($line_num + 1)); |
|
217 | 217 | |
218 | 218 | $methodArgs = []; |
219 | 219 | |
220 | - if (($pos = strpos ($line, '(')) !== false) |
|
220 | + if (($pos = strpos($line, '(')) !== false) |
|
221 | 221 | { |
222 | - if (($end = strrpos ($line, ')', $pos)) === false) |
|
223 | - throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1)); |
|
222 | + if (($end = strrpos($line, ')', $pos)) === false) |
|
223 | + throw new \Exception('Incorrect method arguments syntax at line '.($line_num + 1)); |
|
224 | 224 | |
225 | - $methodArgs = substr ($line, $pos + 1, $end - $pos - 1); |
|
225 | + $methodArgs = substr($line, $pos + 1, $end - $pos - 1); |
|
226 | 226 | |
227 | - $methodName = trim (substr ($line, 2, $pos - 2)); |
|
228 | - $methodArgs = self::filter ($methodArgs) ? |
|
229 | - self::parseArguments ($methodArgs) : []; |
|
227 | + $methodName = trim(substr($line, 2, $pos - 2)); |
|
228 | + $methodArgs = self::filter($methodArgs) ? |
|
229 | + self::parseArguments($methodArgs) : []; |
|
230 | 230 | } |
231 | 231 | |
232 | - else $methodName = trim (substr ($line, 2)); |
|
232 | + else $methodName = trim(substr($line, 2)); |
|
233 | 233 | |
234 | - $objects->current ()->push (new Node ([ |
|
234 | + $objects->current()->push(new Node([ |
|
235 | 235 | 'type' => \VLF\METHOD_CALL, |
236 | 236 | 'line' => $line, |
237 | 237 | 'words' => $words, |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * Неопознанная структура |
249 | 249 | */ |
250 | - else throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1)); |
|
250 | + else throw new \Exception('Unsupported structure founded at line '.($line_num + 1)); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | return $tree; |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | $tree = new AST; |
26 | 26 | $objects = new Stack; |
27 | 27 | |
28 | - if (file_exists ($vst)) |
|
29 | - $vst = file_get_contents ($vst); |
|
28 | + if (file_exists ($vst)) { |
|
29 | + $vst = file_get_contents ($vst); |
|
30 | + } |
|
30 | 31 | |
31 | 32 | $lines = explode (self::$divider, $vst); |
32 | 33 | $skip_at = -1; |
@@ -35,24 +36,26 @@ discard block |
||
35 | 36 | { |
36 | 37 | // \VoidEngine\pre ($line_num .', '. ($skip_at > $line_num ? 'skip' : 'not skip') .': '. $line); |
37 | 38 | |
38 | - if ($skip_at > $line_num || !self::filter ($line)) |
|
39 | - continue; |
|
39 | + if ($skip_at > $line_num || !self::filter ($line)) { |
|
40 | + continue; |
|
41 | + } |
|
40 | 42 | |
41 | 43 | $height = self::getHeight ($line); |
42 | 44 | $words = array_filter (explode (' ', $line), 'VLF\Parser::filter'); |
43 | 45 | $poped = false; |
44 | 46 | |
45 | 47 | # Очищаем стек объектов |
46 | - while ($objects->size () > 0) |
|
47 | - if ($objects->current ()->height >= $height) |
|
48 | + while ($objects->size () > 0) { |
|
49 | + if ($objects->current ()->height >= $height) |
|
48 | 50 | { |
49 | 51 | $objects->pop (); |
52 | + } |
|
50 | 53 | |
51 | 54 | $poped = true; |
55 | + } else { |
|
56 | + break; |
|
52 | 57 | } |
53 | 58 | |
54 | - else break; |
|
55 | - |
|
56 | 59 | # Создаём новую ссылку на объект |
57 | 60 | if ($poped && $objects->size () > 0) |
58 | 61 | { |
@@ -72,10 +75,11 @@ discard block |
||
72 | 75 | */ |
73 | 76 | if (isset ($words[0][1])) |
74 | 77 | { |
75 | - if ($words[0][1] == '^') |
|
76 | - $skip_at = self::parseSubtext ($lines, $line_num, $height)[1]; |
|
77 | - |
|
78 | - else throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1)); |
|
78 | + if ($words[0][1] == '^') { |
|
79 | + $skip_at = self::parseSubtext ($lines, $line_num, $height)[1]; |
|
80 | + } else { |
|
81 | + throw new \Exception ('Unknown char founded after comment definition at line '. ($line_num + 1)); |
|
82 | + } |
|
79 | 83 | } |
80 | 84 | |
81 | 85 | continue; |
@@ -97,17 +101,19 @@ discard block |
||
97 | 101 | { |
98 | 102 | $parents = trim (substr ($line, $pos + 1)); |
99 | 103 | |
100 | - if (strlen ($parents) == 0) |
|
101 | - $parents = null; |
|
102 | - |
|
103 | - else $parents = array_map ('trim', explode (',', $parents)); |
|
104 | + if (strlen ($parents) == 0) { |
|
105 | + $parents = null; |
|
106 | + } else { |
|
107 | + $parents = array_map ('trim', explode (',', $parents)); |
|
108 | + } |
|
104 | 109 | } |
110 | + } else { |
|
111 | + $name = trim (substr ($line, 1)); |
|
105 | 112 | } |
106 | 113 | |
107 | - else $name = trim (substr ($line, 1)); |
|
108 | - |
|
109 | - if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height) |
|
110 | - $parents = [$objects->current ()->args['name']]; |
|
114 | + if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height) { |
|
115 | + $parents = [$objects->current ()->args['name']]; |
|
116 | + } |
|
111 | 117 | |
112 | 118 | $objects->push (new Node ([ |
113 | 119 | 'type' => \VLF\STYLE_DEFINITION, |
@@ -141,17 +147,19 @@ discard block |
||
141 | 147 | { |
142 | 148 | $parents = trim (substr ($line, $pos + 1)); |
143 | 149 | |
144 | - if (strlen ($parents) == 0) |
|
145 | - $parents = null; |
|
146 | - |
|
147 | - else $parents = array_map ('trim', explode (',', $parents)); |
|
150 | + if (strlen ($parents) == 0) { |
|
151 | + $parents = null; |
|
152 | + } else { |
|
153 | + $parents = array_map ('trim', explode (',', $parents)); |
|
154 | + } |
|
148 | 155 | } |
156 | + } else { |
|
157 | + $name = trim (substr ($line, 1)); |
|
149 | 158 | } |
150 | 159 | |
151 | - else $name = trim (substr ($line, 1)); |
|
152 | - |
|
153 | - if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height) |
|
154 | - $parents = [$objects->current ()->args['name']]; |
|
160 | + if ($parents === null && $objects->size () > 0 && $objects->current ()->height < $height) { |
|
161 | + $parents = [$objects->current ()->args['name']]; |
|
162 | + } |
|
155 | 163 | |
156 | 164 | $objects->push (new Node ([ |
157 | 165 | 'type' => \VLF\STYLE_DEFINITION, |
@@ -174,11 +182,13 @@ discard block |
||
174 | 182 | */ |
175 | 183 | elseif (($pos = strpos ($line, ':')) !== false) |
176 | 184 | { |
177 | - if ($objects->size () == 0) |
|
178 | - throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1)); |
|
185 | + if ($objects->size () == 0) { |
|
186 | + throw new \Exception ('Trying to set property to unknown object at line '. ($line_num + 1)); |
|
187 | + } |
|
179 | 188 | |
180 | - if (!isset ($words[1])) |
|
181 | - throw new \Exception ('Trying to set void property value at line '. ($line_num + 1)); |
|
189 | + if (!isset ($words[1])) { |
|
190 | + throw new \Exception ('Trying to set void property value at line '. ($line_num + 1)); |
|
191 | + } |
|
182 | 192 | |
183 | 193 | $propertyName = substr ($line, 0, $pos); |
184 | 194 | $propertyValue = substr ($line, $pos + 1); |
@@ -212,25 +222,27 @@ discard block |
||
212 | 222 | */ |
213 | 223 | elseif (isset ($words[0][1]) && $words[0][0] == '-' && $words[0][1] == '>') |
214 | 224 | { |
215 | - if ($objects->size () == 0) |
|
216 | - throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1)); |
|
225 | + if ($objects->size () == 0) { |
|
226 | + throw new \Exception ('Trying to call method from unknown object at line '. ($line_num + 1)); |
|
227 | + } |
|
217 | 228 | |
218 | 229 | $methodArgs = []; |
219 | 230 | |
220 | 231 | if (($pos = strpos ($line, '(')) !== false) |
221 | 232 | { |
222 | - if (($end = strrpos ($line, ')', $pos)) === false) |
|
223 | - throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1)); |
|
233 | + if (($end = strrpos ($line, ')', $pos)) === false) { |
|
234 | + throw new \Exception ('Incorrect method arguments syntax at line '. ($line_num + 1)); |
|
235 | + } |
|
224 | 236 | |
225 | 237 | $methodArgs = substr ($line, $pos + 1, $end - $pos - 1); |
226 | 238 | |
227 | 239 | $methodName = trim (substr ($line, 2, $pos - 2)); |
228 | 240 | $methodArgs = self::filter ($methodArgs) ? |
229 | 241 | self::parseArguments ($methodArgs) : []; |
242 | + } else { |
|
243 | + $methodName = trim (substr ($line, 2)); |
|
230 | 244 | } |
231 | 245 | |
232 | - else $methodName = trim (substr ($line, 2)); |
|
233 | - |
|
234 | 246 | $objects->current ()->push (new Node ([ |
235 | 247 | 'type' => \VLF\METHOD_CALL, |
236 | 248 | 'line' => $line, |
@@ -247,7 +259,9 @@ discard block |
||
247 | 259 | /** |
248 | 260 | * Неопознанная структура |
249 | 261 | */ |
250 | - else throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1)); |
|
262 | + else { |
|
263 | + throw new \Exception ('Unsupported structure founded at line '. ($line_num + 1)); |
|
264 | + } |
|
251 | 265 | } |
252 | 266 | |
253 | 267 | return $tree; |