rvanvelzen / lime

Lime is a LALR(1) parser generator written in PHP. The original source code can be found at http://sourceforge.net/projects/lime-php/, this is just a fork.
59 stars 9 forks source link

Moved everything into namespace lime #4

Open AlgorithMan-de opened 7 years ago

AlgorithMan-de commented 7 years ago

Lime declares a class named "Error". PHP also declares a class with that name since PHP 7. To solve the resulting "PHP Fatal error: Cannot declare class error, because the name is already in use", all Lime code was moved into namespace lime.

hikari-no-yume commented 7 years ago

Nitpick: would lime\ or Lime\ be better?

hikari-no-yume commented 7 years ago

(As a side note: I notice GitHub doesn't mark that commit as yours. Have you added its email address to your account?)

AlgorithMan-de commented 7 years ago

On sourceforge it's LIME... wondering why sourceforge is still the main repo though?

AlgorithMan-de commented 7 years ago

github probably didn't mark the commit as mine because I used an SSH key that has "E-Mail address" viktor@viktor or so... that's a bit stupid on githubs side there...

hikari-no-yume commented 7 years ago

It hasn't cared about the SSH key for me, but maybe it does. Looking at the raw commit, your git author info is Viktor Engelmann <viktor.engelmann@qt.io>. Do you have that email on your GitHub account?

AlgorithMan-de commented 7 years ago

no, I didn't - changed that :) thanks

gene-sis commented 7 years ago

I would suggest implementing support for autoloader (PSR-4), because you probably want to use Lime as a library for a project and not as a standalone tool.

AlgorithMan-de commented 7 years ago

Do I understand you correctly that you suggest naming the files & directories according to PSR-4, so that you don't have to explicitly include the files, because the file dirs & names can be deduced from the class name and can be loaded automatically? I personally don't mind loading the files explicitly, because you only need to include 2-3 files and I don't think you'll need to do that very often... I'd say you could make a separate issue for that.

gene-sis commented 7 years ago

Using an autoloader you will only load the files you really need for the actual path of the script (e.g. if you need a class in just one if statement, which is only necessary every 4th page view) You don't have to manage all the files you may need for the actual file. You also don't have to care about file paths every time you want to include.

For a small project with Lime as it's sole library, there may only be 2 or 3 files but the number can grow with more dependencies. (I wouldn't necessarily use autoloader for the parts of Lime, which are only be used to build the parser class while development)

A further step could be to allow Lime to be included easily by a dependency management tool.

hikari-no-yume commented 7 years ago

Adding a composer.json and submitting to Packagist could be done.

gene-sis commented 7 years ago

I wasn't sure about the activity of this repo, so I did this about a month ago, though it would be nice if this repo would get further improvements and would be usable via packagist.