Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Precedence uses codepoint when probing lead char. Scanner accepts supplementary chars in more places, such as op_Supple, 'Supple'.
- Loading branch information
Showing
6 changed files
with
155 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
newSource1.scala:4: error: illegal character '\ud801' missing low surrogate | ||
def ? = x | ||
^ | ||
newSource1.scala:5: error: illegal character '\udc00' | ||
def ? = y | ||
^ | ||
C(84) | ||
C(1764) | ||
C(1764) | ||
C(1806) | ||
C(1806) | ||
C(3528) | ||
C(3528) | ||
C(1806) | ||
C(3528) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
|
||
import scala.tools.partest.DirectTest | ||
|
||
object Test extends DirectTest { | ||
// for reference, UTF-8 of U0 | ||
//val data = Array(0xed, 0xa0, 0x81).map(_.asInstanceOf[Byte]) | ||
def U0 = "\ud801" | ||
def U1 = "\udc00" | ||
def code = | ||
s"""class C { | ||
| def x = "$U0" | ||
| def y = "$U1" | ||
| def $U0 = x | ||
| def $U1 = y | ||
|}""".stripMargin | ||
|
||
def show(): Unit = { | ||
assert(U0.length == 1) | ||
assert(!compile()) | ||
} | ||
case class C(n: Int) { | ||
def 𐀀(c: C): C = C(n * c.n) // actually a letter but supplementary 0x10000 | ||
def ☀(c: C): C = C(n * c.n) // just a symbol | ||
def ☀=(c: C): C = C(n * c.n) // just a symbol | ||
def 🌀(c: C): C = C(n * c.n) // cyclone operator is symbol, supplementary | ||
def 🌀=(c: C): C = C(n * c.n) // cyclone operator is symbol, supplementary | ||
def *(c: C): C = C(n * c.n) | ||
def +(c: C): C = C(n + c.n) | ||
} | ||
object Test extends App { | ||
val c, d = C(42) | ||
println(c + d) | ||
println(c * d) | ||
println(c ☀ d) | ||
println(c * d + d) | ||
println(c ☀ d + d) | ||
println(c ☀= d + d) // assignment op is low precedence | ||
println(c 𐀀 d + d) // the first one, letter should be low precedence | ||
println(c 🌀d + d) // the second one, cyclone should be high precedence | ||
println(c 🌀= d + d) // the second one, cyclone should be high precedence | ||
} | ||
|