srakaprecision.blogg.se

Escape sequences java
Escape sequences java












It simply has nothing whatsoever to do with names. These characters wouldnt even be valid parts of identifiers (unless enclosed in backticks). u0028 and u0022 are replaced by ( and respectively.The u006E is expanded in the middle of another identifier ( println).The u0072 is expanded to r in the middle of a keyword ( for is a reserved keyword, not an identifier).

escape sequences java

Is a perfectly valid Scala program that prints hello, world ten times. For example ( run ScalaFiddle): fou0072 (i <- 1 to 10) priu006Etlnu0028hello, worldu0022) Information about what names are becomes available much later, only after the lexical analysis, once the sequence of input characters is split into tokens.Īll Scala does is simply replacing the escape sequences uXXXX by the corresponding Unicode characters. That means that the Unicode escape sequences know nothing about naming or names – when they are expanded, there is no information about what is currently processed: a name (identifier), or a reserved keyword, or some completely different language construct.

escape sequences java

Strictly speaking, it happens even before lexical analysis. Unicode escape sequences are processed at the level of individual characters. Your confusion comes from conflating two completely separate levels: How do unicode character escape sequences work in Scala and Java, when used in naming














Escape sequences java