Commit Graph

52 Commits

Author SHA1 Message Date
Danila Fedorin be7ea694fc Update libds (again). 2018-03-24 17:15:49 -07:00
Danila Fedorin ff819aabab Update libds. 2018-03-24 16:53:49 -07:00
Danila Fedorin 27db224a79 Update libds. 2018-03-17 17:23:55 -07:00
Danila Fedorin f54e6fb1ea Fix bug causing comparison between incompatible enums. 2018-02-28 13:47:39 -08:00
Danila Fedorin 17ab9beb71 Implement exclusion operator matching. 2018-02-08 18:41:36 -08:00
Danila Fedorin eecfe653e3 Fix incorrect deletion code. 2018-02-08 18:40:56 -08:00
Danila Fedorin e849cc8ba2 Build an "inverted" path to allow for patterns that exclude characters. 2018-02-08 18:40:37 -08:00
Danila Fedorin 945426e245 Add code to de-register patterns. 2018-02-05 22:42:02 -08:00
Danila Fedorin 3b72569b33 Store information about tokens when they are added. 2018-02-05 22:09:12 -08:00
Danila Fedorin bb07382b59 Make CMake calls consistent. 2018-02-04 00:25:52 -08:00
Danila Fedorin b850afce37 Update libds. 2018-02-04 00:22:07 -08:00
Danila Fedorin 32af31d14a Ensure codebase is C90. 2018-02-04 00:21:03 -08:00
Danila Fedorin b2024931d1 Fix strange include generated by CLion. 2017-07-21 18:12:18 -07:00
Danila Fedorin a21122f7d0 Update libds. 2017-07-21 17:45:43 -07:00
Danila Fedorin 600f169b5b Use const variables in eval as much as possible. 2017-07-20 22:09:42 -07:00
Danila Fedorin 6d520028b4 Switch pattern compilation code to const char* 2017-07-20 22:01:24 -07:00
Danila Fedorin 8d1178788a Update libds. 2017-07-20 21:58:51 -07:00
Danila Fedorin 1399934a24 Switch indices in strings to size_t. 2017-07-20 21:46:39 -07:00
Danila Fedorin 8e29bdf52a Update libds to latest version. 2017-07-20 21:46:18 -07:00
Danila Fedorin bf85cdeca9 Fix incorrect enum comparisons. 2017-06-22 14:40:37 -07:00
Danila Fedorin d2f2314b4e Change submodule url to http to allow non-ssh access. 2017-05-11 22:19:49 -07:00
Danila Fedorin f83f0a1bcc Make eval_all exit when largest match is empty. 2017-03-18 21:23:32 -07:00
Danila Fedorin adcc97ef0b Fix eval.c to use return code from eval_step. 2017-03-18 21:22:21 -07:00
Danila Fedorin d808f98fd3 Add code to return early in CMakeLists to prevent being included again. 2017-03-18 17:36:13 -07:00
Danila Fedorin 2f65eda7bd Try to fix reading freed memory in eval.c.
This occurred when the null term was reached - the token was freed, but
no error was thrown (it's just the end of the string), so the program
attempted to increment the index using freed token data.
2017-02-26 22:35:45 -08:00
Danila Fedorin eb4204fe76 Fix two bugs. One was caused by the previous commit.
The other was created by using invalid memory.
2017-02-25 22:38:13 -08:00
Danila Fedorin c629be5d68 Merge branch 'master' of dev.danilafe.com:Experiments/liblex 2017-02-25 22:26:06 -08:00
Danila Fedorin 2cdd9e55be Implement the 'any' character. 2017-02-25 22:24:52 -08:00
Danila Fedorin 6add9ae898 Create README.md 2017-02-15 03:28:52 +00:00
Danila Fedorin f18a31c0df Change return code to EXIT_SUCCESS. 2017-02-14 19:13:43 -08:00
Danila Fedorin 140b727cc7 Make foreach_free public and fix a few bugs. 2017-02-14 19:10:44 -08:00
Danila Fedorin 97933c4ce9 Tentatively implement lexing multiple words. 2017-02-05 16:29:44 -08:00
Danila Fedorin 8ff435b7b5 Add underscores to local functions. 2017-02-05 15:49:06 -08:00
Danila Fedorin a0f51d441e Change the way best match is picked to the one with the "largest" id. 2017-02-05 15:46:43 -08:00
Danila Fedorin 5be88a2856 Fix bug(s) in pattern compilation that added the '[' pr ']' chars. 2017-02-04 00:29:20 -08:00
Danila Fedorin 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
Danila Fedorin d753bbe1ab Fix the macro to allow it to return something. 2017-02-03 21:02:07 -08:00
Danila Fedorin 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
Danila Fedorin da48537f3c Update libds. 2017-01-27 22:04:16 -08:00
Danila Fedorin bae15027c3 Add a pattern id variable to all nodes. 2017-01-26 15:02:44 -08:00
Danila Fedorin ee40622ceb Implement pattern compilation and freeing. 2017-01-21 21:19:12 -08:00
Danila Fedorin d8ddaa8b45 Fix a few more bugs in helper functions. 2017-01-21 21:18:55 -08:00
Danila Fedorin 16832e98a9 Fix create functions not setting node type. 2017-01-21 21:18:34 -08:00
Danila Fedorin 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
Danila Fedorin fbba562eb7 Update libds to latest version. 2017-01-21 20:32:39 -08:00
Danila Fedorin 89d2c84c39 Update libds to newest version. 2017-01-21 16:48:28 -08:00
Danila Fedorin 54670a1f32 Change the return type of pattern_free. 2017-01-20 23:40:51 -08:00
Danila Fedorin 961136a41b Add internal function, mostly for memory allocation and concatenation. 2017-01-19 23:32:09 -08:00
Danila Fedorin e86518b716 Write a general header file and a header file for regular expressions. 2017-01-19 20:17:55 -08:00
Danila Fedorin 41d4d98678 Create CMakeLists.txt file. 2017-01-19 19:33:59 -08:00