eclipse-archived / ceylon.formatter

A formatter for the Ceylon programming language, written in Ceylon.
Apache License 2.0
14 stars 11 forks source link

Work around compiler restriction #47

Closed lucaswerkmeister closed 10 years ago

lucaswerkmeister commented 10 years ago

Looks like we need a workaround for ceylon/ceylon-spec#959 / ceylon/ceylon-spec#686. The formatter needs to add these spaces where the lexer needs them to lex correctly.

lucaswerkmeister commented 10 years ago

I actually already wrote the workaround on my netbook, and it was almost done until I got to the error message

TokenStream? is not assignable to TokenStream

I was just looking at the next token (is it a backtick? If yes, we need the space), and Ceylon’s awesome null safety kindly reminded me that I can’t do that, it has to work without a token stream :-(

The real solution probably involves some goLeftVisitor that goes from `foo.bar`.baz.foo(bar).baz to the `foo.bar` node.