In investigating #1405914: Make code link/reference creation more orderly and rational I came across this in the PGPReader class documentation:

"Also, template files with inline HTML and multiple php open and close tags are not supported."

I'm wondering if it would be possible to support these types of files in Grammar Parser?

The reason is that in the API module, we're using Grammar parser to find function/class/etc. declarations, and then we're using our own token_get_all() call to pretty-format the code and do reference/link tracking (e.g., "this function calls that function"). It seems like it would be good to use Grammar Parser to format the code and do reference/link tracking, but if it won't support .tpl.php files, which we need to support, then we have to keep doing our own token_get_code().

Any thoughts on whether this is possible in Grammar Parser? I'm guessing not, but I thought I would at least ask.

Comments

solotandem’s picture

It is not possible with the existing code. Parsing such files has been on the feature list for some time, but there was not a strong case for implementing. The difficulty (from my standpoint) comes in trying to rewrite the file. The format of a tpl.php file may deviate significantly from the regular coding standards. The parser is geared towards the latter at this time.

jhodgdon’s picture

Thanks for the quick response! We'll just stick with token_get_all() for code formatting then, for the time being.

solotandem’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.