LibreOffice Module starmath (master) 1
|
Minimalistic recursive decent SmNodeList parser. More...
#include <cursor.hxx>
Public Member Functions | |
SmNodeListParser () | |
Create an instance of SmNodeListParser. More... | |
SmNode * | Parse (SmNodeList *list) |
Parse a list of nodes to an expression. More... | |
Static Public Member Functions | |
static bool | IsOperator (const SmToken &token) |
True, if the token is an operator. More... | |
static bool | IsRelationOperator (const SmToken &token) |
True, if the token is a relation operator. More... | |
static bool | IsSumOperator (const SmToken &token) |
True, if the token is a sum operator. More... | |
static bool | IsProductOperator (const SmToken &token) |
True, if the token is a product operator. More... | |
static bool | IsUnaryOperator (const SmToken &token) |
True, if the token is a unary operator. More... | |
static bool | IsPostfixOperator (const SmToken &token) |
True, if the token is a postfix operator. More... | |
Private Member Functions | |
SmNode * | Terminal () |
Get the current terminal. More... | |
SmNode * | Next () |
Move to next terminal. More... | |
SmNode * | Take () |
Take the current terminal. More... | |
SmNode * | Expression () |
SmNode * | Relation () |
SmNode * | Sum () |
SmNode * | Product () |
SmNode * | Factor () |
SmNode * | Postfix () |
Static Private Member Functions | |
static SmNode * | Error () |
Private Attributes | |
SmNodeList * | pList |
Minimalistic recursive decent SmNodeList parser.
This parser is used to take a list of nodes that constitutes a line and parse them to a tree of SmBinHorNode, SmUnHorNode and SmExpression.
Please note, this will not handle all kinds of nodes, only nodes that constitutes and entry in a line.
Below is an EBNF representation of the grammar used for this parser:
Definition at line 376 of file cursor.hxx.
|
inline |
Create an instance of SmNodeListParser.
Definition at line 380 of file cursor.hxx.
References pList.
|
staticprivate |
Definition at line 1539 of file cursor.cxx.
|
private |
Definition at line 1435 of file cursor.cxx.
References Relation(), SmStructureNode::SetSubNodes(), and Terminal().
Referenced by Parse().
|
private |
Definition at line 1498 of file cursor.cxx.
References Error(), Factor(), IsUnaryOperator(), Next(), Postfix(), SmStructureNode::SetSubNodes(), and Terminal().
|
static |
True, if the token is an operator.
Definition at line 1543 of file cursor.cxx.
References IsPostfixOperator(), IsProductOperator(), IsRelationOperator(), IsSumOperator(), and IsUnaryOperator().
Referenced by SmCursor::PatchLineList(), and Postfix().
|
static |
True, if the token is a postfix operator.
Definition at line 1578 of file cursor.cxx.
References SmToken::eType, and TFACT.
Referenced by IsOperator(), and Postfix().
|
static |
True, if the token is a product operator.
Definition at line 1559 of file cursor.cxx.
References SmToken::eType, SmToken::nGroup, Product, TOVER, TOVERBRACE, TUNDERBRACE, TWIDEBACKSLASH, and TWIDESLASH.
Referenced by IsOperator(), and Product().
|
static |
True, if the token is a relation operator.
Definition at line 1551 of file cursor.cxx.
References SmToken::nGroup, and Relation.
Referenced by IsOperator(), and Relation().
|
static |
True, if the token is a sum operator.
Definition at line 1555 of file cursor.cxx.
References SmToken::nGroup, and Sum.
Referenced by IsOperator(), and Sum().
|
static |
True, if the token is a unary operator.
Definition at line 1568 of file cursor.cxx.
References SmToken::eType, SmToken::nGroup, TMINUS, TMINUSPLUS, TNEG, TPLUS, TPLUSMINUS, TUOPER, and UnOper.
Referenced by Factor(), and IsOperator().
|
inlineprivate |
SmNode * SmNodeListParser::Parse | ( | SmNodeList * | list | ) |
Parse a list of nodes to an expression.
Old error nodes will be deleted.
Definition at line 1418 of file cursor.cxx.
References Error, Expression(), and pList.
Referenced by SmCursor::DeletePrev(), and SmCursor::InsertSubSup().
|
private |
Definition at line 1520 of file cursor.cxx.
References Error(), IsOperator(), IsPostfixOperator(), Take(), and Terminal().
Referenced by Factor().
|
private |
Definition at line 1481 of file cursor.cxx.
References Factor(), IsProductOperator(), Take(), and Terminal().
Referenced by Sum().
|
private |
Definition at line 1447 of file cursor.cxx.
References IsRelationOperator(), Sum(), Take(), and Terminal().
Referenced by Expression().
|
private |
Definition at line 1464 of file cursor.cxx.
References IsSumOperator(), Product(), Take(), and Terminal().
Referenced by Relation().
|
inlineprivate |
Take the current terminal.
Definition at line 415 of file cursor.hxx.
References Next(), and Terminal().
Referenced by Postfix(), Product(), Relation(), and Sum().
|
inlineprivate |
Get the current terminal.
Definition at line 402 of file cursor.hxx.
References pList.
Referenced by Expression(), Factor(), Next(), Postfix(), Product(), Relation(), Sum(), and Take().
|
private |
Definition at line 400 of file cursor.hxx.
Referenced by Next(), Parse(), SmNodeListParser(), and Terminal().