mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
#87 : Now floats can be used in requirements and rank expressions. Needs some more testing
git-svn-id: http://svn.opennebula.org/one/trunk@502 3034c82b-c49b-4eb3-8279-a7acafdc01c0
This commit is contained in:
parent
e3fd56fe77
commit
601a13f2e3
@ -401,8 +401,8 @@ static void yy_fatal_error (yyconst char msg[] );
|
||||
*yy_cp = '\0'; \
|
||||
(yy_c_buf_p) = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 7
|
||||
#define YY_END_OF_BUFFER 8
|
||||
#define YY_NUM_RULES 8
|
||||
#define YY_END_OF_BUFFER 9
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
@ -410,10 +410,10 @@ struct yy_trans_info
|
||||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[18] =
|
||||
static yyconst flex_int16_t yy_accept[20] =
|
||||
{ 0,
|
||||
6, 6, 8, 7, 6, 1, 7, 1, 5, 2,
|
||||
6, 0, 3, 5, 2, 4, 0
|
||||
7, 7, 9, 8, 7, 1, 8, 1, 5, 2,
|
||||
7, 0, 3, 5, 0, 2, 4, 6, 0
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
@ -422,16 +422,16 @@ static yyconst flex_int32_t yy_ec[256] =
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 2, 3, 4, 1, 1, 1, 3, 1, 3,
|
||||
3, 3, 3, 1, 5, 1, 3, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 1, 1, 3,
|
||||
3, 3, 1, 1, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
1, 1, 1, 3, 8, 1, 7, 7, 7, 7,
|
||||
3, 3, 3, 1, 5, 6, 3, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 1, 1, 3,
|
||||
3, 3, 1, 1, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
1, 1, 1, 3, 9, 1, 8, 8, 8, 8,
|
||||
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 1, 3, 1, 1, 1, 1, 1, 1,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 1, 3, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
@ -448,41 +448,45 @@ static yyconst flex_int32_t yy_ec[256] =
|
||||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_meta[9] =
|
||||
static yyconst flex_int32_t yy_meta[10] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 2, 2, 2
|
||||
1, 1, 1, 1, 1, 1, 2, 2, 2
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[20] =
|
||||
static yyconst flex_int16_t yy_base[22] =
|
||||
{ 0,
|
||||
0, 0, 19, 20, 16, 20, 13, 10, 9, 0,
|
||||
12, 9, 20, 6, 0, 20, 20, 8, 9
|
||||
0, 0, 22, 23, 19, 23, 16, 12, 4, 0,
|
||||
16, 13, 23, 0, 9, 0, 23, 8, 23, 11,
|
||||
12
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[20] =
|
||||
static yyconst flex_int16_t yy_def[22] =
|
||||
{ 0,
|
||||
17, 1, 17, 17, 17, 17, 18, 17, 17, 19,
|
||||
17, 18, 17, 17, 19, 17, 0, 17, 17
|
||||
19, 1, 19, 19, 19, 19, 20, 19, 19, 21,
|
||||
19, 20, 19, 9, 19, 21, 19, 19, 0, 19,
|
||||
19
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[29] =
|
||||
static yyconst flex_int16_t yy_nxt[33] =
|
||||
{ 0,
|
||||
4, 5, 6, 7, 8, 9, 10, 4, 12, 12,
|
||||
15, 14, 16, 11, 14, 14, 13, 11, 17, 3,
|
||||
17, 17, 17, 17, 17, 17, 17, 17
|
||||
4, 5, 6, 7, 8, 4, 9, 10, 4, 15,
|
||||
14, 12, 12, 16, 18, 18, 17, 11, 14, 13,
|
||||
11, 19, 3, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[29] =
|
||||
static yyconst flex_int16_t yy_chk[33] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 18, 18,
|
||||
19, 14, 12, 11, 9, 8, 7, 5, 3, 17,
|
||||
17, 17, 17, 17, 17, 17, 17, 17
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 9,
|
||||
9, 20, 20, 21, 18, 15, 12, 11, 8, 7,
|
||||
5, 3, 19, 19, 19, 19, 19, 19, 19, 19,
|
||||
19, 19
|
||||
} ;
|
||||
|
||||
/* Table of booleans, true if rule could match eol. */
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[8] =
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[9] =
|
||||
{ 0,
|
||||
0, 0, 0, 1, 0, 0, 0, };
|
||||
0, 0, 0, 1, 0, 0, 0, 0, };
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
static char *yy_last_accepting_cpos;
|
||||
@ -529,7 +533,7 @@ char *host_text;
|
||||
#define YY_USER_ACTION llocp->first_line = host_lineno; \
|
||||
llocp->first_column = llocp->last_column; \
|
||||
llocp->last_column += host_leng;
|
||||
#line 533 "host_parser.c"
|
||||
#line 537 "host_parser.c"
|
||||
|
||||
#define INITIAL 0
|
||||
|
||||
@ -718,7 +722,7 @@ YY_DECL
|
||||
|
||||
/* --- Tokens --- */
|
||||
|
||||
#line 722 "host_parser.c"
|
||||
#line 726 "host_parser.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
@ -771,13 +775,13 @@ yy_match:
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 18 )
|
||||
if ( yy_current_state >= 20 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_base[yy_current_state] != 20 );
|
||||
while ( yy_base[yy_current_state] != 23 );
|
||||
|
||||
yy_find_action:
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
@ -837,25 +841,31 @@ YY_RULE_SETUP
|
||||
lvalp->val_str[host_leng-2] = '\0';
|
||||
return STRING;}
|
||||
YY_BREAK
|
||||
/* --- Integers --- */
|
||||
/* --- Numbers --- */
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 57 "host_parser.l"
|
||||
{ lvalp->val_int = atoi(host_text);
|
||||
return INTEGER;}
|
||||
{ lvalp->val_int = atoi(host_text);
|
||||
return INTEGER;}
|
||||
YY_BREAK
|
||||
/* --- blanks --- */
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 61 "host_parser.l"
|
||||
|
||||
#line 60 "host_parser.l"
|
||||
{ lvalp->val_float = atof(host_text);
|
||||
return FLOAT;}
|
||||
YY_BREAK
|
||||
/* --- blanks --- */
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 63 "host_parser.l"
|
||||
#line 64 "host_parser.l"
|
||||
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 66 "host_parser.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 859 "host_parser.c"
|
||||
#line 869 "host_parser.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
@ -1147,7 +1157,7 @@ static int yy_get_next_buffer (void)
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 18 )
|
||||
if ( yy_current_state >= 20 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
@ -1175,11 +1185,11 @@ static int yy_get_next_buffer (void)
|
||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 18 )
|
||||
if ( yy_current_state >= 20 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 17);
|
||||
yy_is_jam = (yy_current_state == 19);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
@ -1824,7 +1834,7 @@ void host_free (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 63 "host_parser.l"
|
||||
#line 66 "host_parser.l"
|
||||
|
||||
|
||||
|
||||
|
@ -52,10 +52,13 @@
|
||||
\"[^\"]*\" { lvalp->val_str = strdup(yytext+1);
|
||||
lvalp->val_str[yyleng-2] = '\0';
|
||||
return STRING;}
|
||||
/* --- Integers --- */
|
||||
|
||||
-?[0-9]+ { lvalp->val_int = atoi(yytext);
|
||||
return INTEGER;}
|
||||
/* --- Numbers --- */
|
||||
|
||||
-?[0-9]+ { lvalp->val_int = atoi(yytext);
|
||||
return INTEGER;}
|
||||
|
||||
-?[0-9]+\.[0-9]+ { lvalp->val_float = atof(yytext);
|
||||
return FLOAT;}
|
||||
/* --- blanks --- */
|
||||
|
||||
[[:blank:]]*
|
||||
|
@ -75,12 +75,14 @@
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
INTEGER = 258,
|
||||
STRING = 259
|
||||
STRING = 259,
|
||||
FLOAT = 260
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define INTEGER 258
|
||||
#define STRING 259
|
||||
#define FLOAT 260
|
||||
|
||||
|
||||
|
||||
@ -144,9 +146,10 @@ typedef union YYSTYPE
|
||||
{
|
||||
char * val_str;
|
||||
int val_int;
|
||||
float val_float;
|
||||
}
|
||||
/* Line 187 of yacc.c. */
|
||||
#line 150 "host_rank.cc"
|
||||
#line 153 "host_rank.cc"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
@ -171,7 +174,7 @@ typedef struct YYLTYPE
|
||||
|
||||
|
||||
/* Line 216 of yacc.c. */
|
||||
#line 175 "host_rank.cc"
|
||||
#line 178 "host_rank.cc"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
@ -386,22 +389,22 @@ union yyalloc
|
||||
#endif
|
||||
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 9
|
||||
#define YYFINAL 10
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 24
|
||||
#define YYLAST 25
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 11
|
||||
#define YYNTOKENS 12
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 3
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 11
|
||||
#define YYNRULES 12
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES 19
|
||||
#define YYNSTATES 20
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYUNDEFTOK 2
|
||||
#define YYMAXUTOK 259
|
||||
#define YYMAXUTOK 260
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
@ -413,7 +416,7 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
9, 10, 5, 3, 2, 4, 2, 6, 2, 2,
|
||||
10, 11, 5, 3, 2, 4, 2, 6, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -434,7 +437,8 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 1, 2, 7, 8
|
||||
2, 2, 2, 2, 2, 2, 1, 2, 7, 8,
|
||||
9
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
@ -442,24 +446,24 @@ static const yytype_uint8 yytranslate[] =
|
||||
YYRHS. */
|
||||
static const yytype_uint8 yyprhs[] =
|
||||
{
|
||||
0, 0, 3, 5, 6, 8, 10, 14, 18, 22,
|
||||
26, 29
|
||||
0, 0, 3, 5, 6, 8, 10, 12, 16, 20,
|
||||
24, 28, 31
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const yytype_int8 yyrhs[] =
|
||||
{
|
||||
12, 0, -1, 13, -1, -1, 8, -1, 7, -1,
|
||||
13, 3, 13, -1, 13, 4, 13, -1, 13, 5,
|
||||
13, -1, 13, 6, 13, -1, 4, 13, -1, 9,
|
||||
13, 10, -1
|
||||
13, 0, -1, 14, -1, -1, 8, -1, 9, -1,
|
||||
7, -1, 14, 3, 14, -1, 14, 4, 14, -1,
|
||||
14, 5, 14, -1, 14, 6, 14, -1, 4, 14,
|
||||
-1, 10, 14, 11, -1
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 74, 74, 75, 78, 82, 83, 84, 85, 86,
|
||||
87, 88
|
||||
0, 77, 77, 78, 81, 85, 86, 87, 88, 89,
|
||||
90, 91, 92
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -469,7 +473,7 @@ static const yytype_uint8 yyrline[] =
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
"$end", "error", "$undefined", "'+'", "'-'", "'*'", "'/'", "INTEGER",
|
||||
"STRING", "'('", "')'", "$accept", "stmt", "expr", 0
|
||||
"STRING", "FLOAT", "'('", "')'", "$accept", "stmt", "expr", 0
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -478,23 +482,23 @@ static const char *const yytname[] =
|
||||
token YYLEX-NUM. */
|
||||
static const yytype_uint16 yytoknum[] =
|
||||
{
|
||||
0, 256, 257, 43, 45, 42, 47, 258, 259, 40,
|
||||
41
|
||||
0, 256, 257, 43, 45, 42, 47, 258, 259, 260,
|
||||
40, 41
|
||||
};
|
||||
# endif
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_uint8 yyr1[] =
|
||||
{
|
||||
0, 11, 12, 12, 13, 13, 13, 13, 13, 13,
|
||||
13, 13
|
||||
0, 12, 13, 13, 14, 14, 14, 14, 14, 14,
|
||||
14, 14, 14
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const yytype_uint8 yyr2[] =
|
||||
{
|
||||
0, 2, 1, 0, 1, 1, 3, 3, 3, 3,
|
||||
2, 3
|
||||
0, 2, 1, 0, 1, 1, 1, 3, 3, 3,
|
||||
3, 2, 3
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
|
||||
@ -502,29 +506,29 @@ static const yytype_uint8 yyr2[] =
|
||||
means the default is an error. */
|
||||
static const yytype_uint8 yydefact[] =
|
||||
{
|
||||
3, 0, 5, 4, 0, 0, 2, 10, 0, 1,
|
||||
0, 0, 0, 0, 11, 6, 7, 8, 9
|
||||
3, 0, 6, 4, 5, 0, 0, 2, 11, 0,
|
||||
1, 0, 0, 0, 0, 12, 7, 8, 9, 10
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yydefgoto[] =
|
||||
{
|
||||
-1, 5, 6
|
||||
-1, 6, 7
|
||||
};
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
#define YYPACT_NINF -4
|
||||
#define YYPACT_NINF -5
|
||||
static const yytype_int8 yypact[] =
|
||||
{
|
||||
-3, -3, -4, -4, -3, 17, 18, 2, 10, -4,
|
||||
-3, -3, -3, -3, -4, 2, 2, -4, -4
|
||||
11, 11, -5, -5, -5, 11, 5, 19, -4, 3,
|
||||
-5, 11, 11, 11, 11, -5, -4, -4, -5, -5
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-4, -4, -1
|
||||
-5, -5, -1
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
@ -534,24 +538,24 @@ static const yytype_int8 yypgoto[] =
|
||||
#define YYTABLE_NINF -1
|
||||
static const yytype_uint8 yytable[] =
|
||||
{
|
||||
7, 1, 0, 8, 2, 3, 4, 12, 13, 15,
|
||||
16, 17, 18, 10, 11, 12, 13, 9, 0, 0,
|
||||
14, 10, 11, 12, 13
|
||||
8, 13, 14, 0, 9, 10, 11, 12, 13, 14,
|
||||
16, 17, 18, 19, 15, 1, 0, 0, 2, 3,
|
||||
4, 5, 11, 12, 13, 14
|
||||
};
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
1, 4, -1, 4, 7, 8, 9, 5, 6, 10,
|
||||
11, 12, 13, 3, 4, 5, 6, 0, -1, -1,
|
||||
10, 3, 4, 5, 6
|
||||
1, 5, 6, -1, 5, 0, 3, 4, 5, 6,
|
||||
11, 12, 13, 14, 11, 4, -1, -1, 7, 8,
|
||||
9, 10, 3, 4, 5, 6
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
static const yytype_uint8 yystos[] =
|
||||
{
|
||||
0, 4, 7, 8, 9, 12, 13, 13, 13, 0,
|
||||
3, 4, 5, 6, 10, 13, 13, 13, 13
|
||||
0, 4, 7, 8, 9, 10, 13, 14, 14, 14,
|
||||
0, 3, 4, 5, 6, 11, 14, 14, 14, 14
|
||||
};
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
@ -1408,61 +1412,66 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 2:
|
||||
#line 74 "host_rank.y"
|
||||
{ result=(yyvsp[(1) - (1)].val_int);;}
|
||||
#line 77 "host_rank.y"
|
||||
{ result = static_cast<int>((yyvsp[(1) - (1)].val_float));;}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
#line 75 "host_rank.y"
|
||||
{ result=0;;}
|
||||
#line 78 "host_rank.y"
|
||||
{ result = 0; ;}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#line 78 "host_rank.y"
|
||||
{ int val;
|
||||
host->get_template_attribute((yyvsp[(1) - (1)].val_str),val);
|
||||
(yyval.val_int) = val;
|
||||
free((yyvsp[(1) - (1)].val_str));;}
|
||||
#line 81 "host_rank.y"
|
||||
{ string val;
|
||||
host->get_template_attribute((yyvsp[(1) - (1)].val_str),val);
|
||||
(yyval.val_float) = val.empty() ? 0.0 : atof(val.c_str());
|
||||
free((yyvsp[(1) - (1)].val_str)); ;}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
#line 82 "host_rank.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (1)].val_int);;}
|
||||
#line 85 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (1)].val_float); ;}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
#line 83 "host_rank.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) + (yyvsp[(3) - (3)].val_int);;}
|
||||
#line 86 "host_rank.y"
|
||||
{ (yyval.val_float) = static_cast<float>((yyvsp[(1) - (1)].val_int)); ;}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
#line 84 "host_rank.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) - (yyvsp[(3) - (3)].val_int);;}
|
||||
#line 87 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
#line 85 "host_rank.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) * (yyvsp[(3) - (3)].val_int);;}
|
||||
#line 88 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
#line 86 "host_rank.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) / (yyvsp[(3) - (3)].val_int);;}
|
||||
#line 89 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
#line 87 "host_rank.y"
|
||||
{ (yyval.val_int) = - (yyvsp[(2) - (2)].val_int);;}
|
||||
#line 90 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
#line 88 "host_rank.y"
|
||||
{ (yyval.val_int) = (yyvsp[(2) - (3)].val_int);;}
|
||||
#line 91 "host_rank.y"
|
||||
{ (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);;}
|
||||
break;
|
||||
|
||||
case 12:
|
||||
#line 92 "host_rank.y"
|
||||
{ (yyval.val_float) = (yyvsp[(2) - (3)].val_float);;}
|
||||
break;
|
||||
|
||||
|
||||
/* Line 1267 of yacc.c. */
|
||||
#line 1466 "host_rank.cc"
|
||||
#line 1475 "host_rank.cc"
|
||||
default: break;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
@ -1682,7 +1691,7 @@ yyreturn:
|
||||
}
|
||||
|
||||
|
||||
#line 91 "host_rank.y"
|
||||
#line 95 "host_rank.y"
|
||||
|
||||
|
||||
extern "C" void host_rank_error(
|
||||
|
@ -40,12 +40,14 @@
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
INTEGER = 258,
|
||||
STRING = 259
|
||||
STRING = 259,
|
||||
FLOAT = 260
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define INTEGER 258
|
||||
#define STRING 259
|
||||
#define FLOAT 260
|
||||
|
||||
|
||||
|
||||
@ -56,9 +58,10 @@ typedef union YYSTYPE
|
||||
{
|
||||
char * val_str;
|
||||
int val_int;
|
||||
float val_float;
|
||||
}
|
||||
/* Line 1489 of yacc.c. */
|
||||
#line 62 "host_rank.hh"
|
||||
#line 65 "host_rank.hh"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
@ -55,6 +55,7 @@ int host_rank_parse(Host * host, int& result, char ** errmsg);
|
||||
%union {
|
||||
char * val_str;
|
||||
int val_int;
|
||||
float val_float;
|
||||
};
|
||||
|
||||
%defines
|
||||
@ -67,19 +68,22 @@ int host_rank_parse(Host * host, int& result, char ** errmsg);
|
||||
%left '*' '/'
|
||||
%token <val_int> INTEGER
|
||||
%token <val_str> STRING
|
||||
%type <val_int> stmt expr
|
||||
%token <val_float> FLOAT
|
||||
%type <val_int> stmt
|
||||
%type <val_float> expr
|
||||
|
||||
%%
|
||||
|
||||
stmt: expr { result=$1;}
|
||||
| { result=0;} /* TRUE BY DEFAULT, ON EMPTY STRINGS */
|
||||
stmt: expr { result = static_cast<int>($1);}
|
||||
| { result = 0; }
|
||||
;
|
||||
|
||||
expr: STRING { int val;
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val;
|
||||
free($1);}
|
||||
| INTEGER { $$ = $1;}
|
||||
expr: STRING { string val;
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val.empty() ? 0.0 : atof(val.c_str());
|
||||
free($1); }
|
||||
| FLOAT { $$ = $1; }
|
||||
| INTEGER { $$ = static_cast<float>($1); }
|
||||
| expr '+' expr { $$ = $1 + $3;}
|
||||
| expr '-' expr { $$ = $1 - $3;}
|
||||
| expr '*' expr { $$ = $1 * $3;}
|
||||
|
@ -75,12 +75,14 @@
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
INTEGER = 258,
|
||||
STRING = 259
|
||||
STRING = 259,
|
||||
FLOAT = 260
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define INTEGER 258
|
||||
#define STRING 259
|
||||
#define FLOAT 260
|
||||
|
||||
|
||||
|
||||
@ -144,9 +146,10 @@ typedef union YYSTYPE
|
||||
{
|
||||
char * val_str;
|
||||
int val_int;
|
||||
float val_float;
|
||||
}
|
||||
/* Line 187 of yacc.c. */
|
||||
#line 150 "host_requirements.cc"
|
||||
#line 153 "host_requirements.cc"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
@ -171,7 +174,7 @@ typedef struct YYLTYPE
|
||||
|
||||
|
||||
/* Line 216 of yacc.c. */
|
||||
#line 175 "host_requirements.cc"
|
||||
#line 178 "host_requirements.cc"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
@ -388,20 +391,20 @@ union yyalloc
|
||||
/* YYFINAL -- State number of the termination state. */
|
||||
#define YYFINAL 12
|
||||
/* YYLAST -- Last index in YYTABLE. */
|
||||
#define YYLAST 24
|
||||
#define YYLAST 29
|
||||
|
||||
/* YYNTOKENS -- Number of terminals. */
|
||||
#define YYNTOKENS 13
|
||||
#define YYNTOKENS 14
|
||||
/* YYNNTS -- Number of nonterminals. */
|
||||
#define YYNNTS 3
|
||||
/* YYNRULES -- Number of rules. */
|
||||
#define YYNRULES 13
|
||||
#define YYNRULES 17
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES 25
|
||||
#define YYNSTATES 29
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYUNDEFTOK 2
|
||||
#define YYMAXUTOK 259
|
||||
#define YYMAXUTOK 260
|
||||
|
||||
#define YYTRANSLATE(YYX) \
|
||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||
@ -413,9 +416,9 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 3, 2, 2, 2, 2, 4, 2,
|
||||
11, 12, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
12, 13, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
10, 8, 9, 2, 2, 2, 2, 2, 2, 2,
|
||||
11, 9, 10, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
@ -434,7 +437,8 @@ static const yytype_uint8 yytranslate[] =
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 1, 2, 6, 7
|
||||
2, 2, 2, 2, 2, 2, 1, 2, 6, 7,
|
||||
8
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
@ -443,24 +447,26 @@ static const yytype_uint8 yytranslate[] =
|
||||
static const yytype_uint8 yyprhs[] =
|
||||
{
|
||||
0, 0, 3, 5, 6, 10, 15, 19, 23, 27,
|
||||
32, 36, 40, 43
|
||||
32, 36, 40, 44, 49, 53, 57, 60
|
||||
};
|
||||
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
static const yytype_int8 yyrhs[] =
|
||||
{
|
||||
14, 0, -1, 15, -1, -1, 7, 8, 6, -1,
|
||||
7, 3, 8, 6, -1, 7, 9, 6, -1, 7,
|
||||
10, 6, -1, 7, 8, 7, -1, 7, 3, 8,
|
||||
7, -1, 15, 4, 15, -1, 15, 5, 15, -1,
|
||||
3, 15, -1, 11, 15, 12, -1
|
||||
15, 0, -1, 16, -1, -1, 7, 9, 6, -1,
|
||||
7, 3, 9, 6, -1, 7, 10, 6, -1, 7,
|
||||
11, 6, -1, 7, 9, 8, -1, 7, 3, 9,
|
||||
8, -1, 7, 10, 8, -1, 7, 11, 8, -1,
|
||||
7, 9, 7, -1, 7, 3, 9, 7, -1, 16,
|
||||
4, 16, -1, 16, 5, 16, -1, 3, 16, -1,
|
||||
12, 16, 13, -1
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint8 yyrline[] =
|
||||
{
|
||||
0, 73, 73, 74, 77, 85, 93, 101, 109, 126,
|
||||
143, 144, 145, 146
|
||||
0, 75, 75, 76, 79, 86, 93, 100, 107, 114,
|
||||
121, 128, 135, 143, 151, 152, 153, 154
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -470,7 +476,7 @@ static const yytype_uint8 yyrline[] =
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
"$end", "error", "$undefined", "'!'", "'&'", "'|'", "INTEGER", "STRING",
|
||||
"'='", "'>'", "'<'", "'('", "')'", "$accept", "stmt", "expr", 0
|
||||
"FLOAT", "'='", "'>'", "'<'", "'('", "')'", "$accept", "stmt", "expr", 0
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -479,23 +485,23 @@ static const char *const yytname[] =
|
||||
token YYLEX-NUM. */
|
||||
static const yytype_uint16 yytoknum[] =
|
||||
{
|
||||
0, 256, 257, 33, 38, 124, 258, 259, 61, 62,
|
||||
60, 40, 41
|
||||
0, 256, 257, 33, 38, 124, 258, 259, 260, 61,
|
||||
62, 60, 40, 41
|
||||
};
|
||||
# endif
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_uint8 yyr1[] =
|
||||
{
|
||||
0, 13, 14, 14, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15
|
||||
0, 14, 15, 15, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const yytype_uint8 yyr2[] =
|
||||
{
|
||||
0, 2, 1, 0, 3, 4, 3, 3, 3, 4,
|
||||
3, 3, 2, 3
|
||||
3, 3, 3, 4, 3, 3, 2, 3
|
||||
};
|
||||
|
||||
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
|
||||
@ -503,9 +509,9 @@ static const yytype_uint8 yyr2[] =
|
||||
means the default is an error. */
|
||||
static const yytype_uint8 yydefact[] =
|
||||
{
|
||||
3, 0, 0, 0, 0, 2, 12, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0, 4, 8, 6, 7,
|
||||
13, 10, 11, 5, 9
|
||||
3, 0, 0, 0, 0, 2, 16, 0, 0, 0,
|
||||
0, 0, 1, 0, 0, 0, 4, 12, 8, 6,
|
||||
10, 7, 11, 17, 14, 15, 5, 13, 9
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
@ -516,18 +522,18 @@ static const yytype_int8 yydefgoto[] =
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
#define YYPACT_NINF -4
|
||||
#define YYPACT_NINF -6
|
||||
static const yytype_int8 yypact[] =
|
||||
{
|
||||
-2, -2, 7, -2, 8, 14, -4, 3, -3, 17,
|
||||
18, 2, -4, -2, -2, 15, -4, -4, -4, -4,
|
||||
-4, -4, -4, -4, -4
|
||||
-2, -2, 8, -2, 3, 4, -6, -5, 14, 20,
|
||||
21, 2, -6, -2, -2, 17, -6, -6, -6, -6,
|
||||
-6, -6, -6, -6, -6, -6, -6, -6, -6
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int8 yypgoto[] =
|
||||
{
|
||||
-4, -4, -1
|
||||
-6, -6, -1
|
||||
};
|
||||
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
@ -537,25 +543,25 @@ static const yytype_int8 yypgoto[] =
|
||||
#define YYTABLE_NINF -1
|
||||
static const yytype_uint8 yytable[] =
|
||||
{
|
||||
6, 1, 11, 16, 17, 2, 13, 14, 12, 3,
|
||||
7, 15, 21, 22, 20, 8, 9, 10, 13, 14,
|
||||
0, 23, 24, 18, 19
|
||||
6, 1, 11, 12, 15, 2, 13, 14, 13, 14,
|
||||
3, 7, 24, 25, 0, 23, 0, 8, 9, 10,
|
||||
16, 17, 18, 26, 27, 28, 19, 21, 20, 22
|
||||
};
|
||||
|
||||
static const yytype_int8 yycheck[] =
|
||||
{
|
||||
1, 3, 3, 6, 7, 7, 4, 5, 0, 11,
|
||||
3, 8, 13, 14, 12, 8, 9, 10, 4, 5,
|
||||
-1, 6, 7, 6, 6
|
||||
1, 3, 3, 0, 9, 7, 4, 5, 4, 5,
|
||||
12, 3, 13, 14, -1, 13, -1, 9, 10, 11,
|
||||
6, 7, 8, 6, 7, 8, 6, 6, 8, 8
|
||||
};
|
||||
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
static const yytype_uint8 yystos[] =
|
||||
{
|
||||
0, 3, 7, 11, 14, 15, 15, 3, 8, 9,
|
||||
10, 15, 0, 4, 5, 8, 6, 7, 6, 6,
|
||||
12, 15, 15, 6, 7
|
||||
0, 3, 7, 12, 15, 16, 16, 3, 9, 10,
|
||||
11, 16, 0, 4, 5, 9, 6, 7, 8, 6,
|
||||
8, 6, 8, 13, 16, 16, 6, 7, 8
|
||||
};
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
@ -1412,122 +1418,140 @@ yyreduce:
|
||||
switch (yyn)
|
||||
{
|
||||
case 2:
|
||||
#line 73 "host_requirements.y"
|
||||
#line 75 "host_requirements.y"
|
||||
{ result=(yyvsp[(1) - (1)].val_int); ;}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
#line 74 "host_requirements.y"
|
||||
#line 76 "host_requirements.y"
|
||||
{ result=true; ;}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#line 77 "host_requirements.y"
|
||||
{
|
||||
int val;
|
||||
#line 79 "host_requirements.y"
|
||||
{ int val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val == (yyvsp[(3) - (3)].val_int);
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val == (yyvsp[(3) - (3)].val_int);
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
#line 85 "host_requirements.y"
|
||||
{
|
||||
int val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (4)].val_str),val);
|
||||
(yyval.val_int) = val != (yyvsp[(4) - (4)].val_int);
|
||||
|
||||
free((yyvsp[(1) - (4)].val_str));;}
|
||||
#line 86 "host_requirements.y"
|
||||
{ int val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (4)].val_str),val);
|
||||
(yyval.val_int) = val != (yyvsp[(4) - (4)].val_int);
|
||||
|
||||
free((yyvsp[(1) - (4)].val_str));;}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
#line 93 "host_requirements.y"
|
||||
{
|
||||
int val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val > (yyvsp[(3) - (3)].val_int);
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
{ int val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val > (yyvsp[(3) - (3)].val_int);
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
break;
|
||||
|
||||
case 7:
|
||||
#line 101 "host_requirements.y"
|
||||
{
|
||||
int val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val < (yyvsp[(3) - (3)].val_int);
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
#line 100 "host_requirements.y"
|
||||
{ int val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val < (yyvsp[(3) - (3)].val_int);
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
#line 109 "host_requirements.y"
|
||||
{
|
||||
string val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
|
||||
if (val == "")
|
||||
{
|
||||
(yyval.val_int) = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
(yyval.val_int) = fnmatch((yyvsp[(3) - (3)].val_str), val.c_str(), 0) == 0;
|
||||
}
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));
|
||||
free((yyvsp[(3) - (3)].val_str));;}
|
||||
#line 107 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val.empty() ? false : atof(val.c_str()) == (yyvsp[(3) - (3)].val_float);
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
#line 126 "host_requirements.y"
|
||||
{
|
||||
string val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (4)].val_str),val);
|
||||
|
||||
if (val == "")
|
||||
{
|
||||
(yyval.val_int) = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
(yyval.val_int) = fnmatch((yyvsp[(4) - (4)].val_str), val.c_str(), 0) != 0;
|
||||
}
|
||||
|
||||
free((yyvsp[(1) - (4)].val_str));
|
||||
free((yyvsp[(4) - (4)].val_str));;}
|
||||
#line 114 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (4)].val_str),val);
|
||||
(yyval.val_int) = val.empty() ? false : atof(val.c_str()) != (yyvsp[(4) - (4)].val_float);
|
||||
|
||||
free((yyvsp[(1) - (4)].val_str));;}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
#line 143 "host_requirements.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); ;}
|
||||
#line 121 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val.empty() ? false : atof(val.c_str()) > (yyvsp[(3) - (3)].val_float);
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
#line 144 "host_requirements.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); ;}
|
||||
#line 128 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val.empty() ? false : atof(val.c_str()) < (yyvsp[(3) - (3)].val_float);
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));;}
|
||||
break;
|
||||
|
||||
case 12:
|
||||
#line 145 "host_requirements.y"
|
||||
{ (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); ;}
|
||||
#line 135 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (3)].val_str),val);
|
||||
(yyval.val_int) = val.empty() ? false :fnmatch((yyvsp[(3) - (3)].val_str), val.c_str(), 0) == 0;
|
||||
|
||||
free((yyvsp[(1) - (3)].val_str));
|
||||
free((yyvsp[(3) - (3)].val_str));;}
|
||||
break;
|
||||
|
||||
case 13:
|
||||
#line 146 "host_requirements.y"
|
||||
#line 143 "host_requirements.y"
|
||||
{ string val;
|
||||
|
||||
host->get_template_attribute((yyvsp[(1) - (4)].val_str),val);
|
||||
(yyval.val_int) = val.empty() ? false : fnmatch((yyvsp[(4) - (4)].val_str), val.c_str(), 0) != 0;
|
||||
|
||||
free((yyvsp[(1) - (4)].val_str));
|
||||
free((yyvsp[(4) - (4)].val_str));;}
|
||||
break;
|
||||
|
||||
case 14:
|
||||
#line 151 "host_requirements.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); ;}
|
||||
break;
|
||||
|
||||
case 15:
|
||||
#line 152 "host_requirements.y"
|
||||
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); ;}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
#line 153 "host_requirements.y"
|
||||
{ (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); ;}
|
||||
break;
|
||||
|
||||
case 17:
|
||||
#line 154 "host_requirements.y"
|
||||
{ (yyval.val_int) = (yyvsp[(2) - (3)].val_int); ;}
|
||||
break;
|
||||
|
||||
|
||||
/* Line 1267 of yacc.c. */
|
||||
#line 1531 "host_requirements.cc"
|
||||
#line 1555 "host_requirements.cc"
|
||||
default: break;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
@ -1747,7 +1771,7 @@ yyreturn:
|
||||
}
|
||||
|
||||
|
||||
#line 149 "host_requirements.y"
|
||||
#line 157 "host_requirements.y"
|
||||
|
||||
|
||||
extern "C" void host_requirements_error(
|
||||
|
@ -40,12 +40,14 @@
|
||||
know about them. */
|
||||
enum yytokentype {
|
||||
INTEGER = 258,
|
||||
STRING = 259
|
||||
STRING = 259,
|
||||
FLOAT = 260
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define INTEGER 258
|
||||
#define STRING 259
|
||||
#define FLOAT 260
|
||||
|
||||
|
||||
|
||||
@ -56,9 +58,10 @@ typedef union YYSTYPE
|
||||
{
|
||||
char * val_str;
|
||||
int val_int;
|
||||
float val_float;
|
||||
}
|
||||
/* Line 1489 of yacc.c. */
|
||||
#line 62 "host_requirements.hh"
|
||||
#line 65 "host_requirements.hh"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
@ -55,6 +55,7 @@ int host_requirements_parse(Host * host, bool& result, char ** errmsg);
|
||||
%union {
|
||||
char * val_str;
|
||||
int val_int;
|
||||
float val_float;
|
||||
};
|
||||
|
||||
%defines
|
||||
@ -66,79 +67,86 @@ int host_requirements_parse(Host * host, bool& result, char ** errmsg);
|
||||
%left '!' '&' '|'
|
||||
%token <val_int> INTEGER
|
||||
%token <val_str> STRING
|
||||
%token <val_float> FLOAT
|
||||
%type <val_int> stmt expr
|
||||
|
||||
%%
|
||||
|
||||
stmt: expr { result=$1; }
|
||||
| { result=true; } /* TRUE BY DEFAULT, ON EMPTY STRINGS */
|
||||
stmt: expr { result=$1; }
|
||||
| { result=true; } /* TRUE BY DEFAULT, ON EMPTY STRINGS */
|
||||
;
|
||||
|
||||
expr: STRING '=' INTEGER {
|
||||
int val;
|
||||
expr: STRING '=' INTEGER { int val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val == $3;
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val == $3;
|
||||
|
||||
free($1);}
|
||||
free($1);}
|
||||
|
||||
| STRING '!' '=' INTEGER {
|
||||
int val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val != $4;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '>' INTEGER {
|
||||
int val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val > $3;
|
||||
|
||||
free($1);}
|
||||
| STRING '!' '=' INTEGER { int val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val != $4;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '>' INTEGER { int val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val > $3;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '<' INTEGER {
|
||||
int val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val < $3;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '=' STRING {
|
||||
string val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
|
||||
if (val == "")
|
||||
{
|
||||
$$ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = fnmatch($3, val.c_str(), 0) == 0;
|
||||
}
|
||||
|
||||
free($1);
|
||||
free($3);}
|
||||
| STRING '<' INTEGER { int val;
|
||||
|
||||
| STRING '!''=' STRING {
|
||||
string val;
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val < $3;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '=' FLOAT { string val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val.empty() ? false : atof(val.c_str()) == $3;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '!' '=' FLOAT { string val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val.empty() ? false : atof(val.c_str()) != $4;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '>' FLOAT { string val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val.empty() ? false : atof(val.c_str()) > $3;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '<' FLOAT { string val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val.empty() ? false : atof(val.c_str()) < $3;
|
||||
|
||||
free($1);}
|
||||
|
||||
| STRING '=' STRING { string val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val.empty() ? false :fnmatch($3, val.c_str(), 0) == 0;
|
||||
|
||||
free($1);
|
||||
free($3);}
|
||||
|
||||
| STRING '!''=' STRING { string val;
|
||||
|
||||
host->get_template_attribute($1,val);
|
||||
|
||||
if (val == "")
|
||||
{
|
||||
$$ = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = fnmatch($4, val.c_str(), 0) != 0;
|
||||
}
|
||||
|
||||
free($1);
|
||||
free($4);}
|
||||
host->get_template_attribute($1,val);
|
||||
$$ = val.empty() ? false : fnmatch($4, val.c_str(), 0) != 0;
|
||||
|
||||
free($1);
|
||||
free($4);}
|
||||
|
||||
| expr '&' expr { $$ = $1 && $3; }
|
||||
| expr '|' expr { $$ = $1 || $3; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user