Called when the parser leaves a WHERE expression

Takes care that the filter build from the current expression is stored
in the graph

@param ctx where context
171567
@Override
  public void exitWhere(GDLParser.WhereContext ctx) {
    addPredicates(Collections.singletonList(currentPredicates.pop()));
  }
988293
@Override
	public T visitNamedExpr(NamedExprContext ctx) {
		//on(ctx);
		appendAst(ctx, tok(NAMED_EXPRESSION));
		return super.visitNamedExpr(ctx);
	}
1237072
@Override
  public void exitQuery(GDLParser.QueryContext ctx) {
    for(Vertex v : vertices) {
      addPredicates(Predicate.fromGraphElement(v, getDefaultVertexLabel()));
    }
    for(Edge e : edges) {
      addPredicates(Predicate.fromGraphElement(e, getDefaultEdgeLabel()));
    }
  }
524847
function filterInPlace(a, fn, ctxt) {
  for (var i = 0; i < a.length; i++) {
    if (!fn.call(ctxt, a[i], i, a)) {
      a.splice(i--, 1);
    }
  }
  return a;
}
1238550
function _parseSelector(ctx) {
            var selector = "";

            // Skip over {
            TokenUtils.movePrevToken(ctx);

            while (true) {
                if (ctx.token.type !== "comment") {
                    // Stop once we've reached a {, }, or ;
                    if (/[\{\}\;]/.test(ctx.token.string)) {
                        break;
                    }

                    // Stop once we've reached a <style ...> tag
                    if (ctx.token.string === "style" && ctx.token.type === "tag") {
                        // Remove everything up to end-of-tag from selector
                        var eotIndex = selector.indexOf(">");
                        if (eotIndex !== -1) {
                            selector = selector.substring(eotIndex + 1);
                        }
                        break;
                    }

                    selector = ctx.token.string + selector;
                }
                if (!TokenUtils.movePrevToken(ctx)) {
                    break;
                }
            }

            return selector;
        }
1045690
private void setFkWhere(Where<MetadataReference, Void> where, long fileId,
			Long parentId) throws SQLException {

		where.eq(MetadataReference.COLUMN_FILE_ID, fileId);
		if (parentId == null) {
			where.and().isNull(MetadataReference.COLUMN_PARENT_ID);
		} else {
			where.and().eq(MetadataReference.COLUMN_PARENT_ID, parentId);
		}

	}
107769
public void handle(ASTNode node, GroovyParser.GroovyParserRuleContext ctx) {
        if (!(groovydocEnabled || runtimeGroovydocEnabled)) {
            return;
        }

        if (!asBoolean(node) || !asBoolean(ctx)) {
            return;
        }

        String docCommentNodeText = this.findDocCommentByNode(ctx);
        if (null == docCommentNodeText) {
            return;
        }

        attachDocCommentAsMetaData(node, docCommentNodeText);
        attachGroovydocAnnotation(node, docCommentNodeText);
    }
1249145
private void decideTypeFilterToAdd(Filter filter) {
        Filter step = filter;

        if (Operator.MATCH == step.getRelation().getOperator() ||
                step.getRelation().getRightTerm() instanceof FunctionSelector) {
            if (matchList.isEmpty()) {
                matchList = new ArrayList<>();
            }
            matchList.add(filter);
        } else {
            if (filterList.isEmpty()) {
                filterList = new ArrayList<>();
            }
            filterList.add(filter);
        }
    }
685254
public void doPostProcessing(ApplicationContext ctx) {
        checkInitialised();
        for (GrailsPlugin plugin : pluginList) {
            if(isPluginDisabledForProfile(plugin)) continue;
            if (plugin.supportsCurrentScopeAndEnvironment()) {
                plugin.doWithApplicationContext(ctx);
            }
        }
    }
445648
@Override
    public Object visitConcatenation(ExcellentParser.ConcatenationContext ctx) {
        String arg1 = Conversions.toString(visit(ctx.expression(0)), m_evalContext);
        String arg2 = Conversions.toString(visit(ctx.expression(1)), m_evalContext);
        return arg1 + arg2;
    }
1140346
private void doCustomOption(final CustomOptionContext ctx, final ParserRuleContext parentCtx) {
    locationBuilder.addLocation().setAllSpan(parentCtx);


    locationBuilder.addOptionLocation().setAllSpan(parentCtx).comments(parentCtx)

    .addOptionNameLocation().setAllSpan(ctx.customOptionName());

    for (final CustomOptionNamePartContext namePart : ctx.customOptionName().customOptionNamePart()) {
      locationBuilder
          .addLocationForPrimitive(UninterpretedOption.NAME_FIELD_NUMBER)
          .setAllSpan(namePart)

          .addLocationForPrimitive(UninterpretedOption.NamePart.NAME_PART_FIELD_NUMBER)
          .setAllSpan(
              namePart.customOptionNamePartId() == null ? namePart.identifier() : namePart
                  .customOptionNamePartId());
    }

    // exit OptionName scope
    locationBuilder.popScope();

    // customOption value locations: can be scalar or aggregate!

    final CustomOptionValueContext customOptionValue = ctx.customOptionValue();
    int valuePath;

    if (customOptionValue.optionAggregateValue() != null) {
      valuePath = UninterpretedOption.AGGREGATE_VALUE_FIELD_NUMBER;
    } else {
      final OptionScalarValueContext optionScalarValue = customOptionValue.optionScalarValue();

      if (optionScalarValue.doubleValue() != null) {
        valuePath = UninterpretedOption.DOUBLE_VALUE_FIELD_NUMBER;
      } else if (optionScalarValue.identifier() != null) {
        valuePath = UninterpretedOption.IDENTIFIER_VALUE_FIELD_NUMBER;
      } else if (optionScalarValue.StringLiteral() != null
          || optionScalarValue.BooleanLiteral() != null) {
        valuePath = UninterpretedOption.STRING_VALUE_FIELD_NUMBER;
      } else if (optionScalarValue.NegativeIntegerLiteral() != null) {
        valuePath = UninterpretedOption.NEGATIVE_INT_VALUE_FIELD_NUMBER;
      } else if (optionScalarValue.IntegerLiteral() != null) {
        valuePath = UninterpretedOption.POSITIVE_INT_VALUE_FIELD_NUMBER;
      } else { // we shouldn't arrive here!
        throw new RuntimeException("custom option value has unidentified type!");
      }
    }

    locationBuilder.addLocationForPrimitive(valuePath).setAllSpan(customOptionValue)

    // exit Option scope
        .popScope();

    // should the aggregate locations be added here? BTW, protoc fails on
    // aggregates!
  }
442351
@Override
	public T visitAnonExpr(AnonExprContext ctx) {
//		on(ctx);
		appendAst(ctx, tok(ANONYMOUS_EXPRESSION));
		return super.visitAnonExpr(ctx);
	}
97401
public AbstractExpression getAllFilters() {
        ArrayDeque<JoinNode> joinNodes = new ArrayDeque<>();
        ArrayDeque<AbstractExpression> in = new ArrayDeque<>();
        ArrayDeque<AbstractExpression> out = new ArrayDeque<>();
        // Iterate over the join nodes to collect their join and where expressions
        joinNodes.add(this);
        while (!joinNodes.isEmpty()) {
            JoinNode joinNode = joinNodes.poll();
            if (joinNode.m_joinExpr != null) {
                in.add(joinNode.m_joinExpr);
            }
            if (joinNode.m_whereExpr != null) {
                in.add(joinNode.m_whereExpr);
            }
            joinNode.queueChildren(joinNodes);
        }

        // this chunk of code breaks the code into a list of expression that
        // all have to be true for the where clause to be true
        AbstractExpression inExpr = null;
        while ((inExpr = in.poll()) != null) {
            if (inExpr.getExpressionType() == ExpressionType.CONJUNCTION_AND) {
                in.add(inExpr.getLeft());
                in.add(inExpr.getRight());
            }
            else {
                out.add(inExpr);
            }
        }
        return ExpressionUtil.combinePredicates(out);
    }
943076
@Override
    public boolean filter(Event event) {
        JXPathContext context = JXPathContext.newContext(event);
        Pointer pointer = context.getPointer(expression);
        return (Boolean)pointer.getValue();
    }
747367
@Override
    public Object visitFunctionParameters(ExcellentParser.FunctionParametersContext ctx) {
        List<Object> parameters = new ArrayList<>();
        for (ExcellentParser.ExpressionContext expression : ctx.expression()) {
            parameters.add(visit(expression));
        }
        return parameters;
    }
81807
public static void init(@NonNull Context ctx) {
        if (!INIT_DONE) {
            String[] fonts = GenericsUtil.getDefinedFonts(ctx);
            for (String fontsClassPath : fonts) {
                try {
                    ITypeface typeface = (ITypeface) Class.forName(fontsClassPath).newInstance();
                    validateFont(typeface);
                    FONTS.put(typeface.getMappingPrefix(), typeface);
                } catch (Exception e) {
                    Log.e(TAG, "Can't init: " + fontsClassPath);
                }
            }
            String[] processors = GenericsUtil.getDefinedProcessors(ctx);
            for (String processorClassPath : processors) {
                try {
                    IconicsAnimationProcessor processor = (IconicsAnimationProcessor) Class.forName(processorClassPath).newInstance();
                    registerProcessor(processor);
                } catch (Exception e) {
                    Log.e(TAG, "Can't init: " + processorClassPath);
                }
            }
            INIT_DONE = true;
        }
    }
124384
private void processCompositeFilter(final StringBuilder whereBuilder,
                                        final List<Object> paramList, final CompositeFilter compositeFilter) throws RepositoryException {
        final List<Filter> subFilters = compositeFilter.getSubFilters();
        if (2 > subFilters.size()) {
            throw new RepositoryException("At least two sub filters in a composite filter");
        }

        whereBuilder.append("(");

        final Iterator<Filter> iterator = subFilters.iterator();
        while (iterator.hasNext()) {
            final Filter filter = iterator.next();

            if (filter instanceof PropertyFilter) {
                processPropertyFilter(whereBuilder, paramList, (PropertyFilter) filter);
            } else { // CompositeFilter
                processCompositeFilter(whereBuilder, paramList, (CompositeFilter) filter);
            }

            if (iterator.hasNext()) {
                switch (compositeFilter.getOperator()) {
                    case AND:
                        whereBuilder.append(" AND ");
                        break;

                    case OR:
                        whereBuilder.append(" OR ");
                        break;

                    default:
                        throw new RepositoryException("Unsupported composite filter [operator=" + compositeFilter.getOperator() + "]");
                }
            }
        }

        whereBuilder.append(")");
    }