Commit Graph

54 Commits

Author SHA1 Message Date
4376ccb77d Renamed function calls to use new names 2025-01-19 21:22:33 -06:00
0956dddd81 Fixed bug where I checked if flag was enabled before calling flag.Parse() 2025-01-09 10:38:35 -06:00
0b84806fc4 Added 'flags' to the Compile function, instead of maintaining global state to check whether certain features were enabled 2025-01-09 10:33:56 -06:00
24fa365be1 Moved some auxiliary functions into compile.go; use new API for compiling and finding matches 2025-01-06 20:14:57 -06:00
ddbcb309b0 Made shuntingYard return an error instead of panicking, moved it and thompson to compile.go 2025-01-06 12:29:04 -06:00
72263509d3 Rewrote behavior of '-m' flag to use the 'nth match' function from matching.go 2025-01-05 21:41:14 -06:00
6f9173f771 Finished support for -m flag; refactoring pending 2025-01-03 19:17:24 -05:00
8a0586d107 Added support for printing specific match indices ('-m' and '-p' flags combined) 2025-01-03 15:49:14 -06:00
13ca954072 Started working on '-m num' flag : print the <num>th match 2024-12-19 04:29:05 -05:00
98f4c9e418 Added support for non-capturing groups 2024-12-18 15:22:43 -05:00
8d6e1a41a5 Fixed bug where a repeated capturing group eg. (a){3} wouldn't capture only the last iteration, like it should 2024-12-16 22:58:39 -05:00
822d1f319f Added initial support for capturing groups 2024-12-09 01:04:31 -05:00
34e9aedbd6 Compile lookaround regex to avoid compiling each time we want to use it 2024-11-27 12:15:01 -05:00
6208f32710 Added support for numeric ranges: <5-38> will match all numbers between 5 and 38, inclusive on both ends. Also print line number on which matches occur, if we are in printing (and single line) mode 2024-11-27 11:48:04 -05:00
fe1136c54c Fixed bug with parentheses in lookaround regex; fixed bug with reading last line of test string (if it doesn't end in a newline) 2024-11-24 15:02:58 -05:00
7916629c4d Added substitute flag - substitute matched text with given text 2024-11-23 10:12:22 -05:00
c87a4b7136 Added case-insensitve flag 2024-11-23 09:26:11 -05:00
11c0a0552f Added support for lokarounds; parsing and adding nodes for different lookarounds 2024-11-22 00:10:15 -05:00
1a1a8f4f9c Moved flag-checking after flag.Parse() 2024-11-20 10:37:33 -05:00
b3ee1fe5e8 Convert an inverting character class into an 'allChars' node, with the characters marked as exceptions 2024-11-20 09:40:40 -05:00
c694c47be7 Added flag to print match indices, and to enable multi-line mode 2024-11-20 01:06:23 -05:00
c56d81a335 Added unicode support to dot metacharacter - it now matches _any_ unicode character (almost) 2024-11-18 16:44:43 -05:00
8a1f1dc621 Added unicode support
Replaced strings with rune-slices, which capture unicode codepoints more
accurately.
2024-11-18 10:41:50 -05:00
805766a5ba Added support for -l : only print lines with at least one match (or with exactly 0 matches, if -v is enabled 2024-11-18 10:02:34 -05:00
dcd712dceb Added support for -o flag: only print matching content 2024-11-18 09:36:16 -05:00
f2b8812b05 Added support for -v flag, to invert which values are printed in color. Also got rid of unecessary 'else' clause 2024-11-17 22:19:55 -05:00
11641596fa Read multiple lines from stdin and apply regex to each one; Convert the array of matchIndex structs into a flat array of indices; speeds up process of checking if we have to print a character in color 2024-11-17 21:49:11 -05:00
d8f52b8ccc Added support for numeric specifiers, moved question mark operator to its own function 2024-11-03 14:36:04 -05:00
8dbecde3ae Added support for detecting assertion characters; changed input so that newline isn't required 2024-10-31 16:51:53 -04:00
1bafdcdb7e Added support for inverted matches; moved escape character detection to its own function 2024-10-30 09:33:25 -04:00
a66e8f1c08 Concatenate every character if it is escaped 2024-10-29 20:05:30 -04:00
7b815343f4 Removed exclamation mark in inverted metacharacters - had the opposite effect becasue of the way deleteFunc works 2024-10-29 10:07:55 -04:00
1a7fd12569 Added support for some escaped metacharacters 2024-10-29 10:05:39 -04:00
ca945c7740 Added support for character ranges and dot metacharacter 2024-10-29 00:26:11 -04:00
11073759e3 Added support for character classes (not ranges, yet); also take input from stdin instead of cmdline arg 2024-10-28 17:37:20 -04:00
84c768fd5e Fixed small bug with question mark operator, wasn't adding the empty state's output 2024-10-28 09:40:03 -04:00
7286e07858 Added question mark operator - 0 or 1 2024-10-28 00:58:26 -04:00
ae219f763a Added alternate function, removed relevant code from main; also started working on escape characters 2024-10-27 15:30:33 -04:00
4781b87b90 Added comments 2024-10-27 14:56:00 -04:00
bf3060b672 Used 'unique append' to ensure that a transition can only contain a given state once 2024-10-27 12:52:59 -04:00
761a5ad052 Added functions for concatenation and kleene star creation, removed relevant code from main 2024-10-27 11:18:00 -04:00
5ee427230c Replaced 'pop' with 'mustPop' which panics on error 2024-10-26 13:05:44 -04:00
273a03e3cf Added more test cases 2024-10-24 17:33:38 -04:00
139c88dd58 Started working on '+' operator 2024-10-24 14:39:28 -04:00
c894ee4c0d Renamed match function to 'findAllMatches', to better represent what it does 2024-10-24 12:31:37 -04:00
9d786997df Initial support for multiple matching 2024-10-23 11:18:45 -04:00
11dd6aeb7c More Kleene star fixes 2024-10-23 10:26:50 -04:00
9d3bc2b804 Fixed kleene star behavior, which used to behave like a '+' 2024-10-23 08:51:49 -04:00
cc0098b558 Print matched content in color 2024-10-22 21:02:09 -04:00
bc11777ad5 Fixed Kleene Star matching 2024-10-22 17:07:01 -04:00