martin-helmich / typo3-typoscript-lint

Find coding errors in your TypoScript files.
MIT License
82 stars 19 forks source link

Including TypoScript files throws tokenization error #59

Closed atomicptr closed 6 years ago

atomicptr commented 6 years ago

Using the include typoscript statement will throw a tokenization error

<INCLUDE_TYPOSCRIPT: source="DIR:EXT:extension_key/Configuration/TypoScript/config" />

Throws:

Completed with 1 issues

CHECKSTYLE REPORT
=> /home/atomicptr/dev/extension_key/Configuration/TypoScript/setup.typoscript.
   1 Tokenization error: Cannot tokenize line "<INCLUDE_TYPOSCRIPT: source="DIR:EXT:extension_key/Configuration/TypoScript/config" />"

SUMMARY
1 issues in total. (1 errors)
martin-helmich commented 6 years ago

Thanks for this report!

Using <INCLUDE_TYPOSCRIPT ... /> as a self-closing tag (/>) is nothing I've ever seen before (not like this is actual XML, after all). None of the documentation I've found nor the actual parser's source code look like this is actually supported.

In the original parser, a self-closing INCLUDE_TYPOSCRIPT-tag will match the first regular expression in line 830, but not the second expression in line 847. So even if this include works in your setup, it will definitely not work as intended as soon as you add a condition statement (which, as I think of it, is not supported by my typo3-typoscript-parser, either -- that's worth a separate issue).

Since using this syntax (although supported to some extent, but neither documented nor intended) may lead to unexpected surprises, I'm leaning towards continuing to report this as a syntax error. Thoughts?

atomicptr commented 6 years ago

Interesting, I've never thought about this statement being wrong since it worked until now. Since as you noted this leads to unexpected behavior, this should probably be reported as a bug in the TypoScript parser, it probably shouldn't work at all.