[phc-general] Single Quoting strings
Satyam at satyam.com.ar
Sat Aug 5 16:02:04 CEST 2006
----- Original Message -----
From: "Dan Libby" <danda at osc.co.cr>
To: "Edsko de Vries" <edsko at phpcompiler.org>
Cc: <phc-general at phpcompiler.org>
Sent: Friday, August 04, 2006 11:05 PM
Subject: Re: [phc-general] Single Quoting strings
> Hi Edsko,
> Thanks for the detailed reply.
> Regarding a plugin, I'm contemplating writing a plugin that can do some
> source-code re-writing and/or possibly highlight coding problems.
> The key thing is that it should write out the code exactly as it was
> originally written (before parsing) *except* for the desired changes.
I can reply to that because that's exactly what I am doing and it works
> So for example, it could write out a modified version of the source code
> double quotes have been changed to single, but no other re-formatting has
> been done. Or perhaps it could write out comments indicating things that
> should be reviewed.
> However, I'm not sure this is possible. It would seem to be necessary to
> in somehow at the parsing level, so that I have access to the original
> and ideally a pointer to the start/end location of each string within the
I was thinking about this a few days ago. As a first approach, every node
saves the source file name and line number so the source can be accessed,
though still you would need to parse that line to find the character
position of the token that made the node. Perhaps, adding the character
position would be nice. Otherwise, adding a string value to AST_node giving
the original text might also be useful.
> So my question to you is, does this sound even remotely feasible, and if
> can you provide me with some pointers on where/how to begin?
Unless you want to redo the parser, which is not hard, the tutorials have
more than enough info on how to work it. I have even found, as the replies
to my questions in this list show, that they have even more information than
a first read show.
> On Thursday 03 August 2006 03:07, Edsko de Vries wrote:
>> For the time being, if you want to experiment, you could quite easily
>> the PHP unparser code, with your modification, stick it in a plugin, and
>> then run it as a plugin. You'd do something like
> Dan Libby
> Open Source Consulting
> San Jose, Costa Rica
> phone: 011 506 223 7382
> Fax: 011 506 223 7359
> phc-general mailing list
> phc-general at phpcompiler.org
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.10.7/409 - Release Date: 04/08/2006
More information about the phc-general