Commit 90e289d3 authored by gerd's avatar gerd

New backslash sequences


git-svn-id: https://godirepo.camlcity.org/svn/lib-xstrp4/trunk@15 56444827-45db-0310-81c6-95464f7ca4c4
parent 4fe9b938
version = "1.2"
version = "1.3"
requires = "camlp4"
# This line counts when the compiler is invoked with
......
(* $Id: xstrp4_here_lexer.mll,v 1.2 2002/08/15 23:33:26 gerd Exp $
(* $Id: xstrp4_here_lexer.mll,v 1.3 2002/12/28 18:41:33 gerd Exp $
* ----------------------------------------------------------------------
*
*)
......@@ -14,7 +14,6 @@
UC s -> s :: parse_val_id f buf
| LC s -> [s]
| End_of_id -> []
}
let ucletter = [ 'A' - 'Z' ]
......@@ -63,6 +62,25 @@ rule token = parse
{ Literal "" }
| '\\' '$'
{ Literal "$" }
| '\\' [ '0'-'9' ] [ '0'-'9' ] [ '0'-'9' ]
{ Literal (let s = Lexing.lexeme lexbuf in
let n = int_of_string(String.sub s 1 3) in
Printf.sprintf "%c" (Char.chr n)
)
}
| '\\' 'o' [ '0'-'9' ] [ '0'-'9' ] [ '0'-'9' ]
{ Literal (let s = Lexing.lexeme lexbuf in
let n = int_of_string("0" ^ String.sub s 1 4) in
Printf.sprintf "%c" (Char.chr n)
)
}
| '\\' 'x' [ '0'-'9' 'a'-'f' 'A'-'F' ] [ '0'-'9' 'a'-'f' 'A'-'F' ]
{ Literal (let s = Lexing.lexeme lexbuf in
let n = int_of_string("0" ^ String.sub s 1 3) in
Printf.sprintf "%c" (Char.chr n)
)
}
| '\\' _
{ Literal (Lexing.lexeme lexbuf) }
| [^ '$' '\\']+
......@@ -86,6 +104,9 @@ and value_identifier = parse
* History:
*
* $Log: xstrp4_here_lexer.mll,v $
* Revision 1.3 2002/12/28 18:41:33 gerd
* New backslash sequences
*
* Revision 1.2 2002/08/15 23:33:26 gerd
* Added qualifiers for int32, int64, and nativeint.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment