ARudik / phc

Automatically exported from code.google.com/p/phc
0 stars 0 forks source link

Unparser relies on unparser attributes #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The canonical unparser removes all the phc.unparser.* attributes. However,
this makes include (), echo etc fail. Those functions rely on attributes
for the unparsing. This means that AST transformations have to add the
unparser attributes to be unparsed properly. This seems wrong.

I think a better approach would be for the unparser to know the list of
functions which require brackets, or require brackets to be omitted.
Currently that information is in the parser. This would leave phc.unparser
to  provide user coding information, which seems a better idea.

Original issue reported on code.google.com by paul.biggar on 19 Nov 2007 at 2:46

GoogleCodeExporter commented 9 years ago
Issue 72 is related, so merging it here. Strings are not properly handled in the
absense of unparser attributes.

Original comment by paul.biggar on 19 Nov 2007 at 5:12

GoogleCodeExporter commented 9 years ago
This has been discussed at length. In summary:

1.) Removing phc.unparser.* is OK as long as we remove source_rep along with it.
2.) Echoes will be unparsed specially to be bracketed correctly (in the absense 
of
attributes).
3.) If source_rep is not set, value will be used. The value will be unparsed 
using
single-quoting escaping rules. If source_rep is set, no escaping is done at all.

Tokens which are created in an AST transform may set a source_rep if they are 
happy
for it to be unparsed directly.

Original comment by paul.biggar on 19 Nov 2007 at 5:35

GoogleCodeExporter commented 9 years ago
This is fixed. The cb_sua tests it. There are currently no problems.

Original comment by paul.biggar on 23 May 2008 at 2:05