Strict syntax enforced by pipeline

I’m experimenting with strict syntax using NXF_SYNTAX_PARSER=v2. I’m wondering if it’s possible to indicate that a pipeline uses strict syntax in the pipeline definition itself, so i don’t need to set that environment variable everywhere that it runs. This would be helpful because after making changes for compatibility, the pipeline no longer runs on the old syntax parser.

What were the changes that made your pipeline incompatible with the old parser?

The strict parser essentially allows a subset of Groovy syntax from the old parser. As long as you don’t adopt any of the new language features in 25.10, your pipeline should be able to run with either parser.

So if you found some incompatibility, that might be a bug.

To answer your immediate question, there is no way to enable strict syntax in the pipeline script / config. This is because the plan is to make strict syntax the default in 26.04, and remove the old parser soon after that (e.g. 26.10).

So in practical terms, suppose a pipeline still uses syntax not allowed in the strict parser, and we remove the old parser in 26.10 (just a hypothetical, we haven’t decided for sure), the pipeline would need to specify manifest.nextflowVersion = '!<26.10'.

But in the meantime, any pipeline that complies with the strict syntax should also still work with the old parser.

The incompatibility is that the formatter converts e.g. “catch (Exception e)” to “catch (e: Exception)”.

Okay, that’s what I suspected. It’s an unfortunate rough edge that results from trying to support the old Groovy type syntax while providing an automatic migration to the new syntax. The 25.10 formatter does not necessarily try to keep your code compatible with older versions.

If you want to keep your pipeline compatible with both parsers, I would just stick to the 25.04 formatter, as described here under “Type annotations”.

Or you can just remove the type annotation: catch (e)

ok, thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.