When user entered expression changes, attempt to parse it
and colorize rows based on expression.
321249
function updateExpression() {
  var input = $('.expression');
  var expression = input.val();
  $('.plot').hide();

  if (!expression) {
    // No expression specified. Don't plot.
    input.css('background-color', '#fff');
    return;
  }

  try {
    var plotFunction = compileExpression(expression, additionalFunctions); // <-- Filtrex!
    input.css('background-color', '#dfd');
  } catch (e) {
    // Failed to parse expression. Don't plot.
    input.css('background-color', '#fdd');
    return;
  }

  render(plotFunction);
}
405521
protected void parse(String expression) {
        /* cleaning stacks */
        stackOperations.clear();
        stackRPN.clear();

        QScanner scanner = new QScanner(expression);

		/* loop for handling each token - shunting-yard algorithm */
        String stringToken,prevToken = null;
        while ( (stringToken=scanner.readNext()) != null) {
            if (isSeparator(stringToken)) {
                while (!stackOperations.empty()
                        && !isOpenBracket(stackOperations.lastElement())) {
                    stackRPN.push(stackOperations.pop());
                }
            } else if (isOpenBracket(stringToken)) {
                Object last = stackRPN.isEmpty() ? null : stackRPN.lastElement();
                if ( last instanceof VarPath && isFunction(((VarPath) last).field)) {
                    stackRPN.pop();
                    stackOperations.push( functions.get(((VarPath) last).field) );
                }
                stackOperations.push(stringToken);
            } else if (isCloseBracket(stringToken)) {
                while (!stackOperations.empty()
                        && !isOpenBracket(stackOperations.lastElement())) {
                    stackRPN.push(stackOperations.pop());
                }
                stackOperations.pop();
                if (!stackOperations.empty()
                        && stackOperations.lastElement() instanceof FuncOperand) {
                    stackRPN.push(stackOperations.pop());
                }
            } else if (isNumber(stringToken)) {
                if ( stringToken.indexOf('.')<0) {
                    Long i = Long.parseLong(stringToken);
                    stackRPN.push( new LongValue(i) );
                } else {
                    Double d = Double.parseDouble(stringToken);
                    stackRPN.push( new DoubleValue(d) );
                }
            } else if (operators.containsKey(stringToken)) {
                Operator op = operators.get(stringToken);
                // test for prefix op
                boolean prefix = false;
                if ( (stringToken.equals("+") || stringToken.equals("-")) &&
                         (prevToken == null ||
                       operators.containsKey(prevToken) ||
                       isOpenBracket(prevToken) ||
                       isSeparator(prevToken)
                     )
                   ) {
                    prefix = true;
                    stackRPN.push(new LongValue(0));
                }
                while (!stackOperations.empty() && ! prefix
                        && stackOperations.lastElement() instanceof Operator
                        && op.getPrecedence() <= ((Operator)stackOperations.lastElement()).getPrecedence() ) {
                    stackRPN.push(stackOperations.pop());
                }
                stackOperations.push(op);
            } else {
                if ( stringToken.startsWith("'") && stringToken.endsWith("'") ) {
                    stackRPN.push(new StringValue(stringToken.substring(1, stringToken.length() - 1)));
                } else if ( stringToken.startsWith("\"") && stringToken.endsWith("\"") ) {
                    stackRPN.push(new StringValue(stringToken.substring(1, stringToken.length() - 1)));
                } else //if ( stringToken.startsWith(VARIABLE+".") )
                {
                    stackRPN.push(new VarPath(stringToken,ctxRef));
                }
            }
            prevToken = stringToken;
        }
        while (!stackOperations.empty()) {
            stackRPN.push(stackOperations.pop());
        }

		/* reverse stack */
        Collections.reverse(stackRPN);
    }
593160
public void validate() throws Exception {
        boolean validated = true;
        for (ValueExpression expression : this.getApplicableExpressions()) {
            try {
                expression.validate();
                validated = true;
            } catch (Throwable e) {
                validated = false;
            }
            if (validated) {
                break;
            }
        }
        Assert.assertTrue("At least one expression type should match the input", validated);
    }
1307337
def starting_expression(source_code, offset):
    """"""
    word_finder = worder.Worder(source_code, True)
    expression, starting, starting_offset = \
        word_finder.get_splitted_primary_before(offset)
    if expression:
        return expression + '.' + starting
    return starting
1064158
function transformMemberExpressions(identifier, j, root) {
  // replace all expressions using `identifier` to access color palettes
  root.find(j.MemberExpression).forEach(path => {
    if (path.node.object.name !== identifier) {
      return;
    }

    const colorProperty = path.node.property.name;
    const { palette, hue } = colorAccent(colorProperty);
    const colorModuleName = colorImportPath(palette);
    const property = hue || palette;

    path.node.property =
      hue || colorModuleName === 'common'
        ? j.memberExpression(
            j.identifier(colorModuleName),
            /^[_|a-z]/i.test(property) ? j.identifier(property) : j.literal(property),
          )
        : j.identifier(colorModuleName);
  });
}
843607
function highlightRows(highlighter) {
  $('.data > tbody > tr').each(function(i, rowEl) {
    var row = $(rowEl);
    var item = row.data('item');
    var shouldHighlight = highlighter(item); // <-- Compiled function from Filtrex!
    row.css('background-color', shouldHighlight ? '#ff5' : '#fff');
  });
}
716432
function parseColor (str) {
    if (str.substr(0,1) === '#') {
      // Handle color shorthands (like #abc)
      var shorthand = str.length === 4,
          m = str.match(shorthand ? /\w/g : /\w{2}/g);

      if (!m) return;
      m = m.map(function(s) { return parseInt(shorthand ? s+s : s, 16) });
      return new nodes.RGBA(m[0],m[1],m[2],1);
    }
    else if (str.substr(0,3) === 'rgb'){
      var m = str.match(/([0-9]*\.?[0-9]+)/g);
      if (!m) return;
      m = m.map(function(s){return parseFloat(s, 10)});
      return new nodes.RGBA(m[0], m[1], m[2], m[3] || 1);
    }
    else {
      var rgb = colors[str];
      if (!rgb) return;
      return new nodes.RGBA(rgb[0], rgb[1], rgb[2], 1);
    }
  }
311164
private double getColor( Expression exp, CssFormatter formatter ) {
        type = exp.getDataType( formatter );
        switch( type ) {
            case COLOR:
            case RGBA:
                return exp.doubleValue( formatter );
        }
        throw new ParameterOutOfBoundsException();
    }
31331
private String checkInputParameter(Expression expression)
    {
        return (expression instanceof InputParameter) ? kunderaQuery.getParametersMap()
                .get((expression).toParsedText()).toString() : expression.toParsedText().toString();
    }
3489
public void recolorQuery() throws Exception {
		PrefixManager man = apic.getMutablePrefixManager();

		String input = doc.getText(0, doc.getLength());
		ImmutableList<TargetAtom> current_query = parse(input, man);

		if (current_query == null) {
            JOptionPane.showMessageDialog(null, "An error occured while parsing the mappings. For more info, see the logs.");
			throw new Exception("Unable to parse the query: " + input + ", " + parsingException);
		}
		input = doc.getText(0, doc.getLength());

		resetStyles();

		int pos = input.indexOf("(", 0);
		while (pos != -1) {
			doc.setCharacterAttributes(pos, 1, brackets, false);
			pos = input.indexOf("(", pos + 1);
		}
		pos = input.indexOf(")", 0);
		while (pos != -1) {
			doc.setCharacterAttributes(pos, 1, brackets, false);
			pos = input.indexOf(")", pos + 1);
		}
		pos = input.indexOf(".", 0);
		while (pos != -1) {
			doc.setCharacterAttributes(pos, 1, black, false);
			pos = input.indexOf(".", pos + 1);
		}
		pos = input.indexOf(",", 0);
		while (pos != -1) {
			doc.setCharacterAttributes(pos, 1, black, false);
			pos = input.indexOf(",", pos + 1);
		}
		pos = input.indexOf(":", 0);
		while (pos != -1) {
			doc.setCharacterAttributes(pos, 1, black, false);
			pos = input.indexOf(":", pos + 1);
		}
		MutableOntologyVocabulary vocabulary = apic.getCurrentVocabulary();
		for (TargetAtom atom : current_query) {
			Optional<IRI> optionalPredicateIri = atom.getPredicateIRI();

			if (optionalPredicateIri.isPresent()) {
				IRI predicateIri = optionalPredicateIri.get();
				String shortIRIForm = man.getShortForm(predicateIri.getIRIString());

				if (vocabulary.classes().contains(predicateIri)) {
					ColorTask task = new ColorTask(shortIRIForm, clazz);
					tasks.add(task);
				} else if (vocabulary.objectProperties().contains(predicateIri)) {
					ColorTask task = new ColorTask(shortIRIForm, objectProp);
					tasks.add(task);
				} else if (vocabulary.dataProperties().contains(predicateIri)) {
					ColorTask task = new ColorTask(shortIRIForm, dataProp);
					tasks.add(task);
				} else if (vocabulary.annotationProperties().contains(predicateIri)) {
					ColorTask task = new ColorTask(shortIRIForm, annotProp);
					tasks.add(task);
				}
			}

			ImmutableList<ImmutableTerm> substitutedTerms = atom.getSubstitutedTerms();
			RDFAtomPredicate atomPredicate = (RDFAtomPredicate) atom.getProjectionAtom().getPredicate();

			ImmutableTerm term1 = atomPredicate.getSubject(substitutedTerms);
			ImmutableTerm term2 = atomPredicate.getObject(substitutedTerms);

			if (term1 instanceof IRIConstant) {
				String rendered = man.getShortForm(((IRIConstant) term1).getIRI().toString());
				ColorTask task = new ColorTask(rendered, individual);
				tasks.add(task);
			}
			if (term2 instanceof IRIConstant) {
				String rendered = man.getShortForm(((IRIConstant) term2).getIRI().toString());
				ColorTask task = new ColorTask(rendered, individual);
				tasks.add(task);
			}
		}

		ColorTask[] taskArray = order(tasks);
		for (int i = 0; i < taskArray.length; i++) {
			if (taskArray[i].text != null) {
				int index = input.indexOf(taskArray[i].text, 0);
				while (index != -1) {
					doc.setCharacterAttributes(index, taskArray[i].text.length(), taskArray[i].set, true);
					index = input.indexOf(taskArray[i].text, index + 1);
				}
			}
		}
		tasks.clear();
	}
1185067
function () {
                    var elements = [], e, c, argsSemiColon = [], argsComma = [], args, delim, arg, nameLoop, expressions, isSemiColonSeperated, expressionContainsNamed, index = i, s = input.charAt(i), name, value, important = false;

                    if (s !== '.' && s !== '#') { return }
                    
                    save(); // stop us absorbing part of an invalid selector

                    while (e = $(/^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)) {
                        elements.push(new(tree.Element)(c, e, i));
                        c = $('>');
                    }
                    if ($('(')) {
                        expressions = [];
                        while (arg = $(this.expression)) {
                            nameLoop = null;
                            value = arg;

                            // Variable
                            if (arg.value.length == 1) {
                                var val = arg.value[0];
                                if (val instanceof tree.Variable) {
                                    if ($(':')) {
                                        if (expressions.length > 0) {
                                            if (isSemiColonSeperated) {
                                                error("Cannot mix ; and , as delimiter types");
                                            }
                                            expressionContainsNamed = true;
                                        }
                                        value = expect(this.expression);
                                        nameLoop = (name = val.name);
                                    }
                                }
                            }
                            
                            expressions.push(value);
                            
                            argsComma.push({ name: nameLoop, value: value });
                            
                            if ($(',')) {
                                continue;
                            }
                            
                            if ($(';') || isSemiColonSeperated) {
                            
                                if (expressionContainsNamed) {
                                    error("Cannot mix ; and , as delimiter types");
                                }
                            
                                isSemiColonSeperated = true;
                                                        
                                if (expressions.length > 1) {
                                    value = new(tree.Value)(expressions);
                                }
                                argsSemiColon.push({ name: name, value: value });
                            
                                name = null;
                                expressions = [];
                                expressionContainsNamed = false;
                            }
                        }

                        expect(')');
                    }

                    args = isSemiColonSeperated ? argsSemiColon : argsComma;

                    if ($(this.important)) {
                        important = true;
                    }

                    if (elements.length > 0 && ($(';') || peek('}'))) {
                        return new(tree.mixin.Call)(elements, args, index, env.filename, important);
                    }
                    
                    restore();
                }
933129
private void processRow(Subscriber<? super T> subscriber) throws SQLException {
        checkSubscription(subscriber);
        if (!keepGoing)
            return;
        if (rs.next()) {
            log.trace("onNext");
            subscriber.onNext(function.call(rs));
        } else
            keepGoing = false;
    }
1272163
static void colorizeImage( CssFormatter formatter, List<Expression> parameters ) throws IOException {
        if( parameters.size() < 4 ) {
            throw new LessException( "error evaluating function colorize-image expects url, main_color, contrast_color " );
        }

        String relativeURL = parameters.get( 0 ).stringValue( formatter );
        String urlString = parameters.get( 1 ).stringValue( formatter );
        URL url = new URL( formatter.getBaseURL(), relativeURL );
        String urlStr = UrlUtils.removeQuote( urlString );
        url = new URL( url, urlStr );
        int mainColor = ColorUtils.argb( UrlUtils.getColor( parameters.get( 2 ), formatter ) );
        int contrastColor = ColorUtils.argb( UrlUtils.getColor( parameters.get( 3 ), formatter ) );

        BufferedImage loadedImage = ImageIO.read( url.openStream() );

        // convert the image in a standard color model
        int width = loadedImage.getWidth( null );
        int height = loadedImage.getHeight( null );
        BufferedImage image = new BufferedImage( width, height, BufferedImage.TYPE_INT_ARGB );
        Graphics2D bGr = image.createGraphics();
        bGr.drawImage( loadedImage, 0, 0, null );
        bGr.dispose();

        final float[] mainColorHsb = Color.RGBtoHSB( (mainColor >> 16) & 0xFF, (mainColor >> 8) & 0xFF, mainColor & 0xFF, null );
        final float[] contrastColorHsb = Color.RGBtoHSB( (contrastColor >> 16) & 0xFF, (contrastColor >> 8) & 0xFF, contrastColor & 0xFF, null );

        // get the pixel data
        WritableRaster raster = image.getRaster();
        DataBufferInt buffer = (DataBufferInt)raster.getDataBuffer();
        int[] data = buffer.getData();

        float[] hsb = new float[3];
        int hsbColor = 0;
        int lastRgb = data[0] + 1;
        for( int i = 0; i < data.length; i++ ) {
            int rgb = data[i];
            if( rgb == lastRgb ) {
                data[i] = hsbColor;
                continue;
            }
            int r = (rgb >> 16) & 0xFF;
            int g = (rgb >> 8) & 0xFF;
            int b = rgb & 0xFF;
            Color.RGBtoHSB( r, g, b, hsb );

            float[] hsbColorize;
            if( hsb[1] == 1.0f ) {
                hsbColorize = hsb;
                hsb[0] = hsb[0] * 3f / 4f + mainColorHsb[0] / 4f;
                hsb[1] = hsb[1] * 3f / 4f + mainColorHsb[1] / 4f;
                hsb[2] = hsb[2] * 3f / 4f + mainColorHsb[2] / 4f;
            } else {
                if( hsb[2] == 1.0f ) {
                    hsbColorize = contrastColorHsb;
                } else {
                    hsbColorize = mainColorHsb;
                }
            }
            lastRgb = rgb;
            hsbColor = Color.HSBtoRGB( hsbColorize[0], hsbColorize[1], hsbColorize[2] );
            hsbColor = (rgb & 0xFF000000) | (hsbColor & 0xFFFFFF);
            data[i] = hsbColor;
        }

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ImageIO.write( image, "PNG", out );

        UrlUtils.dataUri( formatter, out.toByteArray(), urlString, "image/png;base64" );
    }
111488
def text_has_changed(self, text):
        """"""
        text = to_text_string(text)
        if text:
            self.lineno = int(text)
        else:
            self.lineno = None
443719
private void findExpressionParameters(Expression expression, List<VariableInfo> parameters) {
    if (expression instanceof NameExpr) {
      NameExpr nameExpr = ((NameExpr) expression);
      if ("$event".equals(nameExpr.getNameAsString())) {
        processEventParameter(expression, nameExpr, parameters);
      } else {
        processNameExpression(nameExpr, parameters);
      }
    }

    expression
        .getChildNodes()
        .stream()
        .filter(Expression.class::isInstance)
        .map(Expression.class::cast)
        .forEach(exp -> findExpressionParameters(exp, parameters));
  }
882271
def p_expression(tok):
        """"""
        if len(tok) == 4:
            tok[0] = LogicalBinOpRule(tok[2], tok[1], tok[3])
        else:
            tok[0] = tok[1]
1162760
function throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, oldValue, currValue) {
    if (checkNoChangesMode) {
        var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
        if (creationMode) {
            msg +=
                " It seems like the view has been created after its parent and its children have been dirty checked." +
                    " Has it been created in a change detection hook ?";
        }
        // TODO: include debug context
        throw new Error(msg);
    }
}