%{
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* FMA Event Injector language parser
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <inj.h>
#include <inj_err.h>
#include <inj_event.h>
#include <inj_hash.h>
#include <inj_lex.h>
%}
%union {
char *l_string;
}
%%
;
| defn
| command {
if ($1 != NULL)
inj_cmds_add($1);
}
;
/*
* Event, FMRI, Authority, and list declarations
*/
if ($4 != NULL)
}
if ($4 != NULL)
}
if ($4 != NULL)
}
if ($4 != NULL)
}
;
if ($2 == NULL) {
$$ = $1;
} else if ($1 == NULL) {
$$ = inj_decl_create($2);
} else {
$$ = $1;
}
}
;
if ($1 != NULL)
$$ = $1;
}
;
;
}
;
| INJ_TOK_INT16 { $$ = MEMTYPE_INT16; }
| INJ_TOK_INT32 { $$ = MEMTYPE_INT32; }
| INJ_TOK_INT64 { $$ = MEMTYPE_INT64; }
| INJ_TOK_UINT8 { $$ = MEMTYPE_UINT8; }
| INJ_TOK_UINT16 { $$ = MEMTYPE_UINT16; }
| INJ_TOK_UINT32 { $$ = MEMTYPE_UINT32; }
| INJ_TOK_UINT64 { $$ = MEMTYPE_UINT64; }
| INJ_TOK_BOOLEAN { $$ = MEMTYPE_BOOL; }
| INJ_TOK_STRING { $$ = MEMTYPE_STRING; }
;
$$ = $2;
}
| '[' ']' {
$$ = 0;
}
;
}
}
}
}
}
;
$$ = inj_zalloc(sizeof (inj_hash_t));
inj_strhash_create($$);
}
else
$$ = $1;
}
;
/*
* Event, FMRI, Authority, and list definitions
*/
inj_strfree($2);
}
inj_strfree($2);
}
inj_strfree($2);
}
;
$$ = inj_defn_create($1);
}
$$ = $1;
}
;
}
}
}
}
}
;
}
| INJ_TOK_IDENT {
}
| INJ_TOK_QSTRING {
}
;
/*
* Commands
*/
| INJ_TOK_ENDHRT { $$ = inj_cmd_endhrt(); }
}
;
}
}
;
}
;
}
;
inj_defn_t *ev;
NULL) {
$$ = NULL;
} else
$$ = ev;
}
yyerror("invalid number");
$$ = 0;
} else
}
yyerror("invalid time");
$$ = 0;
} else
$$ = val;
}
%%
inj_program_read(const char *file)
{
yyinname = "stdin";
} else {
yyinname++;
else
}
yyreset();
(void) yyparse();
if (yynerrors != 0) {
}
return (inj_cmds_get());
}