Age | Commit message (Collapse) | Author |
|
|
|
* all non operator and digit tokens are now identifier tokens as this seems more intuitive than generating number token lists containing non-digit values
* renamed lexer-local `level` variable to `nesting` as to avoid confusion between nesting state and predecence levels
|
|
* invalid expressions typically cause the operator and operand stacks to become unbalanced
** this in turn causes a operator_exception instance to be thrown as soon as the shunting yard implementation in "buildTree" tries to modify the stack _too far_
** this is not directly visible from the tree construction implementation
* the compilation unit local helper methods "pop" and "top" now return "boost::optional<Node*>" instances
** this enables the operator placement errors to be handled where they occur
* as a side effect children assignment is now more obvious through correctly named variables
* added missing default initialization in lexer implementation
|
|
* access was restricted by declaring them private and offering member methods such as "hasChildren"
* only OperatorNode instances have children, there is no reason for wasting space by keeping empty pointers around in all other instances
* this enabled the removal of all nullptr comparisons from tree construction
* changed "Tree::addNode" factory method template to return a pointer to the type of the constructed node instance instead of a plain node pointer
|
|
* "doubleToString" converts a string to double, i.e. it should be named "stringToDouble"…
|
|
|
|
* while integer division through zero is obviously a low level error that should be prevented, this operation is well-defined for floating point values as used by SimpleParser
|
|
* member method "addNode" of "Tree" was relieved of its uneccessary "place" argument
* again contified where possible
** e.g. the "buildTree" local element vectors for storing the lexer result
|
|
* as with all Node classes the public member methods of the "Tree" class do not need to be non-const
* both constructors are more easily expressed as aliases of a single constructor that takes both the term and a pointer to a constant map instance
* the tree is now constructed during member initialization
|
|
* there is no reason for exposing them to be potentially linked to from other compilation units
|
|
* marked "solve" and "print" implementations as const
* converted member variables into constants where possible
* "type" member method is not necessary and partially defeats the purpose of declaring virtual members
|
|
* "new" in Tree::addNode member method was replaced with C++14 std::make_unique
* renamed and constified lexer local variables to increase readabilty
** replaced chunky if-clauses with switch-clauses where appropriate
* updated README.md to mention C++14 requirement
|
|
* now using range for-loops during Tree printing
* inroduced popNode helper method which helps to simplify the Tree construction implementation
|
|
|
|
* SimpleParser optionally acceps a pointer to an ConstantMap containing string keys mapping to values
* Constants are handled in their own ConstantNode class derived from the standard Node class
* Operator precedence is now determined separated from the TokenType using a new PrecedenceLevel enum
** Conversion between tokens and their PrecedenceLevel is possible using the new utility function getPrecedence
* Added additional test cases for constant identifier resolutions
|
|
Added ConstantNode blueprint
|
|
* OperatorNode class now uses TokenType for internal operator storage and logic selection
* print-Method resolves the TokenType back into its character representation
|
|
Conflicts:
src/tree.cc
src/utils.cc
|
|
* Made implementation more expressive by replacing the integer priority with an strictly typed enum called TokenType
** Made removal of character comparisons from tree construction and lexer possible
* As a side effect distinct numbers had to be assigned to each token
** Operators of same priority do not have identical numbers anymore
|
|
* New priority for alphabetic characters
* Overloaded OperandNode constructor
* Currently not usable, only basic proof of concept
|
|
* Invalid input syntax led to undefined behavior when accessing the top element of an empty stack
** Fixed by introducing a new "topNodeFrom" function which throws an exeption in the case that the given std::stack reference is empty
|
|
* library is called libSimpleParser.so
* parser was renamed to clc
* test and clc are using the shared library
|
|
* Enabled tree to generate itself
** Main work is now done during tree construction
* Moved lexer and getPriority utility functions into separate compilation unit
|
|
|
|
|
|
to the libary user by providing a new plain "exportTree" function
|
|
priority determination and tree building functions were hidden in
unnamed namespace
|
|
|
|
|