Thursday, April 4, 2013

Comparing RPN Lists With Errors

RPN lists may also contains errors and this needs to be taken into account when comparing RPN lists.  The RpnList compare operator function was modified for this by first checking if one list has an error and the other does not.  If both has errors, the column and the length of the error token is compared along with the error message.  If both lists do not have errors, it proceeds as before comparing the lists.

[commit d810bba51f]

Comparing RPN Lists

Eventually, the program model will hold the program lines in an internal incrementally compiled format the will be ready to run.  To detect when a line has changed, either the new line needs to be fully encoded into this internal format, the internal line needs to be converted (recreated) back into text, or both need to be converted to an intermediate comparable format.

I'm not sure at this moment which is best, but recreating the internal line back into text will not work because the recreated lines will not necessarily match the original lines.  For example, the line "C=3" and "C = 3" don't match as text, but the internal lines are identical.  Therefore, using text to compare is not an option unless the new line is compiled and then recreated (which is wasteful).

For now, the RPN lists will be compared.  This required comparison operator functions (for the == and != operators) to be implemented for the Token, RpnItem and RpnList classes.  Only the == operator function was fully implemented, with the != operator implemented as the opposite of the == operator.  The program line string list member of the program model was moved since it is no longer needed (second commit).

[commit f33bb20df2] [commit 3a2317910c]