Commit Graph

15 Commits

Author SHA1 Message Date
e849cc8ba2 Build an "inverted" path to allow for patterns that exclude characters. 2018-02-08 18:40:37 -08:00
945426e245 Add code to de-register patterns. 2018-02-05 22:42:02 -08:00
3b72569b33 Store information about tokens when they are added. 2018-02-05 22:09:12 -08:00
600f169b5b Use const variables in eval as much as possible. 2017-07-20 22:09:42 -07:00
6d520028b4 Switch pattern compilation code to const char* 2017-07-20 22:01:24 -07:00
8d1178788a Update libds. 2017-07-20 21:58:51 -07:00
1399934a24 Switch indices in strings to size_t. 2017-07-20 21:46:39 -07:00
140b727cc7 Make foreach_free public and fix a few bugs. 2017-02-14 19:10:44 -08:00
0b6d73ebdf Write initial code for matching the patterns to a single string.
The code is limited in two aspects, at the moment:
* It's not very well tested
* The current "best" match is just the one that occurred last. While
this is just fine in terms of length, this leaves open to chance which
pattern type will be returned if multiple patterns of the same length
match.
2017-02-04 00:28:36 -08:00
d753bbe1ab Fix the macro to allow it to return something. 2017-02-03 21:02:07 -08:00
01d49eb397 Implement a few "pair map" functions, mostly used for hash tables.
In order to efficiently check if nodes are contained within a
given set, without knowing exactly how many nodes there are and
allocating a ton of memory, it's probably best to use a hash table
(sparse sets would be more efficient but would require to allocate
all of their space at once). It's also pointless to reimplement most
of the hash table functionality from libds just to get it to work
with pairs (pattern id + node id), so pairmap.h provides a few
defaults that can be plugged into the default ht_s, as well as a
few macros to facilitate some hash table operations.
2017-01-27 22:16:31 -08:00
bae15027c3 Add a pattern id variable to all nodes. 2017-01-26 15:02:44 -08:00
19ca43d8e4 Add a pattern struct to encompass a pattern NFA and its size.
The size is necessary in free operations - unlike vectors and linked
lists, sparse sets in libds are not dynamically resizable.
2017-01-21 21:18:09 -08:00
54670a1f32 Change the return type of pattern_free. 2017-01-20 23:40:51 -08:00
e86518b716 Write a general header file and a header file for regular expressions. 2017-01-19 20:17:55 -08:00