let in_iso = !Data.in_iso in
let in_prolog = !Data.in_prolog in
match s with
- "identifier" when in_meta -> check_arity_context_linetype s; TIdentifier
+ "metavariable" when in_meta -> check_arity_context_linetype s; TMetavariable
+ | "identifier" when in_meta -> check_arity_context_linetype s; TIdentifier
| "type" when in_meta -> check_arity_context_linetype s; TType
| "parameter" when in_meta -> check_arity_context_linetype s; TParameter
| "constant" when in_meta -> check_arity_context_linetype s; TConstant
Hashtbl.clear iterator_names;
Hashtbl.clear declarer_names;
let get_name (_,x) = x in
+ Data.add_meta_meta :=
+ (fun name pure ->
+ let fn clt = TMeta(name,pure,clt) in
+ Hashtbl.replace metavariables (get_name name) fn);
Data.add_id_meta :=
(fun name constraints pure ->
let fn clt = TMetaId(name,constraints,pure,clt) in
(function name -> function pure ->
let fn clt = TMetaField(name,pure,clt) in
Hashtbl.replace metavariables (get_name name) fn);
+ Data.add_field_list_meta :=
+ (function name -> function lenname -> function pure ->
+ let fn clt = TMetaFieldList(name,lenname,pure,clt) in
+ Hashtbl.replace metavariables (get_name name) fn);
Data.add_stm_meta :=
(function name -> function pure ->
let fn clt = TMetaStm(name,pure,clt) in
| "//" [^ '\n']* {
match !current_line_type with
(D.PLUS,_,_) | (D.PLUSPLUS,_,_) ->
+ start_line true;
TPragma (Ast.Indent (tok lexbuf), get_current_line_type lexbuf)
| _ -> start_line false; token lexbuf }
+ | "__attribute__" [' ' '\t']* "((" _* "))"
+ { match !current_line_type with
+ (D.PLUS,_,_) | (D.PLUSPLUS,_,_) ->
+ start_line true;
+ TPragma (Ast.Space (tok lexbuf), get_current_line_type lexbuf)
+ | _ -> failwith "attributes only allowedin + code" }
+
| "@@" { start_line true; TArobArob }
| "@" { pass_zero();
if !Data.in_rule_name or not !current_line_started
| "^" { start_line true; TXor(get_current_line_type lexbuf) }
| "##" { start_line true; TCppConcatOp }
+ | (( ("#" [' ' '\t']* "undef" [' ' '\t']+)) as def)
+ ( (letter (letter |digit)*) as ident)
+ { start_line true;
+ let (arity,line,lline,offset,col,strbef,straft,pos) as lt =
+ get_current_line_type lexbuf in
+ let off = String.length def in
+ (* -1 in the code below because the ident is not at the line start *)
+ TUndef
+ (lt,
+ check_var ident
+ (arity,line,lline,offset+off,col+off,[],[],Ast0.NoMetaPos)) }
| (( ("#" [' ' '\t']* "define" [' ' '\t']+)) as def)
( (letter (letter |digit)*) as ident)
{ start_line true;