Subversion Repositories fastphp

Rev

Rev 49 | Rev 54 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 49 Rev 51
Line 200... Line 200...
200
                        if ($token == T_CONST) {
200
                        if ($token == T_CONST) {
201
                                $wait_const = true;
201
                                $wait_const = true;
202
                        }
202
                        }
203
 
203
 
204
                        if (($token == T_COMMENT) && self::isToDoDescription($value)) {
204
                        if (($token == T_COMMENT) && self::isToDoDescription($value)) {
-
 
205
                                $comment_lines = explode("\n", trim($value));
-
 
206
                                foreach ($comment_lines as $line_no => $comment_line) {
-
 
207
                                        if (self::isToDoDescription($comment_line)) {
205
                                // Because a TO-DO-entry can stand everywhere (e.g. between a "private" and a "function" keyword)
208
                                                // Because a To-Do-entry can stand everywhere (e.g. between a "private" and a "function" keyword)
206
                                // we shall not alter the $icon instance
209
                                                // we shall not alter the $icon instance
207
                                $todoIcon = clone $icon;
210
                                                $todoIcon = clone $icon;
208
                                $todoIcon->setType(ICON_TYPE_TODO);
211
                                                $todoIcon->setType(ICON_TYPE_TODO);
209
                                FastPHPWriter::outputLeafNode($todoIcon, $line, self::stripComment($value));
212
                                                FastPHPWriter::outputLeafNode($todoIcon, $line+$line_no, self::stripComment($comment_line));
210
                                unset($todoIcon);
213
                                                unset($todoIcon);
211
                        }
214
                                        }
212
                }
215
                                }
213
        }
216
                        }
-
 
217
                }
-
 
218
        }
214
 
219
 
215
        private static function isToDoDescription($comment) {
220
        private static function isToDoDescription($comment) {
216
                return ((stripos($comment, 'TODO')   !== false) ||
221
                return ((stripos($comment, 'TODO')   !== false) ||
217
                        (stripos($comment, 'BUGBUG') !== false) ||
222
                        (stripos($comment, 'BUGBUG') !== false) ||
218
                        (stripos($comment, 'FIXME')  !== false) ||
223
                        (stripos($comment, 'FIXME')  !== false) ||
219
                        (stripos($comment, 'XXX')    !== false));
224
                        (stripos($comment, 'XXX')    !== false));
220
        }
225
        }
221
 
226
 
222
        private static function stripComment($x) {
227
        private static function stripComment($x) {
-
 
228
                $x = trim($x);
223
                if (substr($x, 0, 1) == '#') return trim(substr($x, 1));
229
                if (substr($x, 0, 1) == '#') return trim(substr($x, 1));
224
                if (substr($x, 0, 2) == '//') return trim(substr($x, 2));
230
                if (substr($x, 0, 2) == '//') return trim(substr($x, 2));
225
                if (substr($x, 0, 2) == '/*') return trim(substr($x, 2, strlen($x)-4));
231
                if (substr($x, 0, 2) == '/*') return trim(substr($x, 2, strlen($x)-4));
-
 
232
                return $x;
226
        }
233
        }
227
 
234
 
228
 
235
 
229
        private static final function array_peek($array) {
236
        private static final function array_peek($array) {
230
                if (!isset($array[count($array)-1])) return null;
237
                if (!isset($array[count($array)-1])) return null;