aboutsummaryrefslogtreecommitdiff
path: root/src/utils.cc
AgeCommit message (Collapse)Author
2015-06-10Changed token determination regarding identifier valuesAdrian Kummerlaender
* 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
2014-10-02Moved exception based syntax check into buildTreeAdrian Kummerlaender
* 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
2014-09-27Removed line breaks from `dot` export and fixed naming errorAdrian Kummerlaender
* "doubleToString" converts a string to double, i.e. it should be named "stringToDouble"…
2014-09-26Replaced array-like accesses with their named member method counterpartsAdrian Kummerlaender
2014-09-16Improved lexer readabilty and replaced raw new in tree constructionAdrian Kummerlaender
* "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
2014-03-04Did some refactoring to improve readabilityAdrian Kummerländer
* now using range for-loops during Tree printing * inroduced popNode helper method which helps to simplify the Tree construction implementation
2013-10-20Implemented constant identifier functionalityAdrian Kummerländer
* 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
2013-10-19Merge branch 'master' into feature_constantsAdrian Kummerländer
Conflicts: src/tree.cc src/utils.cc
2013-10-19Improvement: Replaced "priority" with TokenTypeAdrian Kummerländer
* 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
2013-10-19POC: alphabetic constantsAdrian Kummerländer
* New priority for alphabetic characters * Overloaded OperandNode constructor * Currently not usable, only basic proof of concept
2013-09-26Code restructuring of tree and parsing logicAdrian Kummerländer
* Enabled tree to generate itself ** Main work is now done during tree construction * Moved lexer and getPriority utility functions into separate compilation unit