You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 9, 2020. It is now read-only.
I considered making a regex/5 predicate whose argument order is consistent with DCGs, but that would require one to always use regex//3 even if options and captures aren't needed. As in the example above, one often needs only a pattern.
I decided that a separate DCG version is the most appropriate. This is probably the most fundamental regular expression predicate. regex/4 might be built on top of it with something like:
The DCG interface should only match a regular expression anchored at the first character of Text. That's consistent with the way that DCGs consume only from the head. If a DCG wants the regex to match anywhere, it can add its own logic for discarding characters that don't match.
Regular expressions can be useful as building blocks for DCGs. For example,
I considered making a
regex/5predicate whose argument order is consistent with DCGs, but that would require one to always useregex//3even if options and captures aren't needed. As in the example above, one often needs only a pattern.I decided that a separate DCG version is the most appropriate. This is probably the most fundamental regular expression predicate.
regex/4might be built on top of it with something like:The DCG interface should only match a regular expression anchored at the first character of
Text. That's consistent with the way that DCGs consume only from the head. If a DCG wants the regex to match anywhere, it can add its own logic for discarding characters that don't match.