Loading DHParser/ebnf.py +3 −2 Original line number Diff line number Diff line Loading @@ -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) Loading Loading
DHParser/ebnf.py +3 −2 Original line number Diff line number Diff line Loading @@ -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) Loading