src/abstract-syntax-tree.js
function processUnary(tokenizer, scope) {
  const unaryAddSubtract = {
    '-': value => -value,
    '+': value => value
  };

  if (tokenizer.token.match(types.ADD_SUBTRACT)) {
    return createOperatorNode(unaryAddSubtract[tokenizer.token.lexeme], [processUnary(tokenizer.skipToken(), scope)]);
  }

  if (tokenizer.token.match(types.INCREASE_DECREASE) || tokenizer.token.match(types.LOGICAL_NEGATION)) {
    return createOperatorNode(tokenizer.token.value, [processUnary(tokenizer.skipToken(), scope)]);
  }

  return processIdentifiers(tokenizer, scope);
}
function processUnary(tokenizer, scope) {
  const unaryAddSubtract = {
    '-': value => -value,
    '+': value => value
  };

  if (tokenizer.token.match(types.ADD_SUBTRACT)) {
    return createOperatorNode(unaryAddSubtract[tokenizer.token.lexeme], [processUnary(tokenizer.skipToken(), scope)]);
  }

  if (tokenizer.token.match(types.INCREASE_DECREASE) || tokenizer.token.match(types.LOGICAL_NEGATION)) {
    return createOperatorNode(tokenizer.token.value, [processUnary(tokenizer.skipToken(), scope)]);
  }

  return processIdentifiers(tokenizer, scope);
}
function processUnary ( tokenizer , scope ) { const unaryAddSubtract = { '-' : value => - value , '+' : value => value } ; if ( tokenizer . token . match ( types . ADD_SUBTRACT ) ) { return createOperatorNode ( unaryAddSubtract [ tokenizer . token . lexeme ] , [ processUnary ( tokenizer . skipToken ( ) , scope ) ] ) ; } if ( tokenizer . token . match ( types . INCREASE_DECREASE ) || tokenizer . token . match ( types . LOGICAL_NEGATION ) ) { return createOperatorNode ( tokenizer . token . value , [ processUnary ( tokenizer . skipToken ( ) , scope ) ] ) ; } return processIdentifiers ( tokenizer , scope ) ; }
Process Unary plus and minus, and negation operators
@return {Function} compiled node
@private
Process Unary plus and minus and negation operators