X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fparser%2Fparse_context.h;h=1145a871cb4b2da67a95373d44ea0812ab2567a5;hp=efcb6c620f309f0413f9f4e1279164eb4eda1c09;hb=866b3eb23253a272788d8791b1ed023e63674d50;hpb=80b1c3e0ee0e465d56e5c76bef4e52ef2dbc5197 diff --git a/ginac/parser/parse_context.h b/ginac/parser/parse_context.h index efcb6c62..1145a871 100644 --- a/ginac/parser/parse_context.h +++ b/ginac/parser/parse_context.h @@ -1,14 +1,37 @@ -#ifndef _GINAC_PARSE_CONTEXT_HPP -#define _GINAC_PARSE_CONTEXT_HPP -#include -#include // size_t +/** @file parse_context.h + * + * Interface to parser context. */ + +/* + * GiNaC Copyright (C) 1999-2010 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef GINAC_PARSE_CONTEXT_H +#define GINAC_PARSE_CONTEXT_H + #include "ex.h" #include "symbol.h" + +#include // for size_t #include +#include #include -namespace GiNaC -{ +namespace GiNaC { /** * Establishes correspondence between the strings and expressions. @@ -18,12 +41,12 @@ namespace GiNaC typedef std::map symtab; /** - * Find the symbol with the @a name in the symbol table @a syms. + * Find the symbol (or abbreviation) with the @a name in the symbol table @a syms. * * If symbol is missing and @a strict = false, insert it, otherwise * throw an exception. */ -extern symbol +extern ex find_or_insert_symbol(const std::string& name, symtab& syms, const bool strict); @@ -59,17 +82,27 @@ typedef ex (*reader_func)(const exvector& args); * number of arguments. * 3. User can extend the parser via custom prototype tables. It's possible * to read user defined classes, create abbreviations, etc. + * + * NOTE: due to a hack that allows user defined functions to be parsed, the map + * value of type reader_func is internally treated as an unsigned and not as a + * function pointer!! The unsigned has to correspond to the serial number of + * the defined GiNaC function. */ typedef std::map prototype_table; /** * Default prototype table. * - * It supports most of builtin GiNaC functions. + * It supports all defined GiNaC functions and "pow", "sqrt", and "power". */ extern const prototype_table& get_default_reader(); +/** + * Builtin prototype table. + * + * It supports only the builtin GiNaC functions and "pow", "sqrt", and "power". + */ +extern const prototype_table& get_builtin_reader(); -} - -#endif // _GINAC_PARSE_CONTEXT_HPP +} // namespace GiNaC +#endif // GINAC_PARSE_CONTEXT_H