[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-102.7.0esr-12.5-1] Bug 1799982 - Remove uses of inline flags from XPIDL regexps. r=xpcom-reviewers, kmag a=RyanVM

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Mon Jan 30 18:03:03 UTC 2023



Pier Angelo Vendrame pushed to branch tor-browser-102.7.0esr-12.5-1 at The Tor Project / Applications / Tor Browser


Commits:
9e5dcf54 by Andrew McCreight at 2023-01-30T18:59:35+01:00
Bug 1799982 - Remove uses of inline flags from XPIDL regexps. r=xpcom-reviewers,kmag a=RyanVM

Apparently the use of these is being turned into an error in Python 3.11.
Fortunately, our uses appears to be rather trivial.

For t_multilinecomment and t_LCDATA, I dropped the (?s) flag and just
replaced the one use of . with (\n|.). (?s) means DOTALL, which means
that dot includes any character, including a newline. Otherwise it means
dot includes any character except a newline.

I took the new t_singlelinecomment from IPDL's parser.py, so I assume
it is reasonable enough. t_multilinecomment is also now the same as
in IPDL.

Differential Revision: https://phabricator.services.mozilla.com/D161738
- - - - -


1 changed file:

- xpcom/idl-parser/xpidl/xpidl.py


Changes:

=====================================
xpcom/idl-parser/xpidl/xpidl.py
=====================================
@@ -1572,13 +1572,13 @@ class IDLParser(object):
     t_ignore = " \t"
 
     def t_multilinecomment(self, t):
-        r"/\*(?s).*?\*/"
+        r"/\*(\n|.)*?\*/"
         t.lexer.lineno += t.value.count("\n")
         if t.value.startswith("/**"):
             self._doccomments.append(t.value)
 
     def t_singlelinecomment(self, t):
-        r"(?m)//.*?$"
+        r"//[^\n]*"
 
     def t_IID(self, t):
         return t
@@ -1591,7 +1591,7 @@ class IDLParser(object):
         return t
 
     def t_LCDATA(self, t):
-        r"(?s)%\{[ ]*C\+\+[ ]*\n(?P<cdata>.*?\n?)%\}[ ]*(C\+\+)?"
+        r"%\{[ ]*C\+\+[ ]*\n(?P<cdata>(\n|.)*?\n?)%\}[ ]*(C\+\+)?"
         t.type = "CDATA"
         t.value = t.lexer.lexmatch.group("cdata")
         t.lexer.lineno += t.value.count("\n")



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/9e5dcf54d1f2aea76cd23cccb2f1b39d76ab6e50

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/9e5dcf54d1f2aea76cd23cccb2f1b39d76ab6e50
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20230130/544b6e6c/attachment-0001.htm>


More information about the tbb-commits mailing list