Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-9735

Disabling unicode escapes makes REPL unusable

    Details

      Description

      If starting the REPL session with `-Xno-uescape`, the REPL becomes unusable:

      x:\Scala\scala-2.12.0-M4\bin>scala -Xno-uescape
      Welcome to Scala 2.12.0-M4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_74).
      Type in expressions for evaluation. Or try :help.
       
      scala> object A
      <console>:10: error: invalid escape character
      + "defined object " + "A" + "\u000A"
                                    ^
      

      The problem can be traced to scala.tools.nsc.interpreter.ReplStrings.string2code(str: String) which invokes Chars.char2uescape(c) on any control character.

      A proposed fix would be to inline control characters' integer values and circumvent said escaping altogether.

      Here is a quick hack which seems to do the trick via a specialized pattern match on the unix newline \n instead of \u000A
      https://github.com/melezov/scala/commit/c2fdafc55eeb129ac778e54007ac54cdf88357c3

        Attachments

          Activity

            People

            • Assignee:
              apm A. P. Marki
              Reporter:
              limo Marko Elezovic
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: