File indexing completed on 2024-12-22 04:17:54

0001 /***************************************************************************
0002                                eparse-eh.cpp
0003                              -------------------
0004     begin                : Nov. 24, 2004
0005     copyright            : (C) 2004 The University of Toronto
0006     email                : netterfield@astro.utoronto.ca
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #include <QString>
0019 #include <QStringList>
0020 
0021 
0022 #include "kstmath_export.h"
0023 #include "objectstore.h"
0024 
0025 namespace Equations {
0026   KSTMATH_EXPORT QStringList errorStack;
0027 }
0028 
0029 /*extern "C"*/ const char *EParseErrorEmpty = "Equations is empty.";
0030 /*extern "C"*/ const char *EParseErrorEmptyArg = "Function argument is empty.";
0031 /*extern "C"*/ const char *EParseErrorTwoOperands = "Two operands are required.";
0032 /*extern "C"*/ const char *EParseErrorEmptyParentheses = "Empty parentheses are forbidden except in function calls.";
0033 /*extern "C"*/ const char *EParseErrorMissingClosingParenthesis = "Closing parenthesis is missing.";
0034 /*extern "C"*/ const char *EParseErrorNoImplicitMultiply = "Term must be followed by an operator.  Implicit multiplication is not supported.";
0035 /*extern "C"*/ const char *EParseErrorRequiresOperand = "This operator requires an operand.";
0036 /*extern "C"*/ const char *EParseErrorToken = "Unknown character '%1'.";
0037 
0038 
0039 /*extern "C"*/ void yyClearErrors() {
0040   Equations::errorStack.clear();
0041 }
0042 
0043 
0044 /*extern "C"*/ int yyErrorCount() {
0045   return Equations::errorStack.count();
0046 }
0047 
0048 
0049 /*extern "C"*/ void yyerror(Kst::ObjectStore *store, const char *s) {
0050   Q_UNUSED(store)
0051   Equations::errorStack << s;
0052 }
0053 
0054 /*extern "C"*/ void yyerrortoken(char c) {
0055   Equations::errorStack << QString(EParseErrorToken).arg(c);
0056 }
0057 
0058 // vim: ts=2 sw=2 et