You are here: Re: Getting class object information from file. « PHP Programming Language « IT news, forums, messages
Re: Getting class object information from file.

Posted by elmosik on 10/04/02 12:00

On 17 Sty, 13:29, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:

> Regular expressions simply do not cut it. Consider the following comments
> which will not be caught by your regular expressions:
>
> define('SOME_CONFIG_OPTION', TRUE); # Here is a comment
> define('SOME_OTHER_OPTION', TRUE); // Here is a comment

Patterns used with preg_replace works fine. preg_replace($pattern,
''); - from pattern to empty string and I have clean code.

> But what about the following code which contains no comments, which will
> be treated as comments by your regexs:
>
> $comment = "/* Lala */
> // Lala
> ## Lala
> No comments here!";
> print $comment;

It's not problem for me because I don't need code from functions/
classes like variables etc. I need only to extract functions/classes
names. So example above isn't a problem, but I understand what you
wrote, but remember that it's not a php file parser, I'm not parsing
code from methods...

> Regular expressions are no good for any non-trivial parsing task. You need
> a stateful parser.

Any examples of stateful parser?

--
Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация