Commit d4fe2e46 authored by di68kap's avatar di68kap
Browse files

- DHParser/ebnf.py: TODO regarding atomic grouping within res added

parent 90aa9fc2
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -703,9 +703,10 @@ class EBNFCompiler(Compiler):
    def _check_rx(self, node: Node, rx: str) -> str:
        """
        Checks whether the string `rx` represents a valid regular
        expression. Makes sure that multiline regular expressions are
        prepended by the multiline-flag. Returns the regular expression string.
        expression. Makes sure that multi-line regular expressions are
        prepended by the multi-line-flag. Returns the regular expression string.
        """
        # TODO: Support atomic grouping: https://stackoverflow.com/questions/13577372/do-python-regular-expressions-have-an-equivalent-to-rubys-atomic-grouping
        flags = self.re_flags | {'x'} if rx.find('\n') >= 0 else self.re_flags
        if flags:
            rx = "(?%s)%s" % ("".join(flags), rx)