Commit | Line | Data |
---|---|---|
34e49164 C |
1 | { |
2 | open Parser_cocci_menhir | |
3 | module D = Data | |
4 | module Ast = Ast_cocci | |
5 | exception Lexical of string | |
6 | let tok = Lexing.lexeme | |
7 | } | |
8 | (* ---------------------------------------------------------------------- *) | |
9 | (* tokens *) | |
10 | ||
002099fc | 11 | let myrule = [^'"''@']+ |
34e49164 C |
12 | |
13 | rule token = parse | |
14 | | myrule { TScriptData (tok lexbuf) } | |
15 | | "@@" { TArobArob } | |
16 | | "@" { TArob } | |
002099fc C |
17 | | "//" [^ '\n']* { token lexbuf } (* skip SmPL comments *) |
18 | | '"' { TScriptData (Printf.sprintf "\"%s\"" (string lexbuf)) } | |
34e49164 C |
19 | | eof { EOF } |
20 | | _ { raise (Lexical ("unrecognised symbol, in token rule:"^tok lexbuf)) } | |
21 | ||
002099fc C |
22 | (* These are C strings. Perhaps they require some adjustment. *) |
23 | and string = parse | |
24 | | '"' { "" } | |
25 | | (_ as x) { Common.string_of_char x ^ string lexbuf } | |
26 | | ("\\" _) as x { x ^ string lexbuf } |