I think we would benefit from having coder, coder tough love and coder format all use the same parser.
I suggest that we rewrite coder format so it uses grammar parser module instead of PHP's built-in Tokenizer.
Thoughts?
I think we would benefit from having coder, coder tough love and coder format all use the same parser.
I suggest that we rewrite coder format so it uses grammar parser module instead of PHP's built-in Tokenizer.
Thoughts?
Comments
Comment #1
psynaptic commentedInstead of directly parsing using PHP's Tokenizer we should rely on grammar parser, which can function completely independently of a Drupal installation.
Comment #2
solotandem commentedTo clarify, the grammar parser module utilizes PHP's built-in tokenizer, but goes a step further to organize the tokens into objects that can be manipulated.
As you mention in #1, the parser can be used independent of Drupal, as, for example, (1) files can be parsed from the command line using a standard PHP script and (2) the Coder Upgrade module does so when the upgrade routines are run in a "separate process."
Comment #3
psynaptic commentedGreat, thanks for the clarification and extra information.
What do you think about making coder format use grammar parser? I'm keen to unify the see the various coder modules use the same backend. I would love to be able to integrate coder, coder format and coder tough love into my IDE. I have already done so with coder format but the rules are a bit messed up and I don't really want to pile a load of effort into wrangling that to work when it would be better to switch to using grammar parser for reading, parsing and writing.
Comment #4
sunAs the author of coder_format, I'm very interested in seeing this. The custom token handling is a major pain, and there are probably only a 1-3 people who understand what's going on in that code.
The good news is that most of coder_format's rules are covered by tests. So we can't break too much by switching to grammar_parser.
The bad news is that those tests were written for SimpleTest 1.x, euhm, in January 2008. They no longer work.
Thus, the very first step would be to make those tests work again with current SimpleTest in D7.
Hence, postponing on #536194: Port coder_format tests to HEAD
Comment #5
klausiCoder format is frozen and will not receive updates. Please use the phpcbf command with Coder 8.x-2.x instead. It can be used to format code for any Drupal version.