SELECT c
FROM
IN ['a .. 'z],
IN ['A .. 'Z] => {
source.Backup[c];
nRead ← nRead - 1;
[tokenKind~tokKind, token~scanBuf, charsSkipped~nSkipped]
← IO.GetCedarToken[stream~source, buffer~buffer];
nRead ← nRead + nSkipped;
IF tokKind # tokenERROR
THEN nRead ← nRead + RefText.Length[scanBuf];
IF tokKind # tokenID
THEN RETURN[tokType~tokError, charsRead~nRead] ;
tokName ← Atom.MakeAtomFromRefText[scanBuf];
RETURN[tokType~TokTypeFromAtom[tokName], tokVal~tokName, charsRead~nRead]
} ;
IN ['0 .. '9], '', '" => {
source.Backup[c];
nRead ← nRead - 1;
[tokenKind~tokKind, token~scanBuf, charsSkipped~nSkipped]
← IO.GetCedarToken[stream~source, buffer~buffer];
nRead ← nRead + nSkipped;
IF tokKind # tokenERROR
THEN nRead ← nRead + RefText.Length[scanBuf];
SELECT tokKind
FROM
tokenDECIMAL, tokenOCTAL, tokenHEX =>
RETURN[tokType~tokIntConst, tokVal~Rope.FromRefText[scanBuf], charsRead~nRead] ;
tokenCHAR =>
RETURN[tokType~tokCharConst, tokVal~Rope.FromRefText[scanBuf], charsRead~nRead] ;
tokenROPE =>
RETURN[tokType~tokStringConst, tokVal~Rope.FromRefText[scanBuf], charsRead~nRead] ;
ENDCASE =>
RETURN[tokType~tokError, charsRead~nRead] ;
} ;
'< => {
IF (
NOT source.EndOf[])
THEN
BEGIN
SELECT source.PeekChar[]
FROM
'* => {
[] ← source.GetChar[];
nRead ← nRead+1;
RETURN[tokType~tokLRecTupleBrak, charsRead~nRead];
} ;
END ;
RETURN[tokType~tokLTupleBrak, charsRead~nRead];
} ;
'* => {
IF (
NOT source.EndOf[])
THEN
BEGIN
SELECT source.PeekChar[]
FROM
'> => {
[] ← source.GetChar[];
nRead ← nRead+1;
RETURN[tokType~tokRRecTupleBrak, charsRead~nRead];
} ;
END ;
} ;
'= => {
IF (
NOT source.EndOf[])
THEN
BEGIN
SELECT source.PeekChar[]
FROM
'> => {
[] ← source.GetChar[];
nRead ← nRead+1;
RETURN[tokType~tokGuardArrow, charsRead~nRead];
} ;
END ;
} ;
'- => {
IF (
NOT source.EndOf[])
THEN
BEGIN
SELECT source.PeekChar[]
FROM
'> => {
[] ← source.GetChar[];
nRead ← nRead+1;
RETURN[tokType~tokFunctionArrow, charsRead~nRead];
} ;
END ;
} ;
'. =>
RETURN[tokType~tokSelect, charsRead~nRead] ;
', =>
RETURN[tokType~tokListSep, charsRead~nRead] ;
'| =>
RETURN[tokType~tokConcat, charsRead~nRead] ;
'? =>
RETURN[tokType~tokQuery, charsRead~nRead] ;
'~ =>
RETURN[tokType~tokIsBoundTo, charsRead~nRead] ;
'> =>
RETURN[tokType~tokRTupleBrak, charsRead~nRead] ;
'; =>
RETURN[tokType~tokStmtSep, charsRead~nRead] ;
': =>
RETURN[tokType~tokHasType, charsRead~nRead] ;
'[ =>
RETURN[tokType~tokLBrak, charsRead~nRead] ;
'] =>
RETURN[tokType~tokRBrak, charsRead~nRead] ;
'{ =>
RETURN[tokType~tokLUnionBrak, charsRead~nRead] ;
'} =>
RETURN[tokType~tokRUnionBrak, charsRead~nRead] ;
'( =>
RETURN[tokType~tokLParen, charsRead~nRead] ;
') =>
RETURN[tokType~tokRParen, charsRead~nRead] ;
'# =>
RETURN[tokType~tokGuardedExpSep, charsRead~nRead] ;
IO.
DEL =>
RETURN[tokType~tokError, charsRead~nRead] ;