Commit Graph

20 Commits

Author SHA1 Message Date
Maurice Makaay 9a53ea9012 Working on API speed. 2019-07-19 14:44:44 +00:00
Maurice Makaay 5904da9677 Added some package docs. 2019-06-18 22:52:17 +00:00
Maurice Makaay 75373e5ed5 Big simplification run once more, cleaned up code, added tests and examples, made stuff unexported where possible, to slim down the exported interface. 2019-06-04 23:15:02 +00:00
Maurice Makaay 4580962fb8 Backup a load of work on typed token support, making it easy to produce tokens directly from parser/combinator-based parsing rules. 2019-06-04 00:03:08 +00:00
Maurice Makaay d31d09abf0 Added crude loop protection to the parser, which should prevent parsers running in circles (happened to me a few times too). 2019-05-28 23:01:23 +00:00
Maurice Makaay 2d851103e5 Cleanup of stuff that I don't need anymore, because it has been fully deprecated. Also added some tests for panic() calls in parsekit, which brings test coverage to 100%. It's not a goal as such, but it's good to know that I got there without cheaty tests :) 2019-05-28 13:41:58 +00:00
Maurice Makaay 3dfa99c965 Modified all examples and tests to make use of the new ideas on how to keep parsing state. After this commit, I can cleanup a lot of stuff from the emitting loop-based parser which was basically crap for complex parsers. 2019-05-28 10:42:46 +00:00
Maurice Makaay 41f8733e99 Pfff, okay, so today I found a rather nice way of writing a parser that can hold some internal state, while stell holding on to the basic principle of having a function signature the applies to every parse handler in the system. By using methods instead of stand-alone functions, it is possible to let the accompanying struct hold on to the required state. Implemented this principle for the two calculator example projects. The rest is quite broken now, sorry :-p 2019-05-27 23:24:07 +00:00
Maurice Makaay f7d1e28fa1 Dropped the whole channel support for the parser internals. It seems a nice idea to work with, but it's hard to predict how much buffering the channel should have to make all parsers work. When the buffer is too small, then a StateHandler that emits more items than can be buffered will end up in a deadlock and stall the application. It is easy enough to replace the channel with a slice of Items, so I did. 2019-05-26 11:32:45 +00:00
Maurice Makaay c6fde2cf4e A big round of getting-ya-terminology-straight. 2019-05-26 09:25:34 +00:00
Maurice Makaay 2751c78003 Got rid of the full On()...etc chains for both code clarity and usability clarity. Working on good examples and shaving the API's accordingly. 2019-05-25 22:53:04 +00:00
Maurice Makaay bb1e462892 Ah, found a good way to document larger examples which need function definitions and such. Let's see if this works in godoc nicely. 2019-05-25 14:37:38 +00:00
Maurice Makaay 723e2a0c38 Added complete example for a parser. 2019-05-24 23:41:47 +00:00
Maurice Makaay 3e87e010fb Banged some sense into the constructors. Instead of one convulated parsekit.New(), we now have parsekit.NewParser() and parsekit.NewMatcherWrapper(). ALso playing with adding examples to the documentation. 2019-05-24 20:50:31 +00:00
Maurice Makaay 6fe3c16a6d Added some more modifiers (ModifyReplace and ModifyByCallback). 2019-05-24 15:57:54 +00:00
Maurice Makaay c164f320cb Implemented P.ExpectEndOfFile() and shortened some parser/combinator functions (since Go-people seem to like that better than a somewhat longer descriptive name) 2019-05-24 13:59:01 +00:00
Maurice Makaay 6ad4499971 Backup work, created a lot of tests for parser combinators and atoms. Pretty solid now! 2019-05-24 12:41:34 +00:00
Maurice Makaay d9ab7298e7 Cleanup of test code structure. Added support for creating parsers for either StateHandler or Matcher functions. 2019-05-23 00:04:10 +00:00
Maurice Makaay 355f995388 Switched to using a function signature for all matchers, instead of an interface. There's no need for all those structs with methods. Also some little things to see if that improves documentation. 2019-05-21 23:24:01 +00:00
Maurice Makaay eca2adc9fa Initial import of the parsekit module. 2019-05-21 14:49:44 +00:00