libfsm
libfsm copied to clipboard
DFA regular expression library & friends
This helps a little for rendering out to more natural regexp syntax. For example: ``` ; ./build/bin/re -r pcre -bpl pcre '(?:a|)(?:|xyz)' a?(?:xyz)? ```
When the `sid` parser encounters an error, it does not appear to free any partially-constructed pieces of the AST tree. I found this working with `cvtpcre` with ASAN enabled, but...
``` ; echo '$' | ./build/bin/lx zsh: done echo '$' | zsh: segmentation fault ./build/bin/lx ; echo '$ ' | ./build/bin/lx zsh: done echo '$ ' | zsh: segmentation fault...
Currently we have `fsm_shortest()` to find the shortest paths (actually least cost by weighted edges). I'd like a more convenient interface to: - Return a set of finite strings, not...
When I run `bmake PREFIX=$out install`, it fails, with the last few lines saying: ``` install -m 644 build/pc /nix/store/jj9j4kylaprcpy46gpdjb2mj119vbdpr-libfsm/share/pkgconfig/pc install: omitting directory 'build/pc' *** Error code 1 ```
I'll have more to say about this, but I'm too tired to write about it at the moment.
https://twitter.com/JakeDChampion/status/1282973512593018880 This case shows `{` and `}` near the beginning, and these are literal characters and not escaped. ``` /\s*(?:{(.*)})?\s*(?:(\$?\S+))?\s*(?:\[([^\]]*)])?\s*-?\s*([\S\s]*)\s*$/ ``` I supposed the first would be distinguished from the...
``` ./build/bin/re -k str -pl erl '^ab+c?.?[a-z]{2,3}$' ``` ```erlang -module(fsm). -export([main/1]). main([String]) -> try fsm(start, list_to_binary(String)) catch throw:fail -> io:format("failed~n"), halt(1); throw:{matched, N} -> io:format("matched ~b~n", [N]), halt(0) end. fsm(start,...
Things that would be nice to detect: - backrefs - look-behind assertions - look-ahead assertions - Any other PCRE features that aren't regular and require backtracking.
I don't know what I'm doing but with enough copy-paste from other parts of the source tree I made a thing!