HCoop
/
bpt
/
coccinelle.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
coccinelle release 0.2.5
[bpt/coccinelle.git]
/
parsing_cocci
/
lexer_script.mll
diff --git
a/parsing_cocci/lexer_script.mll
b/parsing_cocci/lexer_script.mll
index
5426f9c
..
d731460
100644
(file)
--- a/
parsing_cocci/lexer_script.mll
+++ b/
parsing_cocci/lexer_script.mll
@@
-33,7
+33,10
@@
let inc_line _ = Lexer_cocci.line := !Lexer_cocci.line + 1
(* ---------------------------------------------------------------------- *)
(* tokens *)
(* ---------------------------------------------------------------------- *)
(* tokens *)
-let myrule = [^'"''@''/''\n''\r''\011''\012']+
+let oct = ['0'-'7']
+let hex = ['0'-'9' 'a'-'f' 'A'-'F']
+
+let myrule = [^'\'''"''@''/''\n''\r''\011''\012']+
rule token = parse
| myrule { TScriptData (tok lexbuf) }
rule token = parse
| myrule { TScriptData (tok lexbuf) }
@@
-43,6
+46,7
@@
rule token = parse
| "/" { TScriptData (tok lexbuf) }
| "//" [^ '\n']* { token lexbuf } (* skip SmPL comments *)
| '"' { TScriptData (Printf.sprintf "\"%s\"" (string lexbuf)) }
| "/" { TScriptData (tok lexbuf) }
| "//" [^ '\n']* { token lexbuf } (* skip SmPL comments *)
| '"' { TScriptData (Printf.sprintf "\"%s\"" (string lexbuf)) }
+ | "'" { TScriptData (Printf.sprintf "'%s'" (char lexbuf)) }
| eof { EOF }
| _ { raise (Lexical ("unrecognised symbol, in token rule:"^tok lexbuf)) }
| eof { EOF }
| _ { raise (Lexical ("unrecognised symbol, in token rule:"^tok lexbuf)) }
@@
-51,3
+55,9
@@
and string = parse
| '"' { "" }
| (_ as x) { Common.string_of_char x ^ string lexbuf }
| ("\\" _) as x { x ^ string lexbuf }
| '"' { "" }
| (_ as x) { Common.string_of_char x ^ string lexbuf }
| ("\\" _) as x { x ^ string lexbuf }
+
+and char = parse
+ | (_ as x) "'" { String.make 1 x }
+ | (("\\" (oct | oct oct | oct oct oct)) as x "'") { x }
+ | (("\\x" (hex | hex hex)) as x "'") { x }
+ | (("\\" _ ) as x "'") { x }