~ubuntu-branches/ubuntu/maverick/coccinelle/maverick

« back to all changes in this revision

Viewing changes to parsing_cocci/lexer_cocci.mll

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2009-08-10 01:01:24 UTC
  • mfrom: (7.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090810010124-9fn4c8m93ic60fqx
Tags: 0.1.9.deb-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/control: build-depend on python2.6-dev,
    set XB-Python-Version to 2.6
* New upstream (Debian) packaging applied fix for
  LP: #410907 (see changelog entry below)

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
  let s = tok lexbuf in
180
180
  let linetype = get_current_line_type lexbuf in
181
181
  let in_rule_name = !Data.in_rule_name in
182
 
  let in_meta = !Data.in_meta in
 
182
  let in_meta = !Data.in_meta && not !Data.saw_struct in
183
183
  let in_iso = !Data.in_iso in
184
184
  let in_prolog = !Data.in_prolog in
185
185
  match s with
222
222
  | "on" when in_rule_name      -> check_context_linetype s; TOn
223
223
  | "ever" when in_rule_name    -> check_context_linetype s; TEver
224
224
  | "never" when in_rule_name   -> check_context_linetype s; TNever
 
225
  (* exists and forall for when are reparsed in parse_cocci.ml *)
225
226
  | "exists" when in_rule_name  -> check_context_linetype s; TExists
226
227
  | "forall" when in_rule_name  -> check_context_linetype s; TForall
227
 
  | "reverse" when in_rule_name -> check_context_linetype s; TReverse
228
228
  | "script" when in_rule_name  -> check_context_linetype s; TScript
229
229
  | "initialize" when in_rule_name -> check_context_linetype s; TInitialize
230
230
  | "finalize" when in_rule_name   -> check_context_linetype s; TFinalize
236
236
  | "float" ->      Tfloat    linetype
237
237
  | "long" ->       Tlong     linetype
238
238
  | "void" ->       Tvoid     linetype
239
 
  | "struct" ->     Tstruct   linetype
240
 
  | "union" ->      Tunion    linetype
241
 
  | "enum" ->       Tenum     linetype
 
239
  (* in_meta is only for the first keyword; drop it now to allow any type
 
240
     name *)
 
241
  | "struct" ->     Data.saw_struct := true; Tstruct   linetype
 
242
  | "union" ->      Data.saw_struct := true; Tunion    linetype
 
243
  | "enum" ->       Data.saw_struct := true; Tenum     linetype
242
244
  | "unsigned" ->   Tunsigned linetype
243
245
  | "signed" ->     Tsigned   linetype
244
246
 
291
293
  Data.in_rule_name := false;
292
294
  Data.in_meta := false;
293
295
  Data.in_prolog := false;
 
296
  Data.saw_struct := false;
294
297
  Data.inheritable_positions := [];
295
298
  Hashtbl.clear all_metavariables;
296
299
  Hashtbl.clear Data.all_metadecls;
593
596
  | "&"            { start_line true; TAnd    (get_current_line_type lexbuf) }
594
597
  | "^"            { start_line true; TXor(get_current_line_type lexbuf) }
595
598
 
 
599
  | "##"            { start_line true; TCppConcatOp }
596
600
  | (( ("#" [' ' '\t']*  "define" [' ' '\t']+)) as def)
597
601
    ( (letter (letter |digit)*) as ident)
598
602
      { start_line true;