Commit Graph

28 Commits

Author SHA1 Message Date
169dcb5bf2 fix regex parsing by not considering grouping parens as an operator 2025-10-01 13:48:18 +01:00
6a98cddebe added functions to compute firstpos, lastpos and nullable 2025-10-01 12:36:26 +01:00
7347437f17 change representation of alternation nodes and concatenation nodes to use tuples instead of lists, as the conventional algorithms use this representation 2025-10-01 12:17:35 +01:00
fd0ce5b22a add function to compute if a given node is nullable 2025-10-01 11:52:45 +01:00
9584bca7ee when parsing NFA, label position of leaves (each leaf is either a CHAR_LITERAL or a WILDCARD) 2025-10-01 11:23:41 +01:00
31f70a6748 remove nfa-matching code for the moment, and parse a simple regex tree without state information 2025-10-01 10:48:45 +01:00
774dba5c19 find bug and comment on it. We currently assume the first character in an NFA string is a CHAR_LITERAL, but it can be anything else, including a WILDCARD operator; we have to check what the chr is and decide. We probably want to take care of this later, so added a todo-note. 2025-09-30 14:25:45 +01:00
934fa729a9 parse and interpret wildcard character which is a dot . 2025-09-30 14:10:49 +01:00
b52b5ff28c parse wildcard . character for NFA too 2025-09-30 14:05:39 +01:00
5fa784b4c6 refactor nfa.sml so that lists in CONCAT and ALTERNATION cases don't need the state to be tupled with the regex 2025-09-30 13:52:35 +01:00
45fbd85183 move buffer around when calling 'SearchList.buildRange' 2025-09-30 05:40:57 +01:00
e03eecf940 use LineGap.sub instead of LineGap.substring, as the former function is now fixed 2025-09-30 05:30:11 +01:00
b35d045a09 fix bugs in implementation for 'Nfa.getMatchesInRange' 2025-09-29 22:57:19 +01:00
d37e510b24 progress fixing backtracking 2025-09-29 21:29:03 +01:00
64c16a7c25 fix bug with shadowing 'finishIdx' value, when we still wanted access to both the previous and the new 'finishIdx' 2025-09-29 21:21:06 +01:00
df78e20cb7 fix bug in 'Nfa.getMatches' loop function: when we find that this state is valid, continue loop from 'finishIdx + 1'. 2025-09-29 21:07:02 +01:00
13ccdbb202 return PersistentVector.t when building search-list/executing nfa, because we don't want to use a simple flat vector for the search list now 2025-09-29 14:02:07 +01:00
6d2b43606f when parsing a string into an NFA, return an option type if the syntax is invalid 2025-09-29 13:34:55 +01:00
7dc94632d6 fix backtracking bug in 'Nfa.getMatchesInRange' (we were passing the wrong value instead of 'strIdx' in the recursive call to the loop function) 2025-09-29 13:13:14 +01:00
b6720ed5f1 first pass of 'get matches in range from nfa' functionality 2025-09-29 12:18:45 +01:00
8d29bfab78 adjust nfa to return all matches in string, instead of just testing for one match and then returning true 2025-09-29 10:28:03 +01:00
f52a8306ea add comments to ongiong NFA implementation 2025-09-29 08:33:10 +01:00
6b7485f753 change NFA interpreter slightly so that, if we see that a match is invalid at some place, we check in the next place to see if it is valid later in the string 2025-09-29 02:00:04 +01:00
f8b707de20 interpret concatenation and alternation in nfa 2025-09-29 01:45:28 +01:00
e01712a065 progress interpreting alternation in nfa 2025-09-29 01:06:15 +01:00
d9720c5643 begin adding interpretation for NFA 2025-09-29 00:46:05 +01:00
d75b1a18ff flatten repeated concatenations and alternations into a single list when possible 2025-09-28 22:23:48 +01:00
032ca56bbf add initial implementation of compiling a regex string to an NFA 2025-09-28 22:01:44 +01:00