summaryrefslogtreecommitdiff
path: root/mtxlanguage.cc
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-01-23 18:44:16 +0100
committerRichard Braun <rbraun@sceen.net>2017-01-23 18:44:16 +0100
commitd6d8afda9e32501063cee907b20507d4762a3bc0 (patch)
treeb7ce0e4ebb80318279f3e59d6ea8252d81743d55 /mtxlanguage.cc
parent0335271456550084988c5484bd1109a0a846669b (diff)
Minor updateHEADmaster
- Fix errors with modern compilers (gcc, clang) - Upgrade gtkmm dependency - Add a test.mtx file - Build with 64-bits words by default
Diffstat (limited to 'mtxlanguage.cc')
-rw-r--r--mtxlanguage.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/mtxlanguage.cc b/mtxlanguage.cc
index 623db7c..4055159 100644
--- a/mtxlanguage.cc
+++ b/mtxlanguage.cc
@@ -18,10 +18,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <string>
-#include <vector>
-#include <ctype.h>
#include <algorithm>
+#include <cstring>
+#include <ctype.h>
+#include <vector>
#include "mtx.h"
#include "mtxsymbol.h"
@@ -34,7 +34,7 @@
using namespace std;
-char *MtxLanguage::lexical_groups[] =
+const char *MtxLanguage::lexical_groups[] =
{
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.",
"=+-*/", "(", ")", "[", "]", ",", ";",
@@ -48,13 +48,13 @@ MtxLanguage::MtxLanguage()
size_t
MtxLanguage::findGroup(char c) const
{
- char *ptr;
+ const char *ptr;
size_t i;
i = 0;
while (lexical_groups[i] != NULL
- && (ptr = strchr(lexical_groups[i], c)) == NULL)
+ && (ptr = std::strchr(lexical_groups[i], c)) == NULL)
i++;
if (lexical_groups[i] == NULL)
@@ -95,7 +95,7 @@ MtxLanguage::checkLexicalElement(const string &lexical_element) const
mtx_expression_t
MtxLanguage::parseLexicalElements(const string &expression) const
{
- size_t i, str_length, prev_group, group;
+ size_t i, str_length, prev_group = 0, group;
mtx_expression_t lexical_elements;
string lexical_element;
bool prev_set;