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>

The Fortress compiler now correctly implements the character data type. In the interpreter the name of this type was\(\mskip1.5mu\) \(\newcommand\EXP[1]{#1} \newcommand\KWD[1]{\mathrel{\mathtt{#1}}} \newcommand\KWDVAR[1]{\mathord{\mathtt{#1}}} \newcommand\OPR[1]{\mathbin{\mathtt{#1}}} \newcommand\BIGOPR[1]{\mathop{\lower0.4ex\hbox{\vrule height 1.2em depth 0.1em width 0pt\Large$\mathtt{#1}$}}} \newcommand\BIGOP[1]{\mathop{\lower0.2ex\hbox{\Large$#1$}}} \newcommand\TYP[1]{\mathord{\mathrm{#1}}} \newcommand\VAR[1]{\mathord{\mathit{#1}}} \newcommand\STR[1]{#1} \newcommand\CONDEQ{\mathrel{\mathtt{:}}=\mathrel{\mathtt{:}}} \newcommand\ASSIGN{\mathrel{\mathtt{:}}=} \newcommand\COLON{\mathpunct{\mathtt{:}}} \newcommand\COLONOP{\mathinner{\mathtt{:}}} \newcommand\SHORTCUT[1]{\mathrel{\mathord{#1}\mathord{:}}} \newcommand\verythin{{{\mskip 1.5mu}}} \newcommand\ultrathin{{{\mskip 0.75mu}}} \def\Vvert{\mathrel{\vert\mskip-1.5mu\vert\mskip-1.5mu\vert}} \def\VVert{\mathrel{\vert\mskip-1.5mu\vert\mskip-1.5mu\vert\mskip-1.5mu\vert}} \def\sequiv{\mathrel{\hbox{\raise0.215ex\hbox to 0pt{$\equiv$\hss}\lower0.215ex\hbox{$\equiv$}}}} \newcommand\bigllbracket{\bigl[\mkern-5mu\bigl[} \newcommand\bigrrbracket{\bigr]\mkern-5mu\bigr]} \newcommand\Bigllbracket{\Bigl[\mkern-5.5mu\Bigl[} \newcommand\Bigrrbracket{\Bigr]\mkern-5.5mu\Bigr]} \newcommand\biggllbracket{\biggl[\mkern-6mu\biggl[} \newcommand\biggrrbracket{\biggr]\mkern-6mu\biggr]} \newcommand\Biggllbracket{\Biggl[\mkern-6.5mu\Biggl[} \newcommand\Biggrrbracket{\Biggr]\mkern-6.5mu\Biggr]} \newcommand\leftllbracket{\left[\mkern-5.5mu\left[} \newcommand\rightrrbracket{\right]\mkern-5.5mu\right]}\TYP{Char}\mskip1.5mu\), but for the compiler, in accordance with the original Fortress 1.0beta specification, the name is\(\mskip1.5mu\) \(\TYP{Character}\mskip1.5mu\). Instances of the\(\mskip1.5mu\) \(\TYP{Character}\mskip1.5mu\) data type are all Unicode codepoints from U+0000 to U+10FFFF, regardless of whether they currently are (or will ever be) assigned to specific characters. Internally they are represented using the Java int type.

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.

Comments:

I want to be member

Posted by lamidi saheed olaide on June 27, 2012 at 01:37 PM EDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Technical discussion of the Fortress programming language and its applications

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today