Parse CallExpression or NewExpression to get array of properties and object name

@param  {Object} node The node to parse
@return {String[]} eg. ['Ember', 'computed', 'alias']
352188
function parseCallee(node) {
  const parsedCallee = [];
  let callee;

  if (isCallExpression(node) || isNewExpression(node)) {
    callee = node.callee;

    while (isMemberExpression(callee)) {
      if (isIdentifier(callee.property)) {
        parsedCallee.push(callee.property.name);
      }
      callee = callee.object;
    }

    if (isIdentifier(callee)) {
      parsedCallee.push(callee.name);
    }
  }

  return parsedCallee.reverse();
}
184961
function getEntityNameForExtendingInterface(node) {
            switch (node.kind) {
                case 69 /* Identifier */:
                case 172 /* PropertyAccessExpression */:
                    return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
                case 194 /* ExpressionWithTypeArguments */:
                    ts.Debug.assert(ts.isEntityNameExpression(node.expression));
                    return node.expression;
                default:
                    return undefined;
            }
        }
1048676
function parse(node) {
    const cfg = Object.assign({}, copyXmlAttributes(node));

    for (let i = 0, l = node.childNodes.length; i < l; ++i) {
        const el = node.childNodes.item(i);
        if (el.nodeType === ELEMENT_NODE) {
            if (!el.namespaceURI) {
                // attribute elements
                if (!cfg.attributes) cfg.attributes = {};
                cfg.attributes[el.localName] = el.childNodes.length ? parse(el) : copyXmlAttributes(el);
            } else if (el.namespaceURI === 'urn:flora:options') {
                // flora specific elements
                if (el.localName === 'dataSource') {
                    const dataSource = getDataSource(el);
                    if (!cfg.dataSources) cfg.dataSources = {};
                    if (cfg.dataSources[dataSource.name]) {
                        throw new Error(`Data source "${dataSource.name}" already defined`);
                    }
                    cfg.dataSources[dataSource.name] = dataSource.config;
                }
                if (el.localName === 'subFilter') {
                    if (!cfg.subFilters) cfg.subFilters = [];
                    cfg.subFilters.push(copyXmlAttributes(el));
                }
            }
        } else if (el.nodeType === TEXT_NODE && el.textContent.trim().length > 0) {
            throw new ImplementationError(`Config contains unnecessary text: "${el.textContent.trim()}"`);
        }
    }

    return cfg;
}
416872
function parseObject(obj){
  obj = obj.vals;
  for (var key in obj) {
    var nodes = obj[key].nodes[0].nodes;
    if (nodes && nodes.length) {
      obj[key] = [];
      for (var i = 0, len = nodes.length; i < len; ++i) {
        obj[key].push(convert(nodes[i]));
      }
    } else {
      obj[key] = convert(obj[key].first);
    }
  }
  return obj;

  function convert(node){
    switch (node.nodeName) {
      case 'object':
        return parseObject(node);
      case 'boolean':
        return node.isTrue;
      case 'unit':
        return node.type ? node.toString() : +node.val;
      case 'string':
      case 'literal':
        return node.val;
      default:
        return node.toString();
    }
  }
}
233353
function(node) {
        var data = []

        for (var i = 0, len = node.childNodes.length; i < len; i++) {
            var child = node.childNodes[i]
            if (child.nodeType != ELEMENT_NODE) {
                continue
            }

            data.push(this._parseNode(child))
        }

        return data
    }
424159
function transform( node ) {
	var type;
	if ( node.type ) {
		if ( node.type.length === 1 ) {
			type = node.type[ 0 ];
		} else {
			type = node.type;
		}
	} else {
		type = '';
	}
	return {
		'name': node.name,
		'description': node.description || '',
		'type': type,
		'access': node.access || '',
		'virtual': !!node.virtual
	};
}
1071519
function (node) {
            var size = provider.node.getSize(node);
            return [
                {
                    "d": "M 0, 0 m -" + size + ", 0 a " + size + "," + size + " 0 1,0 " + 2 * size + ",0 a " + size + "," + size + " 0 1,0 -" + 2 * size + ",0",
                    "fill": "transparent",
                    "stroke": provider.node.getColor(node),
                    "stroke-width": "2px"
                }
            ];
        }
1097245
function findVarItem(valueNode) {
  var varNames = [];
  var varName;
  if (valueNode.type === 'name') {
    varName = valueNode.value;
  } else if (valueNode.type === 'dot' || valueNode.type === 'call') {
    varNames = expressionNames(valueNode);
    if (!varNames) {
      return;
    }
    varName = varNames.shift();
  }
  if (!varName) {
    return;
  }
  var varItem = valueNode.item('var.' + varName);
  if (typeof varItem === 'undefined') {
    return;
  }
  varItem = findVarProperty(varNames, varItem);
  return varItem;
}
286294
function(node){
    var test = null;
    if ('default' != node.expr) {
      test = node.astExpr || this.parseExpr(node.expr);
    }
    var consequent = []
    if (node.block) {
      consequent = this.visit(node.block, node);
      consequent.push(t.breakStatement());
    }
    var c = t.switchCase(test, consequent);
    return [c];
  }
1000248
function getReactProps(node, parent) {
  if (node.openingElement.attributes.length === 0 ||
  htmlElements.indexOf(node.openingElement.name.name) > 0) return {};
  const result = node.openingElement.attributes
    .map(attribute => {
      const name = attribute.name.name;
      let valueName;
      if (attribute.value === null) valueName = undefined;
      else if (attribute.value.type === 'Literal') valueName = attribute.value.value;
      else if (attribute.value.expression.type === 'Literal') {
        valueName = attribute.value.expression.value;
      } else if (attribute.value.expression.type === 'Identifier') {
        valueName = attribute.value.expression.name;
      } else if (attribute.value.expression.type === 'CallExpression') {
        valueName = attribute.value.expression.callee.object.property.name;
      } else if (attribute.value.expression.type === 'BinaryExpression') {
        valueName = attribute.value.expression.left.name
          + attribute.value.expression.operator
          + (attribute.value.expression.right.name
          || attribute.value.expression.right.value);
      } else if (attribute.value.expression.type === 'MemberExpression') {
        let current = attribute.value.expression;
        while (current && current.property) {
          //  && !current.property.name.match(/(state|props)/)
          valueName = `.${current.property.name}${valueName || ''}`;
          current = current.object;
          if (current.type === 'Identifier') {
            valueName = `.${current.name}${valueName || ''}`;
            break;
          }
        }
        valueName = valueName.replace('.', '');
      } else if (attribute.value.expression.type === 'LogicalExpression') {
        valueName = attribute.value.expression.left.property.name;
        // valueType = attribute.value.expression.left.object.name;
      } else if (attribute.value.expression.type === 'JSXElement') {
        const nodez = attribute.value.expression;
        const output = {
          name: nodez.openingElement.name.name,
          children: getChildJSXElements(nodez, parent),
          props: getReactProps(nodez, parent),
          state: {},
          methods: [],
        };
        valueName = output;
      } else valueName = escodegen.generate(attribute.value);

      return {
        name,
        value: valueName,
        parent,
      };
    });
  return result;
}
233985
function parseProperties(text, parsedPropertiesCallback) {
      var dictionary = {};

      // token expressions
      var reBlank = /^\s*|\s*$/;
      var reComment = /^\s*#|^\s*$/;
      var reSection = /^\s*\[(.*)\]\s*$/;
      var reImport = /^\s*@import\s+url\((.*)\)\s*$/i;
      var reSplit = /^([^=\s]*)\s*=\s*(.+)$/; // TODO: escape EOLs with '\'

      // parse the *.properties file into an associative array
      function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {
        var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);
        var currentLang = '*';
        var genericLang = lang.split('-', 1)[0];
        var skipLang = false;
        var match = '';

        function nextEntry() {
          // Use infinite loop instead of recursion to avoid reaching the
          // maximum recursion limit for content with many lines.
          while (true) {
            if (!entries.length) {
              parsedRawLinesCallback();
              return;
            }
            var line = entries.shift();

            // comment or blank line?
            if (reComment.test(line))
              continue;

            // the extended syntax supports [lang] sections and @import rules
            if (extendedSyntax) {
              match = reSection.exec(line);
              if (match) { // section start?
                // RFC 4646, section 4.4, "All comparisons MUST be performed
                // in a case-insensitive manner."

                currentLang = match[1].toLowerCase();
                skipLang = (currentLang !== '*') &&
                    (currentLang !== lang) && (currentLang !== genericLang);
                continue;
              } else if (skipLang) {
                continue;
              }
              match = reImport.exec(line);
              if (match) { // @import rule?
                loadImport(baseURL + match[1], nextEntry);
                return;
              }
            }

            // key-value pair
            var tmp = line.match(reSplit);
            if (tmp && tmp.length == 3) {
              dictionary[tmp[1]] = evalString(tmp[2]);
            }
          }
        }
        nextEntry();
      }

      // import another *.properties file
      function loadImport(url, callback) {
        xhrLoadText(url, function(content) {
          parseRawLines(content, false, callback); // don't allow recursive imports
        }, null);
      }

      // fill the dictionary
      parseRawLines(text, true, function() {
        parsedPropertiesCallback(dictionary);
      });
    }
723732
function children(node) {
    var result = [];
    for (var k in node) {
        if (!node.hasOwnProperty(k))
            continue;
        if (k[0] === '$')
            continue;
        var val = node[k];
        if (!val)
            continue;
        if (typeof val === "object" && typeof val.type === "string") {
            result.push(val);
        }
        else if (val instanceof Array) {
            for (var i=0; i<val.length; i++) {
                var elm = val[i];
                if (typeof elm === "object" && typeof elm.type === "string") {
                    result.push(elm);
                }
            }
        } 
    }
    return result;
}
262978
function doesMemberExpressionContainCallExpression(node) {
            let currentNode = node.object;
            let currentNodeType = node.object.type;

            while (currentNodeType === "MemberExpression") {
                currentNode = currentNode.object;
                currentNodeType = currentNode.type;
            }

            return currentNodeType === "CallExpression";
        }
927798
function parsePlistXML (node) {
  var i, new_obj, key, val, new_arr, res, counter, type;

  if (!node)
    return null;

  if (node.nodeName === 'plist') {
    new_arr = [];
    if (isEmptyNode(node)) {
      return new_arr;
    }
    for (i=0; i < node.childNodes.length; i++) {
      if (!shouldIgnoreNode(node.childNodes[i])) {
        new_arr.push( parsePlistXML(node.childNodes[i]));
      }
    }
    return new_arr;
  } else if (node.nodeName === 'dict') {
    new_obj = {};
    key = null;
    counter = 0;
    if (isEmptyNode(node)) {
      return new_obj;
    }
    for (i=0; i < node.childNodes.length; i++) {
      if (shouldIgnoreNode(node.childNodes[i])) continue;
      if (counter % 2 === 0) {
        invariant(
          node.childNodes[i].nodeName === 'key',
          'Missing key while parsing <dict/>.'
        );
        key = parsePlistXML(node.childNodes[i]);
      } else {
        invariant(
          node.childNodes[i].nodeName !== 'key',
          'Unexpected key "'
            + parsePlistXML(node.childNodes[i])
            + '" while parsing <dict/>.'
        );
        new_obj[key] = parsePlistXML(node.childNodes[i]);
      }
      counter += 1;
    }
    if (counter % 2 === 1) {
      throw new Error('Missing value for "' + key + '" while parsing <dict/>');
    }
    return new_obj;

  } else if (node.nodeName === 'array') {
    new_arr = [];
    if (isEmptyNode(node)) {
      return new_arr;
    }
    for (i=0; i < node.childNodes.length; i++) {
      if (!shouldIgnoreNode(node.childNodes[i])) {
        res = parsePlistXML(node.childNodes[i]);
        if (null != res) new_arr.push(res);
      }
    }
    return new_arr;

  } else if (node.nodeName === '#text') {
    // TODO: what should we do with text types? (CDATA sections)

  } else if (node.nodeName === 'key') {
    if (isEmptyNode(node)) {
      return '';
    }
    return node.childNodes[0].nodeValue;
  } else if (node.nodeName === 'string') {
    res = '';
    if (isEmptyNode(node)) {
      return res;
    }
    for (i=0; i < node.childNodes.length; i++) {
      var type = node.childNodes[i].nodeType;
      if (type === TEXT_NODE || type === CDATA_NODE) {
        res += node.childNodes[i].nodeValue;
      }
    }
    return res;

  } else if (node.nodeName === 'integer') {
    invariant(
      !isEmptyNode(node),
      'Cannot parse "" as integer.'
    );
    return parseInt(node.childNodes[0].nodeValue, 10);

  } else if (node.nodeName === 'real') {
    invariant(
      !isEmptyNode(node),
      'Cannot parse "" as real.'
    );
    res = '';
    for (i=0; i < node.childNodes.length; i++) {
      if (node.childNodes[i].nodeType === TEXT_NODE) {
        res += node.childNodes[i].nodeValue;
      }
    }
    return parseFloat(res);

  } else if (node.nodeName === 'data') {
    res = '';
    if (isEmptyNode(node)) {
      return Buffer.from(res, 'base64');
    }
    for (i=0; i < node.childNodes.length; i++) {
      if (node.childNodes[i].nodeType === TEXT_NODE) {
        res += node.childNodes[i].nodeValue.replace(/\s+/g, '');
      }
    }
    return Buffer.from(res, 'base64');

  } else if (node.nodeName === 'date') {
    invariant(
      !isEmptyNode(node),
      'Cannot parse "" as Date.'
    )
    return new Date(node.childNodes[0].nodeValue);

  } else if (node.nodeName === 'true') {
    return true;

  } else if (node.nodeName === 'false') {
    return false;
  }
}
550877
function getAllExpressionStatements(node) {
  console.assert(node.body && node.body.body);
  var expressionStatements = [];
  node.body.body.forEach(function(childNode) {
    if (childNode.type == 'ExpressionStatement') {
      expressionStatements.push(childNode);
    } else if (childNode.body) {
      var childExpressions = getAllExpressionStatements(childNode);
      expressionStatements.push.apply(expressionStatements, childExpressions);
    }
  });
  return expressionStatements;
}
1284948
function parseUnaryExpression() {
        var token, expr, startToken;

        if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
            expr = parsePostfixExpression();
        } else if (match('++') || match('--')) {
            startToken = lookahead;
            token = lex();
            expr = inheritCoverGrammar(parseUnaryExpression);
            // ECMA-262 11.4.4, 11.4.5
            if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
                tolerateError(Messages.StrictLHSPrefix);
            }

            if (!isAssignmentTarget) {
                tolerateError(Messages.InvalidLHSInAssignment);
            }
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
            isAssignmentTarget = isBindingElement = false;
        } else if (match('+') || match('-') || match('~') || match('!')) {
            startToken = lookahead;
            token = lex();
            expr = inheritCoverGrammar(parseUnaryExpression);
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
            isAssignmentTarget = isBindingElement = false;
        } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
            startToken = lookahead;
            token = lex();
            expr = inheritCoverGrammar(parseUnaryExpression);
            expr = new WrappingNode(startToken).finishUnaryExpression(token.value, expr);
            if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
                tolerateError(Messages.StrictDelete);
            }
            isAssignmentTarget = isBindingElement = false;
        } else {
            expr = parsePostfixExpression();
        }

        return expr;
    }
719458
function getPropertyNamesInParentObjectExpression(node) {
  var objectExpression = obj.get(node, "parent.parent");
  var ret = [];
  if (!objectExpression) {
    return ret;
  }
  objectExpression.properties.forEach(function (p) {
    if (p.value !== node) {
      ret.push(p.key.name);
    }
  });
  return ret;
}