2 open Parser_cocci_menhir
5 exception Lexical of string
6 let tok = Lexing.lexeme
7 let inc_line _ = Lexer_cocci.line := !Lexer_cocci.line + 1
9 (* ---------------------------------------------------------------------- *)
12 let myrule = [^'"''@''/''\n''\r''\011''\012']+
15 | myrule { TScriptData (tok lexbuf) }
16 | ['\n' '\r' '\011' '\012'] { inc_line(); TScriptData (tok lexbuf) }
19 | "/" { TScriptData (tok lexbuf) }
20 | "//" [^ '\n']* { token lexbuf } (* skip SmPL comments *)
21 | '"' { TScriptData (Printf.sprintf "\"%s\"" (string lexbuf)) }
23 | _ { raise (Lexical ("unrecognised symbol, in token rule:"^tok lexbuf)) }
25 (* These are C strings. Perhaps they require some adjustment. *)
28 | (_ as x) { Common.string_of_char x ^ string lexbuf }
29 | ("\\" _) as x { x ^ string lexbuf }