diff --git a/infer/src/llvm/lLexer.mll b/infer/src/llvm/lLexer.mll index 4ea44ec69..2ad880d0e 100644 --- a/infer/src/llvm/lLexer.mll +++ b/infer/src/llvm/lLexer.mll @@ -29,6 +29,9 @@ let id_special_char = ['-' '$' '.' '_'] let id_char = lower | upper | id_special_char let id = id_char (id_char | digit)* +(* definition of attribute group - not used for now *) +let attribute_junk = "attributes" [^ '\n']* + rule token = parse | space | comment { token lexbuf } | newline { token lexbuf } @@ -158,4 +161,8 @@ rule token = parse | '%' (nonneg_int as i) { NUMBERED_LOCAL (int_of_string i) } | id as str { IDENT str } + (* attribute groups *) + | '#' (nonneg_int as i) { ATTRIBUTE_GROUP (int_of_string i) } + | attribute_junk { token lexbuf } + | eof { EOF } diff --git a/infer/src/llvm/lParser.mly b/infer/src/llvm/lParser.mly index 6362f9446..bb09ac13c 100644 --- a/infer/src/llvm/lParser.mly +++ b/infer/src/llvm/lParser.mly @@ -132,6 +132,8 @@ %token NUMBERED_LOCAL %token IDENT +%token ATTRIBUTE_GROUP + %token EOF %start prog @@ -146,8 +148,11 @@ prog: | defs = list(func_def) EOF { Prog defs } func_def: - | DEFINE ret_tp = ret_typ name = variable LPAREN params = separated_list(COMMA, pair(typ, IDENT)) RPAREN instrs = block { - FuncDef (name, ret_tp, params, instrs) } + | DEFINE ret_tp = ret_typ name = variable LPAREN params = + separated_list(COMMA, pair(typ, IDENT)) RPAREN list(attribute_group) instrs = block { FuncDef (name, ret_tp, params, instrs) } + +attribute_group: + | i = ATTRIBUTE_GROUP { i } ret_typ: | VOID { None }