Page 2 of 5

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 21st, 2014, 9:07 pm
by RobertPlummer
If I use "[assembly: \Export]" using phpstorm (the best php IDE out there), it breaks the php. What do you suggest then, moving forward?

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 21st, 2014, 9:13 pm
by RobertPlummer
Further, that isn't valid php markup, as I get the following:
Code: Select all
Parse error: syntax error, unexpected '[', expecting function (T_FUNCTION) in /home/robert/Projects/wikiLingo/WikiLingo/Parser.php on line 27

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 21st, 2014, 10:28 pm
by Jakub Misek
Thats right, some Phalanger language extensions are not compatible with standard PHP.

Assembly-wide attributes like [assembly: \Export] may be defined in separate .phpx file (e.g. AssemblyInfo.phpx), so PHP IDEs would ignore them.

However I agree, so such constructs should be made backward compatible. PHPDoc would be good option.

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 22nd, 2014, 12:47 am
by RobertPlummer
Is there any documentation on using phpx? A quick search on GitHub revieled nothing. Do I simply create a file called "AssemblyInfo.phpx" with it's contents "[assembly: \Export]"?

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 24th, 2014, 3:24 pm
by RobertPlummer
I'd be willing to make the contributions for the comments to be used to assist in exporting the code using the pure mode, but can I get some assistence with where to add these features? Where the existing code is located? Which IDE I should be using? WHen I open in VS 2013, it seems incompatible, and the same with MonoDevelop 4.

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 25th, 2014, 12:31 pm
by RobertPlummer
I compiled MonoDevelop 4.2.2, and it seems to work nice with Phalanger. So I've found the majority of the parsing. I can now see the PHPDocBlock.cs (Phalanger/Source/Core.Parsers/PHPDocBlock.cs) parser, and the CustomAttributes.cs (Phalanger/Source/Core.Parsers/AST/CustomAttributes.cs) file. I actually have done a bit of work converting Jison (yacc -> bison -> jison) to C#, so I am very familiar with the concepts used here and how parsers and lexers work. The amount of logic being pushed around here is outstanding!
Anyway, I will keep investigating, but any pointers would be nice. It'd be nice if we simply could use a new PHPDoc tag, perhaps "@export", which would trigger what [\Export] does.

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 25th, 2014, 7:07 pm
by Jakub Misek
Great you are looking into Phalanger!

.phpx is the same as .php, it just won't confuse other PHP IDEs.

by putting
Code: Select all
[assembly: \Export] class XYZ{}
Phalanger will mar all classes as exported and will generate nice C# methods over PHP functions used internally by Phalanger.

Surely use of PHPDoc is possible and easy; just by time Phalanger attributes were designed, there were no support for PHPDoc yet.

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 28th, 2014, 1:52 am
by RobertPlummer
This fake class will trigger the entire folder (all namespaces, classes, etc.) and all nested folders to be exported as a dll?

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 28th, 2014, 1:20 pm
by Jakub Misek
this attribute marks entire assembly so every PHP method in every class will be wrapped in a C#-like method so they can be called from C# in nicely.

Re: dll will not recignize using pure mode in phpcore

PostPosted: April 28th, 2014, 1:30 pm
by RobertPlummer
SWEET!!! Trying...