-----------------------------------------------------------------------------
--- (c) The University of Glasgow, 2004
+--
+-- (c) The University of Glasgow, 2004-2006
--
-- Lexer for concrete Cmm. We try to stay close to the C-- spec, but there
-- are a few minor differences:
import StringBuffer
import FastString
import Ctype
-import Util ( readRational )
+import Util
--import TRACE
}
$white_no_nl = $whitechar # \n
$ascdigit = 0-9
-$unidigit = \x01
+$unidigit = \x01 -- Trick Alex into handling Unicode. See alexGetChar.
$digit = [$ascdigit $unidigit]
$octit = 0-7
$hexit = [$digit A-F a-f]
-$unilarge = \x03
+$unilarge = \x03 -- Trick Alex into handling Unicode. See alexGetChar.
$asclarge = [A-Z \xc0-\xd6 \xd8-\xde]
$large = [$asclarge $unilarge]
-$unismall = \x04
+$unismall = \x04 -- Trick Alex into handling Unicode. See alexGetChar.
$ascsmall = [a-z \xdf-\xf6 \xf8-\xff]
$small = [$ascsmall $unismall \_]
-$namebegin = [$large $small \_ \. \$ \@]
+$namebegin = [$large $small \. \$ \@]
$namechar = [$namebegin $digit]
@decimal = $digit+
@floating_point = @decimal \. @decimal @exponent? | @decimal @exponent
-@escape = \\ ([abfnrt\\\'\"\?] | x @hexadecimal | @octal)
+@escape = \\ ([abfnrt\\\'\"\?] | x $hexit{1,2} | $octit{1,3})
@strchar = ($printable # [\"\\]) | @escape
cmm :-