2011-10-10 22:13:04 +04:00
|
|
|
%option nounput
|
2013-12-14 04:36:12 +04:00
|
|
|
%option noinput
|
2011-10-10 22:13:04 +04:00
|
|
|
|
2004-09-05 20:05:37 +04:00
|
|
|
%{ /* -*- C -*- */
|
2004-11-22 03:37:56 +03:00
|
|
|
/*
|
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 04:29:35 +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.
|
2004-11-28 23:09:25 +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.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-11-22 03:37:56 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
2004-09-05 20:05:37 +04:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal_config.h"
|
2004-09-05 20:05:37 +04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2008-09-05 16:44:19 +04:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2004-09-05 20:05:37 +04:00
|
|
|
#include <unistd.h>
|
2004-10-26 18:11:44 +04:00
|
|
|
#endif
|
2004-09-05 20:05:37 +04:00
|
|
|
|
2005-07-04 06:38:44 +04:00
|
|
|
#include "opal/util/show_help_lex.h"
|
2004-09-05 20:05:37 +04:00
|
|
|
|
2009-08-20 15:42:18 +04:00
|
|
|
BEGIN_C_DECLS
|
2006-08-23 04:29:35 +04:00
|
|
|
|
2004-09-05 20:05:37 +04:00
|
|
|
/*
|
|
|
|
* public functions
|
|
|
|
*/
|
2006-08-23 04:29:35 +04:00
|
|
|
extern int opal_show_help_finish_parsing(void);
|
2004-09-05 20:05:37 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* local functions
|
|
|
|
*/
|
2006-08-23 04:29:35 +04:00
|
|
|
static int opal_show_help_yywrap(void);
|
|
|
|
|
2009-08-20 15:42:18 +04:00
|
|
|
END_C_DECLS
|
2004-09-05 20:05:37 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* global variables
|
|
|
|
*/
|
2005-07-04 06:38:44 +04:00
|
|
|
int opal_show_help_yynewlines = 1;
|
|
|
|
bool opal_show_help_parse_done = false;
|
2004-09-05 20:05:37 +04:00
|
|
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
WHITE [\f\t\v ]
|
|
|
|
CHAR [A-Za-z0-9_\-\.]
|
|
|
|
|
|
|
|
%x CHOMP
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
#.*\n ; /* comment line */
|
|
|
|
|
2012-02-21 17:29:58 +04:00
|
|
|
^\[.+\]/[^\]\n]*\n { BEGIN(CHOMP); return OPAL_SHOW_HELP_PARSE_TOPIC; }
|
2004-09-05 20:05:37 +04:00
|
|
|
|
|
|
|
<CHOMP>.*\n { BEGIN(INITIAL); }
|
|
|
|
|
2005-07-04 06:38:44 +04:00
|
|
|
.*/\n { BEGIN(CHOMP); return OPAL_SHOW_HELP_PARSE_MESSAGE; }
|
2004-09-05 20:05:37 +04:00
|
|
|
|
|
|
|
%%
|
|
|
|
|
2012-12-07 04:12:43 +04:00
|
|
|
/* Old flex (2.5.4a? and older) does not define a destroy function */
|
|
|
|
#if !defined(YY_FLEX_SUBMINOR_VERSION)
|
|
|
|
#define YY_FLEX_SUBMINOR_VERSION 0
|
|
|
|
#endif
|
2004-09-05 20:05:37 +04:00
|
|
|
|
2012-12-07 04:12:43 +04:00
|
|
|
#if (YY_FLEX_MAJOR_VERSION < 2) || (YY_FLEX_MAJOR_VERSION == 2 && (YY_FLEX_MINOR_VERSION < 5 || (YY_FLEX_MINOR_VERSION == 5 && YY_FLEX_SUBMINOR_VERSION < 5)))
|
|
|
|
int opal_show_help_yylex_destroy(void)
|
2004-09-05 20:05:37 +04:00
|
|
|
{
|
|
|
|
if (NULL != YY_CURRENT_BUFFER) {
|
|
|
|
yy_delete_buffer(YY_CURRENT_BUFFER);
|
2004-09-16 13:14:01 +04:00
|
|
|
#if defined(YY_CURRENT_BUFFER_LVALUE)
|
2004-09-16 12:48:31 +04:00
|
|
|
YY_CURRENT_BUFFER_LVALUE = NULL;
|
2004-09-16 13:14:01 +04:00
|
|
|
#else
|
|
|
|
YY_CURRENT_BUFFER = NULL;
|
|
|
|
#endif /* YY_CURRENT_BUFFER_LVALUE */
|
2004-09-05 20:05:37 +04:00
|
|
|
}
|
|
|
|
return YY_NULL;
|
|
|
|
}
|
2012-12-07 04:12:43 +04:00
|
|
|
#endif
|
2004-10-16 01:38:42 +04:00
|
|
|
|
2005-07-04 06:38:44 +04:00
|
|
|
static int opal_show_help_yywrap(void)
|
2004-09-05 20:05:37 +04:00
|
|
|
{
|
2005-07-04 06:38:44 +04:00
|
|
|
opal_show_help_parse_done = true;
|
2004-09-05 20:05:37 +04:00
|
|
|
return 1;
|
|
|
|
}
|
2004-10-16 01:38:42 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure that we have a valid yybuffer to use. Specifically, if this
|
|
|
|
* scanner is invoked a second time, finish_parsing() (above) will
|
|
|
|
* have been executed, and the current buffer will have been freed.
|
|
|
|
* Flex doesn't recognize this fact because as far as it's concerned,
|
|
|
|
* its internal state was already initialized, so it thinks it should
|
|
|
|
* have a valid buffer. Hence, here we ensure to give it a valid
|
|
|
|
* buffer.
|
|
|
|
*/
|
2005-07-04 06:38:44 +04:00
|
|
|
int opal_show_help_init_buffer(FILE *file)
|
2004-10-16 01:38:42 +04:00
|
|
|
{
|
|
|
|
YY_BUFFER_STATE buf = yy_create_buffer(file, YY_BUF_SIZE);
|
|
|
|
yy_switch_to_buffer(buf);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|