X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Finput_lexer.ll;h=e4757b9d8181584e48f6f91de150e5b889fb74dd;hp=04b71e832b2f17bd17b17090811d357607541ba5;hb=4a052b6f53406cbb9b78e66c1ff0b46c589aea85;hpb=fa792492f853255f78b3e10c6f727fd10ad45cac diff --git a/ginac/input_lexer.ll b/ginac/input_lexer.ll index 04b71e83..e4757b9d 100644 --- a/ginac/input_lexer.ll +++ b/ginac/input_lexer.ll @@ -4,7 +4,7 @@ * This file must be processed with flex. */ /* - * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,17 +38,14 @@ #include "fail.h" #include "numeric.h" #include "symbol.h" +#include "lst.h" -#ifndef NO_NAMESPACE_GINAC using namespace GiNaC; namespace GiNaC { -#endif // ndef NO_NAMESPACE_GINAC #include "input_parser.h" -#ifndef NO_NAMESPACE_GINAC } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC // Table of all used symbols struct sym_def { @@ -69,7 +66,7 @@ struct sym_def { ex sym; bool predefined; // true = user supplied symbol, false = lexer generated symbol }; -typedef map sym_tab; +typedef std::map sym_tab; static sym_tab syms; // lex input function @@ -105,12 +102,12 @@ Digits ginac_yylval = (long)Digits; return T_DIGITS; "<=" return T_LESSEQ; ">=" return T_GREATEREQ; - /* matrix delimiters */ -\[\[ return T_MATRIX_BEGIN; -\]\] return T_MATRIX_END; - /* numbers */ {D}+ | +"#"{D}+"R"{AN}+ | +"#b"([01])+ | +"#o"[0-7]+ | +"#x"[0-9a-fA-F]+ | {D}+"."{D}*({E})? | {D}*"."{D}+({E})? | {D}+{E} ginac_yylval = numeric(yytext); return T_NUMBER; @@ -121,7 +118,7 @@ Digits ginac_yylval = (long)Digits; return T_DIGITS; if (i == syms.end()) { syms[yytext] = sym_def(ginac_yylval = *(new symbol(yytext)), false); } else - ginac_yylval = i->second.sym; + ginac_yylval = (*i).second.sym; return T_SYMBOL; } @@ -136,7 +133,7 @@ Digits ginac_yylval = (long)Digits; return T_DIGITS; */ // The string from which we will read -static string lexer_string; +static std::string lexer_string; // The current position within the string static int curr_pos = 0; @@ -160,12 +157,10 @@ int ginac_yywrap() return 1; } -#ifndef NO_NAMESPACE_GINAC namespace GiNaC { -#endif // ndef NO_NAMESPACE_GINAC // Set the input string -void set_lexer_string(const string &s) +void set_lexer_string(const std::string &s) { lexer_string = s; curr_pos = 0; @@ -175,24 +170,22 @@ void set_lexer_string(const string &s) void set_lexer_symbols(ex l) { syms.clear(); - if (!is_ex_exactly_of_type(l, lst)) + if (!is_exactly_a(l)) return; - for (int i=0; i(l.op(i))) + syms[ex_to(l.op(i)).get_name()] = sym_def(l.op(i), true); } } // Check whether symbol was predefined bool is_lexer_symbol_predefined(const ex &s) { - sym_tab::const_iterator i = syms.find(ex_to_symbol(s).getname()); + sym_tab::const_iterator i = syms.find(ex_to(s).get_name()); if (i == syms.end()) return false; else - return i->second.predefined; + return (*i).second.predefined; } -#ifndef NO_NAMESPACE_GINAC } // namespace GiNaC -#endif // ndef NO_NAMESPACE_GINAC