## Tuesday Jul 05, 2011

### Character data type now implemented in compiler

<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js" type="text/javascript"></script>


Character literals are supported in three forms: single-character, named, and hexadecimal. The single character form has either the actual Unicode character or an escape sequence between the single quotes:$$\mskip3mu$$ $$\EXP{\textrm{'}\mathtt{a}\textrm{'}}\mskip3mu$$ or$$\mskip3mu$$ $$\EXP{\textrm{'}\mathtt{+}\textrm{'}}\mskip3mu$$ or$$\mskip3mu$$ $$\EXP{\textrm{'}\oplus\textrm{'}}\mskip3mu$$. The named form has a name for the character between the single quotes:$$\mskip3mu$$ $$\EXP{\textrm{'}\mathtt{alpha}\textrm{'}}\mskip3mu$$ or$$\mskip3mu$$ $$\EXP{\textrm{'}\mathtt{SIGMA}\textrm{'}}\mskip3mu$$ or$$\mskip3mu$$ $$\EXP{\textrm{'}\mathtt{OPLUS}\textrm{'}}\mskip3mu$$. Not all names are currently supported. The hexadecimal form has four to six hexadecimal digits between the single quotes; as an experiment that goes beyond the current specification, the digits may optionally be preceded by "U+":$$\mskip3mu$$ $$\EXP{\textrm{'}\mathtt{007C}\textrm{'}}\mskip3mu$$ or$$\mskip3mu$$ $$\EXP{\textrm{'}\mathtt{1D164}\textrm{'}}\mskip3mu$$ or$$\mskip3mu$$ $$\EXP{\textrm{'}\mathtt{U+1D164}\textrm{'}}\mskip3mu$$.

The following methods of type$$\mskip1.5mu$$ $$\TYP{Character}\mskip1.5mu$$ are now implemented for compiled code:

 $$\mskip3mu$$$$\EXP{\KWD{getter} \VAR{asString}(\ultrathin)\COLON \TYP{String}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{getter} \VAR{asExprString}(\ultrathin)\COLON \TYP{String}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{getter} \VAR{codePoint}(\ultrathin)\COLON \mathbb{Z}32}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{<}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\leq}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{>}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\geq}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{=}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\neq}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\OPR{LNSIM}}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\OPR{LESSSIM}}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\OPR{GNSIM}}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\OPR{GTRSIM}}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\simeq}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\KWD{opr}\, \mathord{\not\simeq}(\KWDVAR{self}, \VAR{other}\COLON\TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{getDirectionality}(\KWDVAR{self})\COLON \mathbb{Z}32}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{getNumericValue}(\KWDVAR{self})\COLON \mathbb{Z}32}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{getType}(\KWDVAR{self})\COLON \mathbb{Z}32}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isDefined}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isDigit}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isFortressIdentifierPart}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isFortressIdentifierStart}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isHighSurrogate}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isIdentifierIgnorable}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isISOControl}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isJavaIdentifierPart}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isJavaIdentifierStart}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isLetter}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isLetterOrDigit}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isLowerCase}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isLowSurrogate}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isMirrored}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isSpaceChar}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isSupplementaryCodePoint}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isSurrogatePair}(\KWDVAR{self}, \VAR{low}\COLON \TYP{Character})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isTitleCase}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isUnicodeIdentifierPart}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isUnicodeIdentifierStart}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isUpperCase}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isValidCodePoint}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{isWhitespace}(\KWDVAR{self})\COLON \TYP{Boolean}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{javaDigit}(\KWDVAR{self}, \VAR{radix}\COLON \mathbb{Z}32)\COLON \mathbb{Z}32}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{toLowerCase}(\KWDVAR{self})\COLON \TYP{Character}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{toTitleCase}(\KWDVAR{self})\COLON \TYP{Character}}\mskip3mu$$ $$\mskip3mu$$$$\EXP{\VAR{toUpperCase}(\KWDVAR{self})\COLON \TYP{Character}}\mskip3mu$$

The first six comparison operators perform exact comparison on codepoint values; the second six ignore case by first converting to lowercase and then comparing the resulting codepoints.