Openra: Tabs in yaml files break 3rd party parsers

Created on 13 Mar 2014  路  10Comments  路  Source: OpenRA/OpenRA

It looks like most of the yaml files used by OpenRA are using tabs for indentation. I was trying to parse one of them with a library and got a bunch of errors as a result. It looks like tabs for indentation are not allowed by the yaml spec (see section6.1). Of course OpenRA doesn't have to completely follow the spec (and you can replace tabs with spaces before parsing), but it would be nice if it did for tool compatibility.

From what I can tell, OpenRA uses its own yaml parser class so maybe that implementation only supports tabs or something.

Apologies if this is a duplicate, I couldn't find an existing discussion on this by searching the repo.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Refactor

Most helpful comment

Disagree with the thought process here, syntax is not an opinion thing. You either comply to it or your code breaks. If you work around it (our own parser), the integrations break. Better to comply with it than to write your own language / invent new filetypes. We should fix our yaml data and parser.

All 10 comments

Our yaml files aren't really yaml files. It was a mistake to give them the .yaml extension.

We can either rename to oraml or convert from tabs to spaces.

Not a duplicate. I think we only talked on IRC about it.

Sorry for posting on an aging issue, but I'm against using spaces for this so oraml would be my vote if we NEED to rename it.

https://github.com/OpenRA/OpenRA/pull/6984 probably does not help you, but it is kinda related.

It looks like tabs for indentation are not allowed by the yaml spec (see section6.1).

Ah, so thats why notpad++ doesnt recognize it fully (and hence does syntax highlighting wrong).
But I prefer tabs for editing, too :/

Disagree with the thought process here, syntax is not an opinion thing. You either comply to it or your code breaks. If you work around it (our own parser), the integrations break. Better to comply with it than to write your own language / invent new filetypes. We should fix our yaml data and parser.

Did you ever write Code with 12 or 16 leading spaces? I don鈥檛 want to waste my time counting dots or debug someone elses code which misses just one very hidden space somewhere.
Idk who came up with the idea to define spaces as default indentation for yaml, but I鈥檓 sure they regret their decision now. ( but can鈥檛 undo it because of standards and backwards compatibility )

.oraml would be fine, so the standard of yaml remains untouched.

Did you ever write Code with 12 or 16 leading spaces? I don鈥檛 want to waste my time counting dots or debug someone elses code which misses just one very hidden space somewhere.

You can configure vscode to insert a configurable number of spaces when you hit tab. If you set it to 8 spaces, it looks the same like when inserting tabs. I'm sure there are workarounds for other editors, too.

.oraml would be fine, so the standard of yaml remains untouched.

After reading #13910 I think this is not feasible.

Was this page helpful?
0 / 5 - 0 ratings