"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/first-mate/lib/scope-selector-parser.js" (8 Mar 2017, 23827 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 module.exports = (function() {
    2   /*
    3    * Generated by PEG.js 0.8.0.
    4    *
    5    * http://pegjs.majda.cz/
    6    */
    7 
    8   function peg$subclass(child, parent) {
    9     function ctor() { this.constructor = child; }
   10     ctor.prototype = parent.prototype;
   11     child.prototype = new ctor();
   12   }
   13 
   14   function SyntaxError(message, expected, found, offset, line, column) {
   15     this.message  = message;
   16     this.expected = expected;
   17     this.found    = found;
   18     this.offset   = offset;
   19     this.line     = line;
   20     this.column   = column;
   21 
   22     this.name     = "SyntaxError";
   23   }
   24 
   25   peg$subclass(SyntaxError, Error);
   26 
   27   function parse(input) {
   28     var options = arguments.length > 1 ? arguments[1] : {},
   29 
   30         peg$FAILED = {},
   31 
   32         peg$startRuleFunctions = { start: peg$parsestart },
   33         peg$startRuleFunction  = peg$parsestart,
   34 
   35         peg$c0 = peg$FAILED,
   36         peg$c1 = function(selector) {
   37           return selector;
   38         },
   39         peg$c2 = [],
   40         peg$c3 = /^[a-zA-Z0-9+_]/,
   41         peg$c4 = { type: "class", value: "[a-zA-Z0-9+_]", description: "[a-zA-Z0-9+_]" },
   42         peg$c5 = /^[a-zA-Z0-9\-+_]/,
   43         peg$c6 = { type: "class", value: "[a-zA-Z0-9\\-+_]", description: "[a-zA-Z0-9\\-+_]" },
   44         peg$c7 = function(segment) {
   45             return new matchers.SegmentMatcher(segment);
   46           },
   47         peg$c8 = /^[*]/,
   48         peg$c9 = { type: "class", value: "[*]", description: "[*]" },
   49         peg$c10 = function(scopeName) {
   50             return new matchers.TrueMatcher();
   51           },
   52         peg$c11 = ".",
   53         peg$c12 = { type: "literal", value: ".", description: "\".\"" },
   54         peg$c13 = function(first, others) {
   55             return new matchers.ScopeMatcher(first, others);
   56           },
   57         peg$c14 = null,
   58         peg$c15 = /^[LRB]/,
   59         peg$c16 = { type: "class", value: "[LRB]", description: "[LRB]" },
   60         peg$c17 = ":",
   61         peg$c18 = { type: "literal", value: ":", description: "\":\"" },
   62         peg$c19 = function(prefix, first, others) {
   63             return new matchers.PathMatcher(prefix, first, others);
   64           },
   65         peg$c20 = "(",
   66         peg$c21 = { type: "literal", value: "(", description: "\"(\"" },
   67         peg$c22 = ")",
   68         peg$c23 = { type: "literal", value: ")", description: "\")\"" },
   69         peg$c24 = function(prefix, selector) {
   70             return new matchers.GroupMatcher(prefix, selector);
   71           },
   72         peg$c25 = "-",
   73         peg$c26 = { type: "literal", value: "-", description: "\"-\"" },
   74         peg$c27 = function(group) {
   75             return new matchers.NegateMatcher(group);
   76           },
   77         peg$c28 = function(path) {
   78             return new matchers.NegateMatcher(path);
   79           },
   80         peg$c29 = /^[|&\-]/,
   81         peg$c30 = { type: "class", value: "[|&\\-]", description: "[|&\\-]" },
   82         peg$c31 = function(left, operator, right) {
   83             return new matchers.CompositeMatcher(left, operator, right);
   84           },
   85         peg$c32 = ",",
   86         peg$c33 = { type: "literal", value: ",", description: "\",\"" },
   87         peg$c34 = function(left, right) {
   88             if (right)
   89               return new matchers.OrMatcher(left, right);
   90             else
   91               return left;
   92           },
   93         peg$c35 = /^[ \t]/,
   94         peg$c36 = { type: "class", value: "[ \\t]", description: "[ \\t]" },
   95 
   96         peg$currPos          = 0,
   97         peg$reportedPos      = 0,
   98         peg$cachedPos        = 0,
   99         peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  100         peg$maxFailPos       = 0,
  101         peg$maxFailExpected  = [],
  102         peg$silentFails      = 0,
  103 
  104         peg$result;
  105 
  106     if ("startRule" in options) {
  107       if (!(options.startRule in peg$startRuleFunctions)) {
  108         throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  109       }
  110 
  111       peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  112     }
  113 
  114     function text() {
  115       return input.substring(peg$reportedPos, peg$currPos);
  116     }
  117 
  118     function offset() {
  119       return peg$reportedPos;
  120     }
  121 
  122     function line() {
  123       return peg$computePosDetails(peg$reportedPos).line;
  124     }
  125 
  126     function column() {
  127       return peg$computePosDetails(peg$reportedPos).column;
  128     }
  129 
  130     function expected(description) {
  131       throw peg$buildException(
  132         null,
  133         [{ type: "other", description: description }],
  134         peg$reportedPos
  135       );
  136     }
  137 
  138     function error(message) {
  139       throw peg$buildException(message, null, peg$reportedPos);
  140     }
  141 
  142     function peg$computePosDetails(pos) {
  143       function advance(details, startPos, endPos) {
  144         var p, ch;
  145 
  146         for (p = startPos; p < endPos; p++) {
  147           ch = input.charAt(p);
  148           if (ch === "\n") {
  149             if (!details.seenCR) { details.line++; }
  150             details.column = 1;
  151             details.seenCR = false;
  152           } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  153             details.line++;
  154             details.column = 1;
  155             details.seenCR = true;
  156           } else {
  157             details.column++;
  158             details.seenCR = false;
  159           }
  160         }
  161       }
  162 
  163       if (peg$cachedPos !== pos) {
  164         if (peg$cachedPos > pos) {
  165           peg$cachedPos = 0;
  166           peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  167         }
  168         advance(peg$cachedPosDetails, peg$cachedPos, pos);
  169         peg$cachedPos = pos;
  170       }
  171 
  172       return peg$cachedPosDetails;
  173     }
  174 
  175     function peg$fail(expected) {
  176       if (peg$currPos < peg$maxFailPos) { return; }
  177 
  178       if (peg$currPos > peg$maxFailPos) {
  179         peg$maxFailPos = peg$currPos;
  180         peg$maxFailExpected = [];
  181       }
  182 
  183       peg$maxFailExpected.push(expected);
  184     }
  185 
  186     function peg$buildException(message, expected, pos) {
  187       function cleanupExpected(expected) {
  188         var i = 1;
  189 
  190         expected.sort(function(a, b) {
  191           if (a.description < b.description) {
  192             return -1;
  193           } else if (a.description > b.description) {
  194             return 1;
  195           } else {
  196             return 0;
  197           }
  198         });
  199 
  200         while (i < expected.length) {
  201           if (expected[i - 1] === expected[i]) {
  202             expected.splice(i, 1);
  203           } else {
  204             i++;
  205           }
  206         }
  207       }
  208 
  209       function buildMessage(expected, found) {
  210         function stringEscape(s) {
  211           function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  212 
  213           return s
  214             .replace(/\\/g,   '\\\\')
  215             .replace(/"/g,    '\\"')
  216             .replace(/\x08/g, '\\b')
  217             .replace(/\t/g,   '\\t')
  218             .replace(/\n/g,   '\\n')
  219             .replace(/\f/g,   '\\f')
  220             .replace(/\r/g,   '\\r')
  221             .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  222             .replace(/[\x10-\x1F\x80-\xFF]/g,    function(ch) { return '\\x'  + hex(ch); })
  223             .replace(/[\u0180-\u0FFF]/g,         function(ch) { return '\\u0' + hex(ch); })
  224             .replace(/[\u1080-\uFFFF]/g,         function(ch) { return '\\u'  + hex(ch); });
  225         }
  226 
  227         var expectedDescs = new Array(expected.length),
  228             expectedDesc, foundDesc, i;
  229 
  230         for (i = 0; i < expected.length; i++) {
  231           expectedDescs[i] = expected[i].description;
  232         }
  233 
  234         expectedDesc = expected.length > 1
  235           ? expectedDescs.slice(0, -1).join(", ")
  236               + " or "
  237               + expectedDescs[expected.length - 1]
  238           : expectedDescs[0];
  239 
  240         foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  241 
  242         return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  243       }
  244 
  245       var posDetails = peg$computePosDetails(pos),
  246           found      = pos < input.length ? input.charAt(pos) : null;
  247 
  248       if (expected !== null) {
  249         cleanupExpected(expected);
  250       }
  251 
  252       return new SyntaxError(
  253         message !== null ? message : buildMessage(expected, found),
  254         expected,
  255         found,
  256         pos,
  257         posDetails.line,
  258         posDetails.column
  259       );
  260     }
  261 
  262     function peg$parsestart() {
  263       var s0, s1, s2, s3;
  264 
  265       s0 = peg$currPos;
  266       s1 = peg$parse_();
  267       if (s1 !== peg$FAILED) {
  268         s2 = peg$parseselector();
  269         if (s2 !== peg$FAILED) {
  270           s3 = peg$parse_();
  271           if (s3 !== peg$FAILED) {
  272             peg$reportedPos = s0;
  273             s1 = peg$c1(s2);
  274             s0 = s1;
  275           } else {
  276             peg$currPos = s0;
  277             s0 = peg$c0;
  278           }
  279         } else {
  280           peg$currPos = s0;
  281           s0 = peg$c0;
  282         }
  283       } else {
  284         peg$currPos = s0;
  285         s0 = peg$c0;
  286       }
  287 
  288       return s0;
  289     }
  290 
  291     function peg$parsesegment() {
  292       var s0, s1, s2, s3, s4, s5;
  293 
  294       s0 = peg$currPos;
  295       s1 = peg$parse_();
  296       if (s1 !== peg$FAILED) {
  297         s2 = peg$currPos;
  298         s3 = [];
  299         if (peg$c3.test(input.charAt(peg$currPos))) {
  300           s4 = input.charAt(peg$currPos);
  301           peg$currPos++;
  302         } else {
  303           s4 = peg$FAILED;
  304           if (peg$silentFails === 0) { peg$fail(peg$c4); }
  305         }
  306         if (s4 !== peg$FAILED) {
  307           while (s4 !== peg$FAILED) {
  308             s3.push(s4);
  309             if (peg$c3.test(input.charAt(peg$currPos))) {
  310               s4 = input.charAt(peg$currPos);
  311               peg$currPos++;
  312             } else {
  313               s4 = peg$FAILED;
  314               if (peg$silentFails === 0) { peg$fail(peg$c4); }
  315             }
  316           }
  317         } else {
  318           s3 = peg$c0;
  319         }
  320         if (s3 !== peg$FAILED) {
  321           s4 = [];
  322           if (peg$c5.test(input.charAt(peg$currPos))) {
  323             s5 = input.charAt(peg$currPos);
  324             peg$currPos++;
  325           } else {
  326             s5 = peg$FAILED;
  327             if (peg$silentFails === 0) { peg$fail(peg$c6); }
  328           }
  329           while (s5 !== peg$FAILED) {
  330             s4.push(s5);
  331             if (peg$c5.test(input.charAt(peg$currPos))) {
  332               s5 = input.charAt(peg$currPos);
  333               peg$currPos++;
  334             } else {
  335               s5 = peg$FAILED;
  336               if (peg$silentFails === 0) { peg$fail(peg$c6); }
  337             }
  338           }
  339           if (s4 !== peg$FAILED) {
  340             s3 = [s3, s4];
  341             s2 = s3;
  342           } else {
  343             peg$currPos = s2;
  344             s2 = peg$c0;
  345           }
  346         } else {
  347           peg$currPos = s2;
  348           s2 = peg$c0;
  349         }
  350         if (s2 !== peg$FAILED) {
  351           s3 = peg$parse_();
  352           if (s3 !== peg$FAILED) {
  353             peg$reportedPos = s0;
  354             s1 = peg$c7(s2);
  355             s0 = s1;
  356           } else {
  357             peg$currPos = s0;
  358             s0 = peg$c0;
  359           }
  360         } else {
  361           peg$currPos = s0;
  362           s0 = peg$c0;
  363         }
  364       } else {
  365         peg$currPos = s0;
  366         s0 = peg$c0;
  367       }
  368       if (s0 === peg$FAILED) {
  369         s0 = peg$currPos;
  370         s1 = peg$parse_();
  371         if (s1 !== peg$FAILED) {
  372           if (peg$c8.test(input.charAt(peg$currPos))) {
  373             s2 = input.charAt(peg$currPos);
  374             peg$currPos++;
  375           } else {
  376             s2 = peg$FAILED;
  377             if (peg$silentFails === 0) { peg$fail(peg$c9); }
  378           }
  379           if (s2 !== peg$FAILED) {
  380             s3 = peg$parse_();
  381             if (s3 !== peg$FAILED) {
  382               peg$reportedPos = s0;
  383               s1 = peg$c10(s2);
  384               s0 = s1;
  385             } else {
  386               peg$currPos = s0;
  387               s0 = peg$c0;
  388             }
  389           } else {
  390             peg$currPos = s0;
  391             s0 = peg$c0;
  392           }
  393         } else {
  394           peg$currPos = s0;
  395           s0 = peg$c0;
  396         }
  397       }
  398 
  399       return s0;
  400     }
  401 
  402     function peg$parsescope() {
  403       var s0, s1, s2, s3, s4, s5;
  404 
  405       s0 = peg$currPos;
  406       s1 = peg$parsesegment();
  407       if (s1 !== peg$FAILED) {
  408         s2 = [];
  409         s3 = peg$currPos;
  410         if (input.charCodeAt(peg$currPos) === 46) {
  411           s4 = peg$c11;
  412           peg$currPos++;
  413         } else {
  414           s4 = peg$FAILED;
  415           if (peg$silentFails === 0) { peg$fail(peg$c12); }
  416         }
  417         if (s4 !== peg$FAILED) {
  418           s5 = peg$parsesegment();
  419           if (s5 !== peg$FAILED) {
  420             s4 = [s4, s5];
  421             s3 = s4;
  422           } else {
  423             peg$currPos = s3;
  424             s3 = peg$c0;
  425           }
  426         } else {
  427           peg$currPos = s3;
  428           s3 = peg$c0;
  429         }
  430         while (s3 !== peg$FAILED) {
  431           s2.push(s3);
  432           s3 = peg$currPos;
  433           if (input.charCodeAt(peg$currPos) === 46) {
  434             s4 = peg$c11;
  435             peg$currPos++;
  436           } else {
  437             s4 = peg$FAILED;
  438             if (peg$silentFails === 0) { peg$fail(peg$c12); }
  439           }
  440           if (s4 !== peg$FAILED) {
  441             s5 = peg$parsesegment();
  442             if (s5 !== peg$FAILED) {
  443               s4 = [s4, s5];
  444               s3 = s4;
  445             } else {
  446               peg$currPos = s3;
  447               s3 = peg$c0;
  448             }
  449           } else {
  450             peg$currPos = s3;
  451             s3 = peg$c0;
  452           }
  453         }
  454         if (s2 !== peg$FAILED) {
  455           peg$reportedPos = s0;
  456           s1 = peg$c13(s1, s2);
  457           s0 = s1;
  458         } else {
  459           peg$currPos = s0;
  460           s0 = peg$c0;
  461         }
  462       } else {
  463         peg$currPos = s0;
  464         s0 = peg$c0;
  465       }
  466 
  467       return s0;
  468     }
  469 
  470     function peg$parsepath() {
  471       var s0, s1, s2, s3, s4, s5, s6;
  472 
  473       s0 = peg$currPos;
  474       s1 = peg$currPos;
  475       if (peg$c15.test(input.charAt(peg$currPos))) {
  476         s2 = input.charAt(peg$currPos);
  477         peg$currPos++;
  478       } else {
  479         s2 = peg$FAILED;
  480         if (peg$silentFails === 0) { peg$fail(peg$c16); }
  481       }
  482       if (s2 !== peg$FAILED) {
  483         if (input.charCodeAt(peg$currPos) === 58) {
  484           s3 = peg$c17;
  485           peg$currPos++;
  486         } else {
  487           s3 = peg$FAILED;
  488           if (peg$silentFails === 0) { peg$fail(peg$c18); }
  489         }
  490         if (s3 !== peg$FAILED) {
  491           s2 = [s2, s3];
  492           s1 = s2;
  493         } else {
  494           peg$currPos = s1;
  495           s1 = peg$c0;
  496         }
  497       } else {
  498         peg$currPos = s1;
  499         s1 = peg$c0;
  500       }
  501       if (s1 === peg$FAILED) {
  502         s1 = peg$c14;
  503       }
  504       if (s1 !== peg$FAILED) {
  505         s2 = peg$parsescope();
  506         if (s2 !== peg$FAILED) {
  507           s3 = [];
  508           s4 = peg$currPos;
  509           s5 = peg$parse_();
  510           if (s5 !== peg$FAILED) {
  511             s6 = peg$parsescope();
  512             if (s6 !== peg$FAILED) {
  513               s5 = [s5, s6];
  514               s4 = s5;
  515             } else {
  516               peg$currPos = s4;
  517               s4 = peg$c0;
  518             }
  519           } else {
  520             peg$currPos = s4;
  521             s4 = peg$c0;
  522           }
  523           while (s4 !== peg$FAILED) {
  524             s3.push(s4);
  525             s4 = peg$currPos;
  526             s5 = peg$parse_();
  527             if (s5 !== peg$FAILED) {
  528               s6 = peg$parsescope();
  529               if (s6 !== peg$FAILED) {
  530                 s5 = [s5, s6];
  531                 s4 = s5;
  532               } else {
  533                 peg$currPos = s4;
  534                 s4 = peg$c0;
  535               }
  536             } else {
  537               peg$currPos = s4;
  538               s4 = peg$c0;
  539             }
  540           }
  541           if (s3 !== peg$FAILED) {
  542             peg$reportedPos = s0;
  543             s1 = peg$c19(s1, s2, s3);
  544             s0 = s1;
  545           } else {
  546             peg$currPos = s0;
  547             s0 = peg$c0;
  548           }
  549         } else {
  550           peg$currPos = s0;
  551           s0 = peg$c0;
  552         }
  553       } else {
  554         peg$currPos = s0;
  555         s0 = peg$c0;
  556       }
  557 
  558       return s0;
  559     }
  560 
  561     function peg$parsegroup() {
  562       var s0, s1, s2, s3, s4, s5, s6;
  563 
  564       s0 = peg$currPos;
  565       s1 = peg$currPos;
  566       if (peg$c15.test(input.charAt(peg$currPos))) {
  567         s2 = input.charAt(peg$currPos);
  568         peg$currPos++;
  569       } else {
  570         s2 = peg$FAILED;
  571         if (peg$silentFails === 0) { peg$fail(peg$c16); }
  572       }
  573       if (s2 !== peg$FAILED) {
  574         if (input.charCodeAt(peg$currPos) === 58) {
  575           s3 = peg$c17;
  576           peg$currPos++;
  577         } else {
  578           s3 = peg$FAILED;
  579           if (peg$silentFails === 0) { peg$fail(peg$c18); }
  580         }
  581         if (s3 !== peg$FAILED) {
  582           s2 = [s2, s3];
  583           s1 = s2;
  584         } else {
  585           peg$currPos = s1;
  586           s1 = peg$c0;
  587         }
  588       } else {
  589         peg$currPos = s1;
  590         s1 = peg$c0;
  591       }
  592       if (s1 === peg$FAILED) {
  593         s1 = peg$c14;
  594       }
  595       if (s1 !== peg$FAILED) {
  596         if (input.charCodeAt(peg$currPos) === 40) {
  597           s2 = peg$c20;
  598           peg$currPos++;
  599         } else {
  600           s2 = peg$FAILED;
  601           if (peg$silentFails === 0) { peg$fail(peg$c21); }
  602         }
  603         if (s2 !== peg$FAILED) {
  604           s3 = peg$parse_();
  605           if (s3 !== peg$FAILED) {
  606             s4 = peg$parseselector();
  607             if (s4 !== peg$FAILED) {
  608               s5 = peg$parse_();
  609               if (s5 !== peg$FAILED) {
  610                 if (input.charCodeAt(peg$currPos) === 41) {
  611                   s6 = peg$c22;
  612                   peg$currPos++;
  613                 } else {
  614                   s6 = peg$FAILED;
  615                   if (peg$silentFails === 0) { peg$fail(peg$c23); }
  616                 }
  617                 if (s6 !== peg$FAILED) {
  618                   peg$reportedPos = s0;
  619                   s1 = peg$c24(s1, s4);
  620                   s0 = s1;
  621                 } else {
  622                   peg$currPos = s0;
  623                   s0 = peg$c0;
  624                 }
  625               } else {
  626                 peg$currPos = s0;
  627                 s0 = peg$c0;
  628               }
  629             } else {
  630               peg$currPos = s0;
  631               s0 = peg$c0;
  632             }
  633           } else {
  634             peg$currPos = s0;
  635             s0 = peg$c0;
  636           }
  637         } else {
  638           peg$currPos = s0;
  639           s0 = peg$c0;
  640         }
  641       } else {
  642         peg$currPos = s0;
  643         s0 = peg$c0;
  644       }
  645 
  646       return s0;
  647     }
  648 
  649     function peg$parseexpression() {
  650       var s0, s1, s2, s3, s4;
  651 
  652       s0 = peg$currPos;
  653       if (input.charCodeAt(peg$currPos) === 45) {
  654         s1 = peg$c25;
  655         peg$currPos++;
  656       } else {
  657         s1 = peg$FAILED;
  658         if (peg$silentFails === 0) { peg$fail(peg$c26); }
  659       }
  660       if (s1 !== peg$FAILED) {
  661         s2 = peg$parse_();
  662         if (s2 !== peg$FAILED) {
  663           s3 = peg$parsegroup();
  664           if (s3 !== peg$FAILED) {
  665             s4 = peg$parse_();
  666             if (s4 !== peg$FAILED) {
  667               peg$reportedPos = s0;
  668               s1 = peg$c27(s3);
  669               s0 = s1;
  670             } else {
  671               peg$currPos = s0;
  672               s0 = peg$c0;
  673             }
  674           } else {
  675             peg$currPos = s0;
  676             s0 = peg$c0;
  677           }
  678         } else {
  679           peg$currPos = s0;
  680           s0 = peg$c0;
  681         }
  682       } else {
  683         peg$currPos = s0;
  684         s0 = peg$c0;
  685       }
  686       if (s0 === peg$FAILED) {
  687         s0 = peg$currPos;
  688         if (input.charCodeAt(peg$currPos) === 45) {
  689           s1 = peg$c25;
  690           peg$currPos++;
  691         } else {
  692           s1 = peg$FAILED;
  693           if (peg$silentFails === 0) { peg$fail(peg$c26); }
  694         }
  695         if (s1 !== peg$FAILED) {
  696           s2 = peg$parse_();
  697           if (s2 !== peg$FAILED) {
  698             s3 = peg$parsepath();
  699             if (s3 !== peg$FAILED) {
  700               s4 = peg$parse_();
  701               if (s4 !== peg$FAILED) {
  702                 peg$reportedPos = s0;
  703                 s1 = peg$c28(s3);
  704                 s0 = s1;
  705               } else {
  706                 peg$currPos = s0;
  707                 s0 = peg$c0;
  708               }
  709             } else {
  710               peg$currPos = s0;
  711               s0 = peg$c0;
  712             }
  713           } else {
  714             peg$currPos = s0;
  715             s0 = peg$c0;
  716           }
  717         } else {
  718           peg$currPos = s0;
  719           s0 = peg$c0;
  720         }
  721         if (s0 === peg$FAILED) {
  722           s0 = peg$parsegroup();
  723           if (s0 === peg$FAILED) {
  724             s0 = peg$parsepath();
  725           }
  726         }
  727       }
  728 
  729       return s0;
  730     }
  731 
  732     function peg$parsecomposite() {
  733       var s0, s1, s2, s3, s4, s5;
  734 
  735       s0 = peg$currPos;
  736       s1 = peg$parseexpression();
  737       if (s1 !== peg$FAILED) {
  738         s2 = peg$parse_();
  739         if (s2 !== peg$FAILED) {
  740           if (peg$c29.test(input.charAt(peg$currPos))) {
  741             s3 = input.charAt(peg$currPos);
  742             peg$currPos++;
  743           } else {
  744             s3 = peg$FAILED;
  745             if (peg$silentFails === 0) { peg$fail(peg$c30); }
  746           }
  747           if (s3 !== peg$FAILED) {
  748             s4 = peg$parse_();
  749             if (s4 !== peg$FAILED) {
  750               s5 = peg$parsecomposite();
  751               if (s5 !== peg$FAILED) {
  752                 peg$reportedPos = s0;
  753                 s1 = peg$c31(s1, s3, s5);
  754                 s0 = s1;
  755               } else {
  756                 peg$currPos = s0;
  757                 s0 = peg$c0;
  758               }
  759             } else {
  760               peg$currPos = s0;
  761               s0 = peg$c0;
  762             }
  763           } else {
  764             peg$currPos = s0;
  765             s0 = peg$c0;
  766           }
  767         } else {
  768           peg$currPos = s0;
  769           s0 = peg$c0;
  770         }
  771       } else {
  772         peg$currPos = s0;
  773         s0 = peg$c0;
  774       }
  775       if (s0 === peg$FAILED) {
  776         s0 = peg$parseexpression();
  777       }
  778 
  779       return s0;
  780     }
  781 
  782     function peg$parseselector() {
  783       var s0, s1, s2, s3, s4, s5;
  784 
  785       s0 = peg$currPos;
  786       s1 = peg$parsecomposite();
  787       if (s1 !== peg$FAILED) {
  788         s2 = peg$parse_();
  789         if (s2 !== peg$FAILED) {
  790           if (input.charCodeAt(peg$currPos) === 44) {
  791             s3 = peg$c32;
  792             peg$currPos++;
  793           } else {
  794             s3 = peg$FAILED;
  795             if (peg$silentFails === 0) { peg$fail(peg$c33); }
  796           }
  797           if (s3 !== peg$FAILED) {
  798             s4 = peg$parse_();
  799             if (s4 !== peg$FAILED) {
  800               s5 = peg$parseselector();
  801               if (s5 === peg$FAILED) {
  802                 s5 = peg$c14;
  803               }
  804               if (s5 !== peg$FAILED) {
  805                 peg$reportedPos = s0;
  806                 s1 = peg$c34(s1, s5);
  807                 s0 = s1;
  808               } else {
  809                 peg$currPos = s0;
  810                 s0 = peg$c0;
  811               }
  812             } else {
  813               peg$currPos = s0;
  814               s0 = peg$c0;
  815             }
  816           } else {
  817             peg$currPos = s0;
  818             s0 = peg$c0;
  819           }
  820         } else {
  821           peg$currPos = s0;
  822           s0 = peg$c0;
  823         }
  824       } else {
  825         peg$currPos = s0;
  826         s0 = peg$c0;
  827       }
  828       if (s0 === peg$FAILED) {
  829         s0 = peg$parsecomposite();
  830       }
  831 
  832       return s0;
  833     }
  834 
  835     function peg$parse_() {
  836       var s0, s1;
  837 
  838       s0 = [];
  839       if (peg$c35.test(input.charAt(peg$currPos))) {
  840         s1 = input.charAt(peg$currPos);
  841         peg$currPos++;
  842       } else {
  843         s1 = peg$FAILED;
  844         if (peg$silentFails === 0) { peg$fail(peg$c36); }
  845       }
  846       while (s1 !== peg$FAILED) {
  847         s0.push(s1);
  848         if (peg$c35.test(input.charAt(peg$currPos))) {
  849           s1 = input.charAt(peg$currPos);
  850           peg$currPos++;
  851         } else {
  852           s1 = peg$FAILED;
  853           if (peg$silentFails === 0) { peg$fail(peg$c36); }
  854         }
  855       }
  856 
  857       return s0;
  858     }
  859 
  860      var matchers = require('./scope-selector-matchers'); 
  861 
  862     peg$result = peg$startRuleFunction();
  863 
  864     if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  865       return peg$result;
  866     } else {
  867       if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  868         peg$fail({ type: "end", description: "end of input" });
  869       }
  870 
  871       throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  872     }
  873   }
  874 
  875   return {
  876     SyntaxError: SyntaxError,
  877     parse:       parse
  878   };
  879 })();