[Pkg-mozext-commits] [greasemonkey] 17/45: Update the parser to detect @noframes.
David Prévot
taffit at moszumanska.debian.org
Mon Nov 3 20:59:19 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository greasemonkey.
commit 8f32550c4f72f3e769cbba882a2b94ec0cfaca6d
Author: Anthony Lieuallen <arantius at gmail.com>
Date: Thu Oct 2 10:53:26 2014 -0400
Update the parser to detect @noframes.
Refs #1859
---
modules/util/parseMetaLine.js | 214 +++++++++++++++++++++++-------------------
peg.txt | 13 ++-
2 files changed, 132 insertions(+), 95 deletions(-)
diff --git a/modules/util/parseMetaLine.js b/modules/util/parseMetaLine.js
index 121ab32..6cd08b6 100644
--- a/modules/util/parseMetaLine.js
+++ b/modules/util/parseMetaLine.js
@@ -48,43 +48,46 @@ function parseMetaLine(input) {
peg$c12 = function(val) { return val.join('');},
peg$c13 = /^[^\n]/,
peg$c14 = { type: "class", value: "[^\\n]", description: "[^\\n]" },
- peg$c15 = "downloadURL",
- peg$c16 = { type: "literal", value: "downloadURL", description: "\"downloadURL\"" },
- peg$c17 = "exclude",
- peg$c18 = { type: "literal", value: "exclude", description: "\"exclude\"" },
- peg$c19 = "grant",
- peg$c20 = { type: "literal", value: "grant", description: "\"grant\"" },
- peg$c21 = "icon",
- peg$c22 = { type: "literal", value: "icon", description: "\"icon\"" },
- peg$c23 = "include",
- peg$c24 = { type: "literal", value: "include", description: "\"include\"" },
- peg$c25 = "installURL",
- peg$c26 = { type: "literal", value: "installURL", description: "\"installURL\"" },
- peg$c27 = "match",
- peg$c28 = { type: "literal", value: "match", description: "\"match\"" },
- peg$c29 = "namespace",
- peg$c30 = { type: "literal", value: "namespace", description: "\"namespace\"" },
- peg$c31 = "require",
- peg$c32 = { type: "literal", value: "require", description: "\"require\"" },
- peg$c33 = "run-at",
- peg$c34 = { type: "literal", value: "run-at", description: "\"run-at\"" },
- peg$c35 = "updateURL",
- peg$c36 = { type: "literal", value: "updateURL", description: "\"updateURL\"" },
- peg$c37 = "version",
- peg$c38 = { type: "literal", value: "version", description: "\"version\"" },
- peg$c39 = function(keyword, value) { return {keyword:keyword, value:value}; },
- peg$c40 = "resource",
- peg$c41 = { type: "literal", value: "resource", description: "\"resource\"" },
- peg$c42 = function(keyword, value1, value2) { return {keyword:keyword, value1:value1, value2:value2}; },
- peg$c43 = "description",
- peg$c44 = { type: "literal", value: "description", description: "\"description\"" },
- peg$c45 = "name",
- peg$c46 = { type: "literal", value: "name", description: "\"name\"" },
- peg$c47 = ":",
- peg$c48 = { type: "literal", value: ":", description: "\":\"" },
- peg$c49 = /^[a-zA-Z\-]/,
- peg$c50 = { type: "class", value: "[a-zA-Z\\-]", description: "[a-zA-Z\\-]" },
- peg$c51 = function(keyword, locale, value) { return {keyword:keyword, locale:locale, value:value}; },
+ peg$c15 = "noframes",
+ peg$c16 = { type: "literal", value: "noframes", description: "\"noframes\"" },
+ peg$c17 = function(keyword) { return {keyword:keyword}; },
+ peg$c18 = "downloadURL",
+ peg$c19 = { type: "literal", value: "downloadURL", description: "\"downloadURL\"" },
+ peg$c20 = "exclude",
+ peg$c21 = { type: "literal", value: "exclude", description: "\"exclude\"" },
+ peg$c22 = "grant",
+ peg$c23 = { type: "literal", value: "grant", description: "\"grant\"" },
+ peg$c24 = "icon",
+ peg$c25 = { type: "literal", value: "icon", description: "\"icon\"" },
+ peg$c26 = "include",
+ peg$c27 = { type: "literal", value: "include", description: "\"include\"" },
+ peg$c28 = "installURL",
+ peg$c29 = { type: "literal", value: "installURL", description: "\"installURL\"" },
+ peg$c30 = "match",
+ peg$c31 = { type: "literal", value: "match", description: "\"match\"" },
+ peg$c32 = "namespace",
+ peg$c33 = { type: "literal", value: "namespace", description: "\"namespace\"" },
+ peg$c34 = "require",
+ peg$c35 = { type: "literal", value: "require", description: "\"require\"" },
+ peg$c36 = "run-at",
+ peg$c37 = { type: "literal", value: "run-at", description: "\"run-at\"" },
+ peg$c38 = "updateURL",
+ peg$c39 = { type: "literal", value: "updateURL", description: "\"updateURL\"" },
+ peg$c40 = "version",
+ peg$c41 = { type: "literal", value: "version", description: "\"version\"" },
+ peg$c42 = function(keyword, value) { return {keyword:keyword, value:value}; },
+ peg$c43 = "resource",
+ peg$c44 = { type: "literal", value: "resource", description: "\"resource\"" },
+ peg$c45 = function(keyword, value1, value2) { return {keyword:keyword, value1:value1, value2:value2}; },
+ peg$c46 = "description",
+ peg$c47 = { type: "literal", value: "description", description: "\"description\"" },
+ peg$c48 = "name",
+ peg$c49 = { type: "literal", value: "name", description: "\"name\"" },
+ peg$c50 = ":",
+ peg$c51 = { type: "literal", value: ":", description: "\":\"" },
+ peg$c52 = /^[a-zA-Z\-]/,
+ peg$c53 = { type: "class", value: "[a-zA-Z\\-]", description: "[a-zA-Z\\-]" },
+ peg$c54 = function(keyword, locale, value) { return {keyword:keyword, locale:locale, value:value}; },
peg$currPos = 0,
peg$reportedPos = 0,
@@ -264,11 +267,14 @@ function parseMetaLine(input) {
if (peg$silentFails === 0) { peg$fail(peg$c2); }
}
if (s1 !== peg$FAILED) {
- s2 = peg$parsekeyword1();
+ s2 = peg$parsekeyword0();
if (s2 === peg$FAILED) {
- s2 = peg$parsekeyword2();
+ s2 = peg$parsekeyword1();
if (s2 === peg$FAILED) {
- s2 = peg$parsekeywordLocale();
+ s2 = peg$parsekeyword2();
+ if (s2 === peg$FAILED) {
+ s2 = peg$parsekeywordLocale();
+ }
}
}
if (s2 !== peg$FAILED) {
@@ -401,104 +407,124 @@ function parseMetaLine(input) {
return s0;
}
+ function peg$parsekeyword0() {
+ var s0, s1;
+
+ s0 = peg$currPos;
+ if (input.substr(peg$currPos, 8) === peg$c15) {
+ s1 = peg$c15;
+ peg$currPos += 8;
+ } else {
+ s1 = peg$FAILED;
+ if (peg$silentFails === 0) { peg$fail(peg$c16); }
+ }
+ if (s1 !== peg$FAILED) {
+ peg$reportedPos = s0;
+ s1 = peg$c17(s1);
+ }
+ s0 = s1;
+
+ return s0;
+ }
+
function peg$parsekeyword1() {
var s0, s1, s2, s3;
s0 = peg$currPos;
- if (input.substr(peg$currPos, 11) === peg$c15) {
- s1 = peg$c15;
+ if (input.substr(peg$currPos, 11) === peg$c18) {
+ s1 = peg$c18;
peg$currPos += 11;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c16); }
+ if (peg$silentFails === 0) { peg$fail(peg$c19); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 7) === peg$c17) {
- s1 = peg$c17;
+ if (input.substr(peg$currPos, 7) === peg$c20) {
+ s1 = peg$c20;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c18); }
+ if (peg$silentFails === 0) { peg$fail(peg$c21); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 5) === peg$c19) {
- s1 = peg$c19;
+ if (input.substr(peg$currPos, 5) === peg$c22) {
+ s1 = peg$c22;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c20); }
+ if (peg$silentFails === 0) { peg$fail(peg$c23); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 4) === peg$c21) {
- s1 = peg$c21;
+ if (input.substr(peg$currPos, 4) === peg$c24) {
+ s1 = peg$c24;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c22); }
+ if (peg$silentFails === 0) { peg$fail(peg$c25); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 7) === peg$c23) {
- s1 = peg$c23;
+ if (input.substr(peg$currPos, 7) === peg$c26) {
+ s1 = peg$c26;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c24); }
+ if (peg$silentFails === 0) { peg$fail(peg$c27); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 10) === peg$c25) {
- s1 = peg$c25;
+ if (input.substr(peg$currPos, 10) === peg$c28) {
+ s1 = peg$c28;
peg$currPos += 10;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c26); }
+ if (peg$silentFails === 0) { peg$fail(peg$c29); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 5) === peg$c27) {
- s1 = peg$c27;
+ if (input.substr(peg$currPos, 5) === peg$c30) {
+ s1 = peg$c30;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c28); }
+ if (peg$silentFails === 0) { peg$fail(peg$c31); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 9) === peg$c29) {
- s1 = peg$c29;
+ if (input.substr(peg$currPos, 9) === peg$c32) {
+ s1 = peg$c32;
peg$currPos += 9;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
+ if (peg$silentFails === 0) { peg$fail(peg$c33); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 7) === peg$c31) {
- s1 = peg$c31;
+ if (input.substr(peg$currPos, 7) === peg$c34) {
+ s1 = peg$c34;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c32); }
+ if (peg$silentFails === 0) { peg$fail(peg$c35); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 6) === peg$c33) {
- s1 = peg$c33;
+ if (input.substr(peg$currPos, 6) === peg$c36) {
+ s1 = peg$c36;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c34); }
+ if (peg$silentFails === 0) { peg$fail(peg$c37); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 9) === peg$c35) {
- s1 = peg$c35;
+ if (input.substr(peg$currPos, 9) === peg$c38) {
+ s1 = peg$c38;
peg$currPos += 9;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c36); }
+ if (peg$silentFails === 0) { peg$fail(peg$c39); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 7) === peg$c37) {
- s1 = peg$c37;
+ if (input.substr(peg$currPos, 7) === peg$c40) {
+ s1 = peg$c40;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c38); }
+ if (peg$silentFails === 0) { peg$fail(peg$c41); }
}
}
}
@@ -517,7 +543,7 @@ function parseMetaLine(input) {
s3 = peg$parsenon_newline();
if (s3 !== peg$FAILED) {
peg$reportedPos = s0;
- s1 = peg$c39(s1, s3);
+ s1 = peg$c42(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
@@ -539,12 +565,12 @@ function parseMetaLine(input) {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
- if (input.substr(peg$currPos, 8) === peg$c40) {
- s1 = peg$c40;
+ if (input.substr(peg$currPos, 8) === peg$c43) {
+ s1 = peg$c43;
peg$currPos += 8;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c41); }
+ if (peg$silentFails === 0) { peg$fail(peg$c44); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsewhitespace();
@@ -556,7 +582,7 @@ function parseMetaLine(input) {
s5 = peg$parsenon_newline();
if (s5 !== peg$FAILED) {
peg$reportedPos = s0;
- s1 = peg$c42(s1, s3, s5);
+ s1 = peg$c45(s1, s3, s5);
s0 = s1;
} else {
peg$currPos = s0;
@@ -586,50 +612,50 @@ function parseMetaLine(input) {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
- if (input.substr(peg$currPos, 11) === peg$c43) {
- s1 = peg$c43;
+ if (input.substr(peg$currPos, 11) === peg$c46) {
+ s1 = peg$c46;
peg$currPos += 11;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c44); }
+ if (peg$silentFails === 0) { peg$fail(peg$c47); }
}
if (s1 === peg$FAILED) {
- if (input.substr(peg$currPos, 4) === peg$c45) {
- s1 = peg$c45;
+ if (input.substr(peg$currPos, 4) === peg$c48) {
+ s1 = peg$c48;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c46); }
+ if (peg$silentFails === 0) { peg$fail(peg$c49); }
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
- s4 = peg$c47;
+ s4 = peg$c50;
peg$currPos++;
} else {
s4 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c48); }
+ if (peg$silentFails === 0) { peg$fail(peg$c51); }
}
if (s4 !== peg$FAILED) {
s5 = [];
- if (peg$c49.test(input.charAt(peg$currPos))) {
+ if (peg$c52.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s6 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
+ if (peg$silentFails === 0) { peg$fail(peg$c53); }
}
if (s6 !== peg$FAILED) {
while (s6 !== peg$FAILED) {
s5.push(s6);
- if (peg$c49.test(input.charAt(peg$currPos))) {
+ if (peg$c52.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s6 = peg$FAILED;
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
+ if (peg$silentFails === 0) { peg$fail(peg$c53); }
}
}
} else {
@@ -659,7 +685,7 @@ function parseMetaLine(input) {
s4 = peg$parsenon_newline();
if (s4 !== peg$FAILED) {
peg$reportedPos = s0;
- s1 = peg$c51(s1, s2, s4);
+ s1 = peg$c54(s1, s2, s4);
s0 = s1;
} else {
peg$currPos = s0;
diff --git a/peg.txt b/peg.txt
index 7dc4fa5..f0c64c0 100644
--- a/peg.txt
+++ b/peg.txt
@@ -20,6 +20,7 @@ Test value:
// @updateURL http://example.org/foo.meta.js
// @require http://example.net/library.js
// @resource css http://example.net/library.css
+// @noframes
// ==/UserScript==
*/
@@ -36,7 +37,11 @@ meta =
line =
"// @"
- meta:(keyword1 / keyword2 / keywordLocale)
+ meta:(
+ keyword0 /
+ keyword1 /
+ keyword2 /
+ keywordLocale)
"\n"?
{ return meta; }
@@ -46,6 +51,12 @@ non_whitespace =
non_newline =
val:[^\n]+ { return val.join('');}
+keyword0 =
+ keyword:(
+ "noframes"
+ )
+ { return {keyword:keyword}; }
+
keyword1 =
keyword:(
"downloadURL" /
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git
More information about the Pkg-mozext-commits
mailing list