scala-ide / scalariform

Scala source code formatter
http://scala-ide.github.com/scalariform/
MIT License
527 stars 148 forks source link

Lexer, edge-case error: Back-quote identifiers wrongly do not accept escape sequence newlines. #242

Closed MelvinWM closed 7 years ago

MelvinWM commented 7 years ago

Not a very important error as far as I can see, since back-quote identifiers that contains escape sequence newlines does not seem useful. I encountered it when writing various edge-case unit tests.

A unit test for the error (should be placed in scalariform/src/test/scala/scalariform/lexer/ScalaLexerTest.scala):

"`a\nb`" producesTokens (VARID)

The relevant code might be here: https://github.com/scala-ide/scalariform/blob/f53978c60579fa834ac9e56986a6133c0a621bfd/scalariform/src/main/scala/scalariform/lexer/ScalaOnlyLexer.scala#L166-L167.

MelvinWM commented 7 years ago

Sorry, nevermind, a brain-fart on my part - it should be:

"`a\\n`" producesTokens (VARID)"

and that does in fact work.