aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-10-27 10:16:03 -0500
committerGitHub <noreply@github.com>2017-10-27 10:16:03 -0500
commitd0213b21113dbb0abeb9e121d16985256167ec62 (patch)
treee7b68b41a8ad9b6eb20957e610cf9bd66a0c882b
parentd21657a9e5cfdb858c1a99a246001ceac05bb982 (diff)
parent6d6a68b5b1319fc4a43fe824046ae3b67e2ae85d (diff)
downloadservo-d0213b21113dbb0abeb9e121d16985256167ec62.tar.gz
servo-d0213b21113dbb0abeb9e121d16985256167ec62.zip
Auto merge of #19039 - sylvestre:master, r=emilio
Support multi lines declarations in the parsing of the Fx header files For example, in dom/base/nsGkAtomList.h, we currently have: `GK_ATOM(mouseWheel, "mouseWheel") // For discrete wheel events (e.g. not OSX magic mouse)` but if we change to ``` GK_ATOM(mouseWheel, "mouseWheel") // For discrete wheel events (e.g. not OSX magic mouse) ``` The parser didn't handle the declaration <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19039) <!-- Reviewable:end -->
-rwxr-xr-xcomponents/style/gecko/regen_atoms.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/components/style/gecko/regen_atoms.py b/components/style/gecko/regen_atoms.py
index 778c694f4e4..d1e9280102b 100755
--- a/components/style/gecko/regen_atoms.py
+++ b/components/style/gecko/regen_atoms.py
@@ -39,14 +39,16 @@ def msvc32_symbolify(source, ident):
class GkAtomSource:
- PATTERN = re.compile('^(GK_ATOM)\((.+),\s*"(.*)"\)')
+ PATTERN = re.compile('^(GK_ATOM)\(([^,]*),[^"]*"([^"]*)"\)',
+ re.MULTILINE)
FILE = "include/nsGkAtomList.h"
CLASS = "nsGkAtoms"
TYPE = "nsStaticAtom"
class CSSPseudoElementsAtomSource:
- PATTERN = re.compile('^(CSS_PSEUDO_ELEMENT)\((.+),\s*"(.*)",')
+ PATTERN = re.compile('^(CSS_PSEUDO_ELEMENT)\(([^,]*),[^"]*"([^"]*)",',
+ re.MULTILINE)
FILE = "include/nsCSSPseudoElementList.h"
CLASS = "nsCSSPseudoElements"
# NB: nsICSSPseudoElement is effectively the same as a nsStaticAtom, but we need
@@ -55,7 +57,8 @@ class CSSPseudoElementsAtomSource:
class CSSAnonBoxesAtomSource:
- PATTERN = re.compile('^(CSS_ANON_BOX|CSS_NON_INHERITING_ANON_BOX|CSS_WRAPPER_ANON_BOX)\((.+),\s*"(.*)"\)')
+ PATTERN = re.compile('^(CSS_ANON_BOX|CSS_NON_INHERITING_ANON_BOX|CSS_WRAPPER_ANON_BOX)\(([^,]*),[^"]*"([^"]*)"\)',
+ re.MULTILINE)
FILE = "include/nsCSSAnonBoxList.h"
CLASS = "nsCSSAnonBoxes"
TYPE = "nsICSSAnonBoxPseudo"
@@ -123,10 +126,9 @@ def collect_atoms(objdir):
path = os.path.abspath(os.path.join(objdir, source.FILE))
print("cargo:rerun-if-changed={}".format(path))
with open(path) as f:
- for line in f.readlines():
- result = re.match(source.PATTERN, line)
- if result:
- atoms.append(Atom(source, result.group(1), result.group(2), result.group(3)))
+ content = f.read()
+ for result in source.PATTERN.finditer(content):
+ atoms.append(Atom(source, result.group(1), result.group(2), result.group(3)))
return atoms