/*
<with list> ::= <with list element> [ { <comma> <with list element> } ]
174691
private void XreadWithList(WithList withList) {
        // <with list element> ::= <query name>
        //                         [ <left paren> <with column list> <right paren> ]
        //                         AS <left paren> <query expression> <right paren>
        //                         [ <search or cycle clause> ]
        //
        boolean recursive = withList.isRecursive();
        for (boolean done = false; ! done; done = ! readIfThis(Tokens.COMMA)) {
            HsqlName queryName = readNewSchemaObjectName(SchemaObject.TABLE);
            queryName.setSchemaIfNull(session.getCurrentSchemaHsqlName());
            List<HsqlName> columnNames = parseColumnNames();
            readThis(Tokens.AS);
            readThis(Tokens.OPENBRACKET);
            // Read a query.  If it's recursive it has to be of the form:
            //    Q1 union all Q2.
            // In Q1 we can't use an order by or limit.  It's ok
            // to use group by, aggregates and having, though.  The
            // query name will be visible in Q2 but not in Q1.
            //
            // If this with statement is not recursive then anything goes,
            // but the query name will not be visible in the query.
            QueryExpression baseQueryExpression = null;
            QueryExpression recursionQueryExpression = null;
            // This is not really standard behavior.  This should
            // really be just reading a query expression.  However,
            // This short circuits a great deal of complexity, and
            // will serve for prototype purposes.
            if (recursive) {
                baseQueryExpression = XreadQueryPrimary();
            } else {
                baseQueryExpression = XreadQueryExpressionBodyAndSortAndSlice();
            }
            // We have to resolve this here because we need
            // to fetch the types and perhaps the column aliases.
            // But we can't define the table now, because it is
            // not visible in the base query expression.
            baseQueryExpression.resolve(session);
            //
            // Calculate the schema of the common table.
            //
            HsqlName[] colNames = null;
            if (columnNames != null) {
                colNames = columnNames.toArray(new HsqlName[columnNames.size()]);
            } else {
                String[] queryNames = baseQueryExpression.getColumnNames();
                colNames = new HsqlName[queryNames.length];
                for (int idx = 0; idx < queryNames.length; idx += 1) {
                    String queryColumnName = queryNames[idx];
                    colNames[idx] = database.nameManager.newHsqlName(queryColumnName,
                                                                     false,
                                                                     SchemaObject.COLUMN);
                }
            }
            Type[] colTypes = baseQueryExpression.getColumnTypes();
            String cmp = null;
            if (colNames.length > colTypes.length) {
                cmp = "many";
            }
            else if (colNames.length < colTypes.length) {
                cmp = "few";
            }
            if (cmp != null) {
                throw Error.error("Too " + cmp + " column names in common table expression " + queryName.name);
            }
            // Now, define it.
            Table newTable = session.defineLocalTable(queryName, colNames, colTypes);
            if (recursive) {
                readThis(Tokens.UNION);
                readThis(Tokens.ALL);
                recursionQueryExpression = XreadQueryExpressionBody();
            }
            readThis(Tokens.CLOSEBRACKET);
            WithExpression withExpression = new WithExpression();
            withExpression.setQueryName(queryName);
            withExpression.setBaseQuery(baseQueryExpression);
            withExpression.setRecursiveQuery(recursionQueryExpression);
            withExpression.setTable(newTable);
            withList.add(withExpression);
        }
    }
1126629
function(sel) {
      if (!this.length) {
        return this;
      }
      var matched = [],
    	 		el = this[0];

    	while (el = el.nextElementSibling) {
    		sel ?
    			(u(el).is(sel) && matched.push(el)) :
    			matched.push(el);
    	}
    	return u(matched);
    }
755486
private ComparableExpression extractComparableExpression(GDLParser.ComparisonElementContext element) {
    if(element.literal() != null) {
      return new Literal(getPropertyValue(element.literal()));
    } else if(element.propertyLookup() != null) {
      return buildPropertySelector(element.propertyLookup());
    } else {
      return new ElementSelector(element.Identifier().getText());
    }
  }
1272622
function (list) {
            if (list.size() !== this.size()) {
                return false;
            }
            var isEqual = true,
                a, b;
            for (var i = 0; i < this.$items.length; i++) {
                a = this.$items[i];
                b = list.at(i);
                if (a instanceof Bindable && b instanceof Bindable) {
                    if (!a.isDeepEqual(b)) {
                        return false;
                    }
                } else if (a instanceof Bindable || b instanceof Bindable) {
                    return false;
                } else {
                    isEqual = _.isEqual(a, b);
                }
            }

            return isEqual;
        }
220034
function indexOf(list, element, comparator) {
			for (var i=0,item; item=list[i]; i++) {
				if (equals(item, element, comparator)) {
					return i;
				}
			}
			return -1;
		}
163953
function commaSeparated (fn, inp, cb) {
    var all = [], res;
    while (1) {
      res = fn(inp);
      if ((res && !cb) || (res && cb(res, inp))) {
        all.push(res);
        if (inp.skipWs().takeAPeek(",")) {
          inp.skipWs();
        } else break;
      } else break;
    }
    return all;
  }
22045
protected List<TokenList.Token> parseParameterCommaBlock( TokenList tokens, Sequence sequence ) {
        // find all the comma tokens
        List<TokenList.Token> commas = new ArrayList<TokenList.Token>();
        TokenList.Token token = tokens.first;

        int numBracket = 0;
        while( token != null ) {
            if( token.getType() == Type.SYMBOL ) {
                switch( token.getSymbol() ) {
                    case COMMA:
                        if( numBracket == 0)
                            commas.add(token);
                    break;

                    case BRACKET_LEFT: numBracket++; break;
                    case BRACKET_RIGHT: numBracket--; break;
                }
            }
            token = token.next;
        }

        List<TokenList.Token> output = new ArrayList<TokenList.Token>();
        if( commas.isEmpty() ) {
            output.add(parseBlockNoParentheses(tokens, sequence, false));
        } else {
            TokenList.Token before = tokens.first;
            for (int i = 0; i < commas.size(); i++) {
                TokenList.Token after = commas.get(i);
                if( before == after )
                    throw new ParseError("No empty function inputs allowed!");
                TokenList.Token tmp = after.next;
                TokenList sublist = tokens.extractSubList(before,after);
                sublist.remove(after);// remove the comma
                output.add(parseBlockNoParentheses(sublist, sequence, false));
                before = tmp;
            }

            // if the last character is a comma then after.next above will be null and thus before is null
            if( before == null )
                throw new ParseError("No empty function inputs allowed!");

            TokenList.Token after = tokens.last;
            TokenList sublist = tokens.extractSubList(before, after);
            output.add(parseBlockNoParentheses(sublist, sequence, false));
        }

        return output;
    }
530129
@Override
  protected boolean equalElements(KTypeVTypeHashMap<?, ?> other) {
    if (other.size() != size()) {
      return false;
    }

    Iterator<? extends KTypeVTypeCursor<?, ?>> i = other.iterator();
    while (i.hasNext()) {
      KTypeVTypeCursor<?, ?> c = i.next();
      KType key = Intrinsics.<KType> cast(c.key);
      if (!containsKey(key) ||
          !equals(get(key), c.value)) {   // Compare values using the same function as keys.
        return false;
      }
    }

    return true;
  }
1021467
private ParseTree parseArrayLiteral() {
    // ArrayLiteral :
    //   [ Elisionopt ]
    //   [ ElementList ]
    //   [ ElementList , Elisionopt ]
    //
    // ElementList :
    //   Elisionopt AssignmentOrSpreadExpression
    //   ElementList , Elisionopt AssignmentOrSpreadExpression
    //
    // Elision :
    //   ,
    //   Elision ,

    SourcePosition start = getTreeStartLocation();
    ImmutableList.Builder<ParseTree> elements = ImmutableList.builder();

    eat(TokenType.OPEN_SQUARE);
    Token trailingCommaToken = null;
    while (peek(TokenType.COMMA) || peek(TokenType.SPREAD) || peekAssignmentExpression()) {
      trailingCommaToken = null;
      if (peek(TokenType.COMMA)) {
        elements.add(new NullTree(getTreeLocation(getTreeStartLocation())));
      } else {
        if (peek(TokenType.SPREAD)) {
          recordFeatureUsed(Feature.SPREAD_EXPRESSIONS);
          elements.add(parseSpreadExpression());
        } else {
          elements.add(parseAssignmentExpression());
        }
      }
      if (!peek(TokenType.CLOSE_SQUARE)) {
        trailingCommaToken = eat(TokenType.COMMA);
      }
    }
    eat(TokenType.CLOSE_SQUARE);

    maybeReportTrailingComma(trailingCommaToken);

    return new ArrayLiteralExpressionTree(
        getTreeLocation(start), elements.build());
  }
366301
private void eatExpression() {
        List segments = new ArrayList();
        eatSplicedRange(segments);
        list.add(segments);
        if (tokenizer.hasMoreTokens()) {// ∈
            tokenizer.peekToken(0, TokenKind.COMMA);
            tokenizer.nextToken();
            eatExpression();
        }
    }
578646
function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
            var saveParsingContext = parsingContext;
            parsingContext |= 1 << kind;
            var result = [];
            result.pos = getNodePos();
            var commaStart = -1; // Meaning the previous token was not a comma
            while (true) {
                if (isListElement(kind, /*inErrorRecovery*/ false)) {
                    result.push(parseListElement(kind, parseElement));
                    commaStart = scanner.getTokenPos();
                    if (parseOptional(24 /* CommaToken */)) {
                        continue;
                    }
                    commaStart = -1; // Back to the state where the last token was not a comma
                    if (isListTerminator(kind)) {
                        break;
                    }
                    // We didn't get a comma, and the list wasn't terminated, explicitly parse
                    // out a comma so we give a good error message.
                    parseExpected(24 /* CommaToken */);
                    // If the token was a semicolon, and the caller allows that, then skip it and
                    // continue.  This ensures we get back on track and don't result in tons of
                    // parse errors.  For example, this can happen when people do things like use
                    // a semicolon to delimit object literal members.   Note: we'll have already
                    // reported an error when we called parseExpected above.
                    if (considerSemicolonAsDelimiter && token() === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) {
                        nextToken();
                    }
                    continue;
                }
                if (isListTerminator(kind)) {
                    break;
                }
                if (abortParsingListOrMoveToNextToken(kind)) {
                    break;
                }
            }
            // Recording the trailing comma is deliberately done after the previous
            // loop, and not just if we see a list terminator. This is because the list
            // may have ended incorrectly, but it is still important to know if there
            // was a trailing comma.
            // Check if the last token was a comma.
            if (commaStart >= 0) {
                // Always preserve a trailing comma by marking it on the NodeArray
                result.hasTrailingComma = true;
            }
            result.end = getNodeEnd();
            parsingContext = saveParsingContext;
            return result;
        }
277965
public static String joinByComma( List<String> items ) {
        StringBuilder sb = new StringBuilder();
        for( String item : items ) {
            sb.append(",").append(item);
        }
        if (sb.length() == 0) {
            return "";
        }
        return sb.substring(1);
    }
350987
public static String joiningWithDelimiter(CharSequence delimiter,
            List<String> stringList) {
        return joiningWith(stringList.stream(), delimiter);
    }
587670
protected final boolean complies(final String value, final String constValue, final String separators) {
        if (value == null) {
            return false;
        } else {
            final StringTokenizer tok = new StringTokenizer(value, separators);
            while (tok.hasMoreTokens()) {
                final String t = tok.nextToken();
                if (t.equals(constValue)) {
                    return true;
                }
            }
            return false;
        }

    }
228020
function(sel) {
      if (!this.length) {
        return this;
      }
      var matched = [],
    	 		el = this[0];

    	while (el = el.previousElementSibling) {
    		sel ?
    			(u(el).is(sel) && matched.push(el)) :
    			matched.push(el);
    	}
    	return u(matched);
    }
863355
public static boolean sameLists(String list1, String list2)
    {
        return new CommaListIterator(list1).equals(new CommaListIterator(list2));
    }
945144
private boolean hasDelimiter(String s1, String s2, String delimiter) {
    return s1.contains(delimiter) && s2.contains(delimiter) && s1.split(delimiter).length == s2.split(delimiter).length;
  }