Process a cell (binary rules only) using the left-child to constrain the set of rules we consider.

This follows the description in (Dunlop et al., 2010).
497384
private static final void processCellLeftChild(final CnfGrammar grammar, final Chart chart, final int start,
            final int end, final ChartCell cell, final Scorer scorer) {
        // Apply binary rules.
        for (int mid = start + 1; mid <= end - 1; mid++) {
            ChartCell leftCell = chart.getCell(start, mid);
            ChartCell rightCell = chart.getCell(mid, end);
            
            // Loop through each left child non-terminal.
            for (final int leftChildNt : leftCell.getNts()) {
                double leftScoreForNt = leftCell.getScore(leftChildNt);
                // Lookup all rules with that left child.
                for (final Rule r : grammar.getBinaryRulesWithLeftChild(leftChildNt)) {
                    // Check whether the right child of that rule is in the right child cell.
                    double rightScoreForNt = rightCell.getScore(r.getRightChild());
                    if (rightScoreForNt > Double.NEGATIVE_INFINITY) {
                        double score = scorer.score(r, start, mid, end)
                                + leftScoreForNt
                                + rightScoreForNt;
                        cell.updateCell(r.getParent(), score, mid, r);
                    }
                }
            }
        }
    }
1104026
def left(*conditions, &effect)
      branch = Fear.case(Fear::Left, &LEFT_EXTRACTOR).and_then(Fear.case(*conditions, &effect))
      or_else(branch)
    end
772052
def process_cell(self, row, column, cell):
        
        value, field = self.parse_cell(cell)

        if value or field:
            return {'col':column, 'field':field, 'value':value}
        else:
            return {}
501519
def _do_else(self, rule, p_selectors, p_parents, p_children, scope, media, c_lineno, c_property, c_codestr, code, name):
        
        if '@if' not in rule[OPTIONS]:
            log.error("@else with no @if (%s", rule[INDEX][rule[LINENO]])
        val = rule[OPTIONS].pop('@if', True)
        if not val:
            rule[CODESTR] = c_codestr
            self.manage_children(
                rule, p_selectors, p_parents, p_children, scope, media)
223244
function() {
        var dimensionModel = this.dimensionModel;
        var width = dimensionModel.get('rsideWidth');
        var marginLeft = dimensionModel.get('lsideWidth');
        var frozenBorderWidth = dimensionModel.get('frozenBorderWidth');

        // If the left side exists and the division border should not be doubled,
        // left side should cover the right side by border-width to hide the left border of the right side.
        if (marginLeft > 0 && !dimensionModel.isDivisionBorderDoubled()) {
            width += CELL_BORDER_WIDTH;
            marginLeft -= CELL_BORDER_WIDTH;
        }

        this.$el.css({
            width: width,
            marginLeft: marginLeft + frozenBorderWidth
        });
    }
1171960
function(state, nodeA, sepHandlerA, nodeB, sepHandlerB) {
	let sepType, nlConstraints, aCons, bCons;

	if (nodeA.nextSibling === nodeB) {
		// sibling separator
		sepType = "sibling";
		aCons = sepHandlerA.after(nodeA, nodeB, state);
		bCons = sepHandlerB.before(nodeB, nodeA, state);
		nlConstraints = getSepNlConstraints(state, nodeA, aCons, nodeB, bCons);
	} else if (nodeB.parentNode === nodeA) {
		// parent-child separator, nodeA parent of nodeB
		sepType = "parent-child";
		aCons = sepHandlerA.firstChild(nodeA, nodeB, state);
		bCons = sepHandlerB.before(nodeB, nodeA, state);
		nlConstraints = getSepNlConstraints(state, nodeA, aCons, nodeB, bCons);
	} else if (nodeA.parentNode === nodeB) {
		// parent-child separator, nodeB parent of nodeA
		sepType = "child-parent";
		aCons = sepHandlerA.after(nodeA, nodeB, state);
		bCons = sepHandlerB.lastChild(nodeB, nodeA, state);
		nlConstraints = getSepNlConstraints(state, nodeA, aCons, nodeB, bCons);
	} else {
		// sibling separator
		sepType = "sibling";
		aCons = sepHandlerA.after(nodeA, nodeB, state);
		bCons = sepHandlerB.before(nodeB, nodeA, state);
		nlConstraints = getSepNlConstraints(state, nodeA, aCons, nodeB, bCons);
	}

	if (nodeA.nodeName === undefined) {
		console.trace();
	}

	if (state.sep.constraints) {
		// Merge the constraints
		state.sep.constraints = mergeConstraints(
			state.env,
			state.sep.constraints,
			nlConstraints
		);
	} else {
		state.sep.constraints = nlConstraints;
	}

	state.env.log('debug/wts/sep', function() {
		return 'constraint' +
			' | ' + sepType +
			' | <' + nodeA.nodeName + ',' + nodeB.nodeName + '>' +
			' | ' + JSON.stringify(state.sep.constraints) +
			' | ' + debugOut(nodeA) +
			' | ' + debugOut(nodeB);
	});

	state.sep.constraints.constraintInfo = {
		onSOL: state.onSOL,
		// force SOL state when separator is built/emitted
		forceSOL: sepHandlerB.forceSOL,
		sepType: sepType,
		nodeA: nodeA,
		nodeB: nodeB,
	};
}
1059715
def find(self,cell_designation,cell_filter=lambda x,c: 'c' in x and x['c'] == c):
        
        if 'parent' in self.meta:
            return (self.meta['parent'],self.meta['parent'].find(cell_designation,cell_filter=cell_filter))
1024452
def get_bl(self):
        """"""

        cell_below_left = CellBorders(self.cell_attributes,
                                      *self.cell.get_below_left_key_rect())
        return cell_below_left.get_r()
664227
function Constraint(left_op, right_op, isList) {
  this.left = left_op;
  this.right = right_op;
  this.isList = false;
  if (isList) {
    this.isList = isList;
  }
}
704761
public void process(StringBuilder buf, NFRuleSet ruleSet) {
        // markers depend on what rule set we are using

        // Commented by johnvu on the if statement since lastRuleSet is never initialized
        //if (ruleSet != lastRuleSet) {
            String name = ruleSet.getName();
            for (int i = 0; i < rulesetNames.length; ++i) {
                if (rulesetNames[i].equals(name)) {
                    format = i;
                    longForm = i == 1 || i == 3;
                    break;
                }
            }
        //}

        if (longForm) {
            for (int i = buf.indexOf("*"); i != -1; i = buf.indexOf("*", i)) {
                buf.delete(i, i+1);
            }
            return;
        }

        final String DIAN = "\u9ede"; // decimal point

        final String[][] markers = {
            { "\u842c", "\u5104", "\u5146", "\u3007" }, // marker chars, last char is the 'zero'
            { "\u4e07", "\u4ebf", "\u5146", "\u3007" },
            { "\u842c", "\u5104", "\u5146", "\u96f6" }
            // need markers for time?
        };

        // remove unwanted lings
        // a '0' (ling) with * might be removed
        // mark off 10,000 'chunks', markers are Z, Y, W (zhao, yii, and wan)
        // already, we avoid two lings in the same chunk -- ling without * wins
        // now, just need  to avoid optional lings in adjacent chunks
        // process right to left

        // decision matrix:
        // state, situation
        //     state         none       opt.          req.
        //     -----         ----       ----          ----
        // none to right     none       opt.          req.  
        // opt. to right     none   clear, none  clear right, req.
        // req. to right     none   clear, none       req.

        // mark chunks with '|' for convenience
        {
            String[] m = markers[format];
            for (int i = 0; i < m.length-1; ++i) {
                int n = buf.indexOf(m[i]);
                if (n != -1) {
                    buf.insert(n+m[i].length(), '|');
                }
            }
        }

        int x = buf.indexOf(DIAN);
        if (x == -1) {
            x = buf.length();
        }
        int s = 0; // 0 = none to right, 1 = opt. to right, 2 = req. to right
        int n = -1; // previous optional ling
        String ling = markers[format][3];
        while (x >= 0) {
            int m = buf.lastIndexOf("|", x);
            int nn = buf.lastIndexOf(ling, x);
            int ns = 0;
            if (nn > m) {
                ns = (nn > 0 && buf.charAt(nn-1) != '*') ? 2 : 1;
            }
            x = m - 1;

            // actually much simpler, but leave this verbose for now so it's easier to follow
            switch (s*3+ns) {
            case 0: /* none, none */
                s = ns; // redundant
                n = -1;
                break;
            case 1: /* none, opt. */
                s = ns;
                n = nn; // remember optional ling to right
                break;
            case 2: /* none, req. */
                s = ns;
                n = -1;
                break;
            case 3: /* opt., none */
                s = ns;
                n = -1;
                break;
            case 4: /* opt., opt. */
                buf.delete(nn-1, nn+ling.length()); // delete current optional ling
                s = 0;
                n = -1;
                break;
            case 5: /* opt., req. */
                buf.delete(n-1, n+ling.length()); // delete previous optional ling
                s = ns;
                n = -1;
                break;
            case 6: /* req., none */
                s = ns;
                n = -1;
                break;
            case 7: /* req., opt. */
                buf.delete(nn-1, nn+ling.length()); // delete current optional ling
                s = 0;
                n = -1;
                break;
            case 8: /* req., req. */
                s = ns;
                n = -1;
                break;
            default:
                throw new IllegalStateException();
            }
        }

        for (int i = buf.length(); --i >= 0;) {
            char c = buf.charAt(i);
            if (c == '*' || c == '|') {
                buf.delete(i, i+1);
            }
        }
    }
1357734
def constrain_negative(self, warning=True, trigger_parent=True):
        
        self.constrain(NegativeLogexp(), warning=warning, trigger_parent=trigger_parent)
62920
function(cell) {
    cellsize = cell || 64;
    this.map = {};

    this.boundsDirty = false;
    this.coordBoundsDirty = false;
    this.boundsHash = {
        maxX: -Infinity,
        maxY: -Infinity,
        minX: Infinity,
        minY: Infinity
    };
    this.boundsCoords = {
        maxX: -Infinity,
        maxY: -Infinity,
        minX: Infinity,
        minY: Infinity
    };
}
891442
function applyRules(rules, stem) {

  for (let i = 0, l = rules.length; i < l; i++) {
    const [min, pattern, replacement = ''] = rules[i];

    if (stem.slice(-pattern.length) === pattern) {
      const newStem = stem.slice(0, -pattern.length) + replacement,
            m = computeM(newStem);

      if (m <= min)
        continue;

      return newStem;
    }
  }

  return stem;
}
1246791
function C(iid, left) {
        var aret;
        if (sandbox.analysis && sandbox.analysis.conditional) {
            aret = sandbox.analysis.conditional(iid, left);
            if (aret) {
                left = aret.result;
            }
        }

        lastVal = left;
        return (lastComputedValue = left);
    }
94745
def binary_operation_comparison(self, rule, left, right, **kwargs):
        
        return self.evaluate_binop_comparison(rule.operation, left, right, **kwargs)
771474
private FieldConstraint makeSingleFieldConstraint(ConditionCol52 c,
                                                      String cell) {

        SingleFieldConstraint sfc = new SingleFieldConstraint(c.getFactField());

        //Condition columns can be defined as having no operator, in which case the operator
        //is taken from the cell's value. Pretty yucky really if we're to be able to perform
        //expansion and contraction of decision table columns.... this might have to go.
        if (no(c.getOperator())) {

            String[] a = cell.split("\\s");
            if (a.length > 1) {
                //Operator might be 1 part (e.g. "==") or two parts (e.g. "not in")
                StringBuilder operator = new StringBuilder(a[0]);
                for (int i = 1; i < a.length - 1; i++) {
                    operator.append(a[i]);
                }
                sfc.setOperator(operator.toString());
                sfc.setValue(a[a.length - 1]);
            } else {
                sfc.setValue(cell);
            }
        } else {

            sfc.setOperator(c.getOperator());
            if (OperatorsOracle.operatorRequiresList(c.getOperator())) {
                sfc.setValue(makeInList(cell));
            } else {
                if (!c.getOperator().equals("== null") && !c.getOperator().equals("!= null")) {
                    sfc.setValue(cell);
                }
            }
        }
        final int constraintValueType = c.getConstraintValueType();
        if ((constraintValueType == BaseSingleFieldConstraint.TYPE_LITERAL || constraintValueType == BaseSingleFieldConstraint.TYPE_RET_VALUE) && c.isBound()) {
            sfc.setFieldBinding(c.getBinding());
        }
        sfc.setParameters(c.getParameters());
        sfc.setConstraintValueType(c.getConstraintValueType());
        sfc.setFieldType(c.getFieldType());
        return sfc;
    }
386199
private void constraint(PatternDescrBuilder<?> pattern,
            boolean positional,
            String prefix) throws RecognitionException {
        if (speculateNestedConstraint()) {
            nestedConstraint(pattern, prefix);
            return;
        }

        if (state.backtracking == 0) {
            helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_START);
        }

        int first = input.index();
        exprParser.getHelper().setHasOperator(false); // resetting
        try {
            exprParser.conditionalOrExpression();
        } finally {
            if (state.backtracking == 0) {
                if (input.LA(1) == DRL6Lexer.ID && input.LA(2) == DRL6Lexer.EOF) {
                    helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                } else if (input.LA(1) != DRL6Lexer.EOF) {
                    helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_END);
                } else if (!lastTokenWasWhiteSpace()) {
                    int location = getCurrentLocation();
                    if (location == Location.LOCATION_LHS_INSIDE_CONDITION_END) {
                        helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_ARGUMENT);
                    } else if (input.get(input.index()).getType() != DRL6Lexer.EOF) {
                        helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_START);
                    }
                } else if (getCurrentLocation() == Location.LOCATION_LHS_INSIDE_CONDITION_START &&
                        !exprParser.getHelper().getHasOperator() &&
                        lastTokenWasWhiteSpace() &&
                        input.LA(1) == DRL6Lexer.EOF &&
                        input.LA(-1) == DRL6Lexer.ID) {
                    helper.emit(Location.LOCATION_LHS_INSIDE_CONDITION_OPERATOR);
                }
            }
        }

        if (state.failed)
            return;

        if (state.backtracking == 0 && input.index() > first) {
            // expression consumed something
            int last = input.LT(-1).getTokenIndex();
            String expr = toExpression(prefix, first, last);
            pattern.constraint(expr,
                    positional);
            BaseDescr constrDescr = pattern.getDescr().getDescrs().get(pattern.getDescr().getDescrs().size() - 1);
            constrDescr.setLocation(input.get(first).getLine(),
                    input.get(first).getCharPositionInLine());
            constrDescr.setEndLocation(input.get(last).getLine(),
                    input.get(last).getCharPositionInLine());
            constrDescr.setStartCharacter(((CommonToken) input.get(first)).getStartIndex());
            constrDescr.setEndCharacter(((CommonToken) input.get(last)).getStopIndex());
        }
    }