2005-03-14 23:57:21 +03:00
|
|
|
%{ /* -*- C -*- */
|
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-23 07:32:36 +04:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2005-03-14 23:57:21 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte_config.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#if HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "orte/mca/rds/hostfile/rds_hostfile_lex.h"
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* local functions
|
|
|
|
*/
|
2006-08-23 07:32:36 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif /* defined(c_plusplus) || defined(__cplusplus) */
|
|
|
|
|
|
|
|
int orte_rds_hostfile_wrap(void);
|
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif /* defined(c_plusplus) || defined(__cplusplus) */
|
|
|
|
|
|
|
|
int orte_rds_hostfile_wrap(void)
|
|
|
|
{
|
|
|
|
orte_rds_hostfile_done = true;
|
|
|
|
return 1;
|
|
|
|
}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* global variables
|
|
|
|
*/
|
|
|
|
int orte_rds_hostfile_line=1;
|
|
|
|
orte_rds_value_t orte_rds_hostfile_value;
|
|
|
|
bool orte_rds_hostfile_done = false;
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
2005-08-02 01:14:09 +04:00
|
|
|
WHITE [\f\t\v ]
|
|
|
|
|
2005-08-02 02:25:47 +04:00
|
|
|
%x comment
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
%%
|
|
|
|
|
2005-08-02 01:14:09 +04:00
|
|
|
{WHITE}*\n { orte_rds_hostfile_line++;
|
|
|
|
return ORTE_RDS_HOSTFILE_NEWLINE; }
|
|
|
|
#.*\n { orte_rds_hostfile_line++;
|
2005-03-14 23:57:21 +03:00
|
|
|
return ORTE_RDS_HOSTFILE_NEWLINE; }
|
2005-08-02 02:11:26 +04:00
|
|
|
"//".*\n { orte_rds_hostfile_line++;
|
|
|
|
return ORTE_RDS_HOSTFILE_NEWLINE; }
|
|
|
|
|
2005-08-02 02:25:47 +04:00
|
|
|
"/*" { BEGIN(comment);
|
|
|
|
return ORTE_RDS_HOSTFILE_NEWLINE; }
|
|
|
|
<comment>[^*\n]* ; /* Eat up non '*'s */
|
|
|
|
<comment>"*"+[^*/\n]* ; /* Eat '*'s not followed by a '/' */
|
|
|
|
<comment>\n { orte_rds_hostfile_line++;
|
|
|
|
return ORTE_RDS_HOSTFILE_NEWLINE; }
|
|
|
|
<comment>"*"+"/" { BEGIN(INITIAL); /* Done with Block Comment */
|
|
|
|
return ORTE_RDS_HOSTFILE_NEWLINE; }
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
\"[^\"]*\" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_QUOTED_STRING; }
|
|
|
|
|
2005-08-02 01:14:09 +04:00
|
|
|
{WHITE}+ ; /* whitespace */
|
2005-03-14 23:57:21 +03:00
|
|
|
|
|
|
|
"=" { return ORTE_RDS_HOSTFILE_EQUAL; }
|
|
|
|
|
|
|
|
cpu { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_CPU; }
|
|
|
|
count { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_COUNT; }
|
|
|
|
slots { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS; }
|
2007-07-14 19:14:07 +04:00
|
|
|
slot { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOT; }
|
2005-03-19 02:40:08 +03:00
|
|
|
"slots-max" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
slots_max { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
"max-slots" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
max_slots { orte_rds_hostfile_value.sval = yytext;
|
2005-03-14 23:57:21 +03:00
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
2005-05-27 21:28:30 +04:00
|
|
|
"cpu-max" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
cpu_max { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
"max-cpu" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
max_cpu { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
"count-max" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
count_max { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
"max-count" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
|
|
|
max_count { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_SLOTS_MAX; }
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2005-09-10 11:57:50 +04:00
|
|
|
username { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_USERNAME; }
|
|
|
|
"user-name" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_USERNAME; }
|
|
|
|
"user_name" { orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_USERNAME; }
|
|
|
|
|
2005-03-14 23:57:21 +03:00
|
|
|
[0-9]+ { orte_rds_hostfile_value.ival = atol(yytext);
|
|
|
|
return ORTE_RDS_HOSTFILE_INT; }
|
2005-09-10 11:57:50 +04:00
|
|
|
%{ /* First detect hosts as standard Strings (but without ".")
|
2007-04-25 10:55:58 +04:00
|
|
|
* then username@IPv4 or IPV4, then username@IPv6 or IPv6,
|
|
|
|
* followed by username@hostname or hostname
|
2005-09-10 11:57:50 +04:00
|
|
|
*/
|
|
|
|
%}
|
2005-03-14 23:57:21 +03:00
|
|
|
|
2007-07-14 19:14:07 +04:00
|
|
|
[A-za-z0-9_\-,:*@]* { orte_rds_hostfile_value.sval = yytext;
|
2005-03-14 23:57:21 +03:00
|
|
|
return ORTE_RDS_HOSTFILE_STRING; }
|
|
|
|
|
2005-09-10 11:57:50 +04:00
|
|
|
([A-Za-z0-9][A-Za-z0-9_\-]*"@")?([0-9]{1,3}"."){3}[0-9]{1,3} {
|
|
|
|
orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_IPV4; }
|
|
|
|
|
2007-04-25 10:55:58 +04:00
|
|
|
([A-Za-z0-9][A-Za-z0-9_\-]*"@")?([A-Fa-f0-9]{0,4}":")+[":"]*([A-Fa-f0-9]{0,4}":")+[A-Fa-f0-9]{1,4} {
|
|
|
|
orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_IPV6; }
|
|
|
|
|
2005-09-10 11:57:50 +04:00
|
|
|
([A-Za-z0-9][A-Za-z0-9_\-]*"@")?[A-Za-z][A-Za-z0-9_\-\.]* {
|
|
|
|
orte_rds_hostfile_value.sval = yytext;
|
|
|
|
return ORTE_RDS_HOSTFILE_HOSTNAME; }
|
|
|
|
|
2005-03-19 02:40:08 +03:00
|
|
|
. { orte_rds_hostfile_value.sval = yytext;
|
2005-03-14 23:57:21 +03:00
|
|
|
return ORTE_RDS_HOSTFILE_ERROR; }
|
|
|
|
|
|
|
|
%%
|