#include <JBLParserResult.h>
Collaboration diagram for JBLParserResult:
This class is used to parse a string that defines a function object, be it an IntFun, a FloatFun, or a BaseCut.
The nomenclature of the various subroutines follows the syntax given in appendix A13 of B.W.KERNIGHAN & D.M.RITCHIE: The C programming language (2nd ed). - London (Prentice Hall) 1988.
Author: Benno List, Jenny List
Changelog:
Definition at line 46 of file JBLParserResult.h.
Public Types | |
typedef Float_FF(* | Fun_f_f )(Float_FF) |
typedef Float_FF(* | Fun_f_f_f )(Float_FF, Float_FF) |
typedef Float_FF(* | Fun_f_f_i )(Float_FF, Float_FF) |
typedef int(* | Fun_i_i )(int) |
typedef bool(* | Fun_b_b )(bool) |
typedef FloatFun &(* | Fun_FF_FF )(const FloatFun &) |
typedef FloatFun &(* | Fun_FF_FF_FF )(const FloatFun &, const FloatFun &) |
typedef FloatFun &(* | Fun_FF_FF_IF )(const FloatFun &, const IntFun &) |
typedef IntFun &(* | Fun_IF_IF )(const IntFun &) |
typedef BaseCut &(* | Fun_BC_BC )(const BaseCut &) |
Public Member Functions | |
JBLParserResult () | |
Default constructor (type EMPTY). | |
JBLParserResult (const JBLParserResult &rhs) | |
Copy Constructor. | |
~JBLParserResult () | |
Destructor. | |
JBLParserResult & | operator= (const JBLParserResult &rhs) |
Assignment operator. | |
bool | isEmpty () const |
Signals whether object is empty. | |
bool | isNumber () const |
Signals whether object is a number (int or float). | |
bool | isInt () const |
Signals whether object is an integer. | |
bool | isFloat () const |
Signals whether object is a float. | |
bool | isBool () const |
Signals whether object is a bool. | |
bool | isIntFun () const |
Signals whether object is an IntFun. | |
bool | isFloatFun () const |
Signals whether object is a FloatFun. | |
bool | isFun () const |
Signals whether object is any function object (IntFun or FloatFun). | |
bool | isBaseCut () const |
Signals whether object is a BaseCut. | |
bool | isIdentifier () const |
Signals whether object is an identifier. | |
int | listlength () const |
Gives back the list of the argument list. | |
const std::string & | getName () const |
Returns the name. | |
int | getIntValue () const |
Returns the integer value (0 if not of type INT). | |
Float_FF | getFloatValue () const |
Returns the Float_FF value (0 if not of type INT or FLOAT). | |
bool | getBoolValue () const |
Returns the bool value (false if not of type BOOL). | |
IntFun * | getIntFunValue () const |
Returns the IntFun value (0 if not of type INT or INTFUN). | |
FloatFun * | getFloatFunValue () const |
Returns the FloatFun value (0 if not of type INT or FLOAT or INTFUN or FLOATFUN). | |
BaseCut * | getBaseCutValue () const |
Returns the BaseCut value (0 if not of type BOOL or BASECUT). | |
std::ostream & | print (std::ostream &os) const |
Print the object's definition. | |
JBLParserResult & | addCopyToList (const JBLParserResult &rhs) |
Add a copy of rhs to the end of the argument list. | |
Static Public Member Functions | |
JBLParserResult | parseExpression (const std::string &input) |
Parses a string expression. | |
JBLParserResult | parseExpression (std::istream &is) |
Parses a string expression. | |
void | initMaps () |
Private Types | |
enum | Type { EMPTY = 0, INT = 1, FLOAT = 2, NUMBER = 3, BOOL = 4, INTFUN = 8, FLOATFUN = 16, FUN = 24, BASECUT = 32, IDENTIFIER = 64 } |
Private Member Functions | |
JBLParserResult (int intvalue_) | |
Constructor from an int (type INT). | |
JBLParserResult (Float_FF floatvalue_) | |
Constructor from a Float_FF (type FLOAT). | |
JBLParserResult (bool boolvalue_) | |
Constructor from a bool (type BOOL). | |
JBLParserResult (IntFun &intfunvalue_) | |
Constructor from an IntFun (type INTFUN). | |
JBLParserResult (FloatFun &floatfunvalue_) | |
Constructor from a FloatFun (type FLOATFUN). | |
JBLParserResult (BaseCut &basecutvalue_) | |
Constructor from a BaseCut (type BASECUT). | |
JBLParserResult (const std::string &name_) | |
Constructor from a string (type IDENTIFIER). | |
Static Private Member Functions | |
JBLParserResult | expression (std::istream &is) |
JBLParserResult | assignment_expression (std::istream &is) |
JBLParserResult | conditional_expression (std::istream &is) |
JBLParserResult | logical_OR_expression (std::istream &is) |
JBLParserResult | logical_AND_expression (std::istream &is) |
JBLParserResult | inclusive_OR_expression (std::istream &is) |
JBLParserResult | exclusive_OR_expression (std::istream &is) |
JBLParserResult | AND_expression (std::istream &is) |
JBLParserResult | equality_expression (std::istream &is) |
JBLParserResult | relational_expression (std::istream &is) |
JBLParserResult | shift_expression (std::istream &is) |
JBLParserResult | additive_expression (std::istream &is) |
JBLParserResult | multiplicative_expression (std::istream &is) |
JBLParserResult | cast_expression (std::istream &is) |
JBLParserResult | unary_expression (std::istream &is) |
JBLParserResult | postfix_expression (std::istream &is) |
JBLParserResult | primary_expression (std::istream &is) |
JBLParserResult | argument_expression_list (std::istream &is) |
JBLParserResult | syntaxError (const std::string &text) |
template<class T1, class T2> JBLParserResult | comparison (int op, const T1 &lhs, const T2 &rhs) |
JBLParserResult | makeoperation (int op, const std::string &opname, JBLParserResult &lhs, JBLParserResult &rhs) |
JBLParserResult | makefloatfunction (const std::string &fname, JBLParserResult &arglist) |
Private Attributes | |
Type | type |
int | intvalue |
Float_FF | floatvalue |
bool | boolvalue |
IntFun * | intfunvalue |
FloatFun * | floatfunvalue |
BaseCut * | basecutvalue |
std::string | name |
JBLParserResult * | next |
Static Private Attributes | |
JBLToken | token |
Related Functions | |
(Note that these are not member functions.) | |
std::istream & | operator>> (std::istream &is, JBLParserResult &result) |
Input a token. |
|
Constructor from an int (type INT).
Definition at line 59 of file JBLParserResult.C. |
|
Constructor from a Float_FF (type FLOAT).
Definition at line 65 of file JBLParserResult.C. |
|
Constructor from a bool (type BOOL).
Definition at line 71 of file JBLParserResult.C. |
|
Constructor from an IntFun (type INTFUN).
Definition at line 77 of file JBLParserResult.C. |
|
Constructor from a FloatFun (type FLOATFUN).
Definition at line 83 of file JBLParserResult.C. |
|
Constructor from a BaseCut (type BASECUT).
Definition at line 89 of file JBLParserResult.C. |
|
Constructor from a string (type IDENTIFIER).
Definition at line 95 of file JBLParserResult.C. |
|
Print the object's definition.
Definition at line 851 of file JBLParserResult.C. References getBaseCutValue(), getBoolValue(), getFloatFunValue(), getFloatValue(), getIntFunValue(), getIntValue(), getName(), NamedO::getName(), isBaseCut(), isBool(), isEmpty(), isFloat(), isFloatFun(), isIdentifier(), isInt(), and isIntFun(). Referenced by operator<<(). |
|
Add a copy of rhs to the end of the argument list.
Definition at line 103 of file JBLParserResult.C. References JBLParserResult(), name, and next. |