/usr/include/scilab/parser.hxx is in scilab-include 6.0.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
*
* Copyright (C) 2012 - 2016 - Scilab Enterprises
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
* This file was originally licensed under the terms of the CeCILL v2.1,
* and continues to be available under such terms.
* For more information, see the COPYING file which you should have received
* along with this program.
*
*/
#ifndef __PARSER_HXX__
#define __PARSER_HXX__
#include <cstdio>
#include <iostream>
#include <string>
#include <stdlib.h>
#include "parse.hxx"
extern "C"
{
#include "charEncoding.h"
#include "sci_malloc.h"
#include "dynlib_ast.h"
}
class EXTERN_AST Parser
{
public:
Parser() :
_strict_mode(false),
_parse_trace(false),
_exit_status(Succeded),
_control_status(AllControlClosed),
_the_program(NULL)
{
}
~Parser()
{
// Do not delete Tree here.
}
public:
enum ParserStatus
{
Succeded ,
Failed
};
public:
enum ControlStatus
{
AllControlClosed,
WithinFor,
WithinWhile,
WithinIf,
WithinElse,
WithinElseIf,
WithinTry,
WithinCatch,
WithinFunction,
WithinSelect,
WithinSwitch,
WithinCase,
WithinOtherwise,
WithinMatrix,
WithinCell,
WithinBlockComment,
WithinDots
};
public:
/** \brief cleanup parser internal buffers */
static void cleanup();
/** \brief parse the given file name */
void parseFile(const std::wstring& name, const std::wstring& progName);
/** \brief parse the given file command */
void parse(const char *command);
void parse(const wchar_t *command);
/** \brief enable Bison trace mode */
void setParseTrace(bool parseTrace)
{
_parse_trace = parseTrace;
}
bool getParseTrace(void)
{
return _parse_trace;
}
/** Setters / Getters
\{ */
ast::Exp* getTree(void)
{
return _the_program;
}
void setTree(ast::Exp* theProgram)
{
_the_program = theProgram;
}
ParserStatus getExitStatus(void)
{
return _exit_status;
}
void setExitStatus(ParserStatus exit_status)
{
_exit_status = exit_status;
}
ControlStatus getControlStatus(void)
{
return _control_status;
}
void setControlStatus(ControlStatus controlStatus)
{
_control_status = controlStatus;
}
wchar_t *getErrorMessage(void)
{
return const_cast<wchar_t *>(_error_message.c_str());
}
void setErrorMessage(const std::wstring& errorMessage)
{
_error_message = errorMessage;
}
void enableStrictMode(void)
{
_strict_mode = true;
}
void disableStrictMode(void)
{
_strict_mode = false;
}
void releaseTmpFile();
bool stopOnFirstError(void);
void enableStopOnFirstError(void);
void disableStopOnFirstError(void);
/** \} */
private :
const std::wstring _file_name;
const std::wstring _prog_name;
std::wstring _error_message;
bool _strict_mode;
bool _parse_trace;
ParserStatus _exit_status;
ControlStatus _control_status;
ast::Exp* _the_program;
};
#endif /* !__PARSER_HXX__ */
|