Commit Graph
9 Commits
Author SHA1 Message Date
Jason Orendorff 0c50ad4197 Add passing RegEx tests. 2013-10-26 23:56:40 -07:00
Jason Orendorff 9336193aaf Allow RegEx matches of length 0. This seems more correct to me. (However, this is not super important in practice. Grammar files should not contain regular expressions that could match the empty string; if such a RegEx matched 0 characters once, it would match again and again forever, since it wouldn't consume any input.) 2013-10-26 23:52:54 -07:00
Jason Orendorff d2d38e2516 Fix what looks like an off-by-one error in RegEx::longestMatch()'s lastMatch calculation, and a corresponding +1 in code using longestMatch, and add a test. 2013-10-26 23:48:02 -07:00
Jason Orendorff 7859b29725 Fix a minor bug in the lexer (it would not match the last character of the input) and add Lexer tests. 2013-10-26 23:13:15 -07:00
Jason Orendorff 83af1b1c5a Use std::string::substr() instead of adding one character at a time. This patch also removes a few unused util functions that are easily written using substr(). 2013-10-25 02:42:12 -07:00
Jason Orendorff 727529fe0b Remove one unnecessary backslash-check in StringReader::getTokens(). (This patch looks like it's removing the last backslash-counting loop, but really it removes the first one and then reindents everything.) 2013-10-25 02:32:39 -07:00
Jason Orendorff 64a405cab1 Replace some code in StringReader::getTokens() with std::string::find_first_of(). Since this makes found_pos unsigned, a few comparisons involving found_pos must be adjusted (unsigned integers are always >= 0). 2013-10-25 02:26:31 -07:00
Jason Orendorff a18b4f41a7 Add tests for parsing quoted strings. 2013-10-25 02:17:02 -07:00
Jason Orendorff 08baae465a Add unit tests for StringReader. You can run them with ./kraken --test. 2013-10-25 02:04:22 -07:00