spreadsheet/ruleJS.all.full.js
function (formula, element) {
    var result = null,
        error = null;

    try {

      parser.setObj(element);
      result = parser.parse(formula);

      var id;

      if (element instanceof HTMLElement) {
        id = element.getAttribute('id');
      } else if (element && element.id) {
        id = element.id;
      }

      var deps = instance.matrix.getDependencies(id);

      if (deps.indexOf(id) !== -1) {
        result = null;

        deps.forEach(function (id) {
          instance.matrix.updateItem(id, {value: null, error: Exception.get('REF')});
        });

        throw Error('REF');
      }

    } catch (ex) {

      var message = Exception.get(ex.message);

      if (message) {
        error = message;
      } else {
        error = Exception.get('ERROR');
      }

      //console.debug(ex.prop);
      //debugger;
      //error = ex.message;
      //error = Exception.get('ERROR');
    }

    return {
      error: error,
      result: result
    }
  }
function (formula, element) {
    var result = null,
        error = null;

    try {

      parser.setObj(element);
      result = parser.parse(formula);

      var id;

      if (element instanceof HTMLElement) {
        id = element.getAttribute('id');
      } else if (element && element.id) {
        id = element.id;
      }

      var deps = instance.matrix.getDependencies(id);

      if (deps.indexOf(id) !== -1) {
        result = null;

        deps.forEach(function (id) {
          instance.matrix.updateItem(id, {value: null, error: Exception.get('REF')});
        });

        throw Error('REF');
      }

    } catch (ex) {

      var message = Exception.get(ex.message);

      if (message) {
        error = message;
      } else {
        error = Exception.get('ERROR');
      }

      //console.debug(ex.prop);
      //debugger;
      //error = ex.message;
      //error = Exception.get('ERROR');
    }

    return {
      error: error,
      result: result
    }
  }
function ( formula , element ) { var result = null , error = null ; try { parser . setObj ( element ) ; result = parser . parse ( formula ) ; var id ; if ( element instanceof HTMLElement ) { id = element . getAttribute ( 'id' ) ; } else if ( element && element . id ) { id = element . id ; } var deps = instance . matrix . getDependencies ( id ) ; if ( deps . indexOf ( id ) !== - 1 ) { result = null ; deps . forEach ( function ( id ) { instance . matrix . updateItem ( id , { value : null , error : Exception . get ( 'REF' ) } ) ; } ) ; throw Error ( 'REF' ) ; } } catch ( ex ) { var message = Exception . get ( ex . message ) ; if ( message ) { error = message ; } else { error = Exception . get ( 'ERROR' ) ; } //console.debug(ex.prop); //debugger; //error = ex.message; //error = Exception.get('ERROR'); } return { error : error , result : result } }
parse input string using parser
@returns {Object} {{error: *, result: *}}
@param formula
@param element
parse input string using parser