[Pkg-mozext-commits] [greasemonkey] 31/45: Return only the actual locale value from the parser.

David Prévot taffit at moszumanska.debian.org
Mon Nov 3 20:59:21 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 38084649e10aa3c2d70355baf54ea68fb008d872
Author: Ventero <ventero at ventero.de>
Date:   Thu Oct 2 20:16:57 2014 +0200

    Return only the actual locale value from the parser.
---
 modules/parseScript.js        |  2 +-
 modules/util/parseMetaLine.js | 38 ++++++++++++++++++++------------------
 peg.txt                       |  2 +-
 3 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/modules/parseScript.js b/modules/parseScript.js
index 24f977f..738ec3e 100644
--- a/modules/parseScript.js
+++ b/modules/parseScript.js
@@ -63,7 +63,7 @@ function parse(aSource, aUri, aFailWhenMissing, aNoMetaOk) {
 
     case 'description':
     case 'name':
-      var locale = data.locale.replace(/^:/, '');
+      var locale = data.locale;
 
       if (locale) {
         if (!script._locales[locale]) {
diff --git a/modules/util/parseMetaLine.js b/modules/util/parseMetaLine.js
index 052e074..1c5a891 100644
--- a/modules/util/parseMetaLine.js
+++ b/modules/util/parseMetaLine.js
@@ -86,7 +86,8 @@ function parseMetaLine(input) {
       peg$c50 = { type: "literal", value: ":", description: "\":\"" },
       peg$c51 = /^[a-zA-Z\-]/,
       peg$c52 = { type: "class", value: "[a-zA-Z\\-]", description: "[a-zA-Z\\-]" },
-      peg$c53 = function(keyword, locale, value) { return {keyword:keyword, locale:locale, value:value}; },
+      peg$c53 = function(localeValue) { return localeValue },
+      peg$c54 = function(keyword, locale, value) { return {keyword:keyword, locale:locale, value:value}; },
 
       peg$currPos          = 0,
       peg$reportedPos      = 0,
@@ -627,15 +628,15 @@ function parseMetaLine(input) {
     }
     if (s1 !== peg$FAILED) {
       s2 = peg$currPos;
-      s3 = peg$currPos;
       if (input.charCodeAt(peg$currPos) === 58) {
-        s4 = peg$c49;
+        s3 = peg$c49;
         peg$currPos++;
       } else {
-        s4 = peg$FAILED;
+        s3 = peg$FAILED;
         if (peg$silentFails === 0) { peg$fail(peg$c50); }
       }
-      if (s4 !== peg$FAILED) {
+      if (s3 !== peg$FAILED) {
+        s4 = peg$currPos;
         s5 = [];
         if (peg$c51.test(input.charAt(peg$currPos))) {
           s6 = input.charAt(peg$currPos);
@@ -659,30 +660,31 @@ function parseMetaLine(input) {
           s5 = peg$c0;
         }
         if (s5 !== peg$FAILED) {
-          s4 = [s4, s5];
-          s3 = s4;
+          s5 = input.substring(s4, peg$currPos);
+        }
+        s4 = s5;
+        if (s4 !== peg$FAILED) {
+          peg$reportedPos = s2;
+          s3 = peg$c53(s4);
+          s2 = s3;
         } else {
-          peg$currPos = s3;
-          s3 = peg$c0;
+          peg$currPos = s2;
+          s2 = peg$c0;
         }
       } else {
-        peg$currPos = s3;
-        s3 = peg$c0;
-      }
-      if (s3 === peg$FAILED) {
-        s3 = peg$c3;
+        peg$currPos = s2;
+        s2 = peg$c0;
       }
-      if (s3 !== peg$FAILED) {
-        s3 = input.substring(s2, peg$currPos);
+      if (s2 === peg$FAILED) {
+        s2 = peg$c3;
       }
-      s2 = s3;
       if (s2 !== peg$FAILED) {
         s3 = peg$parsewhitespace();
         if (s3 !== peg$FAILED) {
           s4 = peg$parsenon_newline();
           if (s4 !== peg$FAILED) {
             peg$reportedPos = s0;
-            s1 = peg$c53(s1, s2, s4);
+            s1 = peg$c54(s1, s2, s4);
             s0 = s1;
           } else {
             peg$currPos = s0;
diff --git a/peg.txt b/peg.txt
index 00ea223..3c72cfc 100644
--- a/peg.txt
+++ b/peg.txt
@@ -87,7 +87,7 @@ keywordLocale
         "description" /
         "name"
         )
-    locale:$(":" [a-zA-Z-]+)?
+    locale:(":" localeValue:$[a-zA-Z-]+ { return localeValue })?
     whitespace
     value:non_newline
     { return {keyword:keyword, locale:locale, value:value}; }

-- 
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