Create ESTree node representing particular JavaScript literal.
161532
function literalNode (value) {
  if (value === undefined) {
    return {
      type: 'Identifier',
      name: 'undefined'
    };
  }
  else if (typeof value == 'function') {
    throw Error('Unist property contains a function');
  }
  else if (value === null || typeof value != 'object') {
    return {
      type: 'Literal',
      value: value
    };
  }
  else if (Array.isArray(value)) {
    return {
      type: 'ArrayExpression',
      elements: value.map(literalNode)
    };
  }
  else {
    return {
      type: 'ObjectExpression',
      properties: Object.keys(value).map(function (key) {
        return {
          type: 'Property',
          key: {
            type: 'Identifier',
            name: key
          },
          value: literalNode(value[key])
        };
      })
    };
  }
}
1172727
function createInline(type, props = {}, nodes) {
  const node = { object: 'inline', type, ...props };
  return addNodes(node, nodes);
}
1209789
private Node createTemplateParameterNode(int index, JSType type, boolean isStringLiteral) {
    checkState(index >= 0);
    checkNotNull(type);
    Node n = Node.newNumber(index);
    if (isStringLiteral) {
      n.setToken(TEMPLATE_STRING_LITERAL);
    } else {
      n.setToken(TEMPLATE_TYPE_PARAM);
    }
    n.setJSType(type);
    return n;
  }
1156209
function createElement(node, document) {
	var tag = void 0;
	if ((typeof node === 'undefined' ? 'undefined' : _typeof(node)) !== 'object') {
		// we have a text node, so create one
		tag = document.createTextNode('' + node);
	} else {
		tag = document.createElement(node.tagName);
		// add all required attributes
		Object.keys(node.attributes).forEach(function (attr) {
			tag.setAttribute(attr, node.attributes[attr].value);
		});
		// define it's inner structure
		tag.innerHTML = getInnerHTML(node);
		tag.__hash = node.__hash;
		attachSetAttribute(tag);
	}

	return tag;
}
561459
function transformLiteral (node) {
    const originalValue = node.value.value
    if (rootPathWithDotRegex.test(originalValue)) {
      node.value.value = node.value.value.replace(rootPathWithDotRegex, '$$$1')
    }
  }
137654
def p_string_literal(self, p):
        """"""
        p[0] = self.asttypes.String(p[1])
        p[0].setpos(p)
71999
def visit_subscript(self, node, parent):
        """"""
        context = self._get_context(node)
        newnode = nodes.Subscript(
            ctx=context, lineno=node.lineno, col_offset=node.col_offset, parent=parent
        )
        newnode.postinit(
            self.visit(node.value, newnode), self.visit(node.slice, newnode)
        )
        return newnode
1252440
def define(cls, name, parent=None, interleave=False):
        """"""
        node = cls("define", parent, interleave=interleave)
        node.occur = 0
        node.attr["name"] = name
        return node
1127073
function(path) {
          var node = path.node;
          // console.log('literal node',node);
          if (typeof node.value === 'string') {
            options.sourceNameVariations.forEach(function(variation,index){
              var sourceIndex, typeIndex, segment;
              var sourceRegexp = new RegExp(variation);
              var destReplacement = options.destNameVariations[index];
              var variationIndex = node.value.indexOf(variation);
              if (variationIndex !== -1) {
                // console.log(node.value.indexOf(variation))
                // console.log('match: ',variation, destReplacement, node)
                if (variationIndex === 0 || node.value.charAt(variationIndex - 1) === ' ') {
                  hasSourceRef = true;
                  // console.log(node.value.replace(sourceRegexp, destReplacement))
                  node.value = node.value.replace(sourceRegexp, destReplacement);
                } else {

                  /*
                  example1: my-app/components/foo/bar/foo-bar.js
                  example2: my-app/components/bar/foo-bar.js
                  sourceName: bar/foo-bar.js
                  match the sourceName, determine if the sourcename is at
                  the type root (components for this example)

                  this probably needs to be handled at a structure level.
                  */
                  // console.log(variation + ' matched: ' + node.value + ', but was not first index');
                  sourceIndex = node.value.indexOf(options.sourceName);
                  typeIndex = node.value.indexOf(options.sourceTypeName);
                  segment = node.value.substr((typeIndex + options.sourceTypeName.length + 1), node.value.length);
                  // console.log('diff', segment, options.sourceName,typeIndex, (typeIndex + options.sourceTypeName.length), sourceIndex, options.sourceTypeName);
                  if (segment === options.sourceName) {
                    hasSourceRef = true;
                    node.value = node.value.replace(sourceRegexp, destReplacement);
                    // console.log('rewriting literal', node.value);
                  }
                }
              }
            });
          }
          this.traverse(path);
        }
701609
function compileElement(node, scope, isRoot) {
        var tagName = node.tagName
        var inst
        switch(true) {
            /**
             *  <*-if></*-if>
             */
            case is.IfElement(tagName):
                var children = _slice(node.children)
                var exprs = [$(node).attr('is')]
                children.forEach(function(c) {
                    if (is.ElseElement(c)) {
                        exprs.push($(c).attr(conf.namespace + 'else') || '')
                    }
                })
                inst = new ElementDirective(
                        vm, 
                        scope,
                        node, 
                        elements['if'], 
                        NS + 'if', 
                        exprs
                )
                if (!isRoot) {
                    inst.$mount(node)
                }
                // save elements refs
                _directives.push(inst)
                // save bindins to scope
                _setBindings2Scope(scope, inst)
                return inst
            /**
             *  <*-repeat></*-repeat>
             */
            case is.RepeatElement(tagName):
                inst = new ElementDirective(
                        vm, 
                        scope,
                        node, 
                        elements.repeat,
                        NS + 'repeat', 
                        $(node).attr('items')
                )
                if (!isRoot) {
                    inst.$mount(node)
                }
                _directives.push(inst)
                _setBindings2Scope(scope, inst)
                return inst
        }
    }
869761
function make_node(context, path, type, callback) {
  if(type !== NODE_TYPE_DIRECTORY && type !== NODE_TYPE_FILE) {
    return callback(new Errors.EINVAL('type must be a directory or file', path));
  }

  path = normalize(path);

  var name = basename(path);
  var parentPath = dirname(path);
  var parentNode;
  var parentNodeData;
  var node;

  // Check if the parent node exists
  function create_node_in_parent(error, parentDirectoryNode) {
    if(error) {
      callback(error);
    } else if(parentDirectoryNode.type !== NODE_TYPE_DIRECTORY) {
      callback(new Errors.ENOTDIR('a component of the path prefix is not a directory', path));
    } else {
      parentNode = parentDirectoryNode;
      find_node(context, path, check_if_node_exists);
    }
  }

  // Check if the node to be created already exists
  function check_if_node_exists(error, result) {
    if(!error && result) {
      callback(new Errors.EEXIST('path name already exists', path));
    } else if(error && !(error instanceof Errors.ENOENT)) {
      callback(error);
    } else {
      context.getObject(parentNode.data, create_node);
    }
  }

  // Create the new node
  function create_node(error, result) {
    if(error) {
      callback(error);
    } else {
      parentNodeData = result;
      Node.create({
        guid: context.guid,
        type: type
      }, function(error, result) {
        if(error) {
          callback(error);
          return;
        }
        node = result;
        node.nlinks += 1;
        context.putObject(node.id, node, update_parent_node_data);
      });
    }
  }

  // Update parent node time
  function update_time(error) {
    if(error) {
      callback(error);
    } else {
      var now = Date.now();
      update_node_times(context, parentPath, node, { mtime: now, ctime: now }, callback);
    }
  }

  // Update the parent nodes data
  function update_parent_node_data(error) {
    if(error) {
      callback(error);
    } else {
      parentNodeData[name] = new DirectoryEntry(node.id, type);
      context.putObject(parentNode.data, parentNodeData, update_time);
    }
  }

  // Find the parent node
  find_node(context, parentPath, create_node_in_parent);
}
725321
function NodeWithToken(str, start, end) {
        this.name = str;
        this.start = start;
        this.end = end;
}
1050325
function createElementByString(str) {
        var div = document.createElement('div');
        div.innerHTML = str;

        return div.childNodes;
    }
605715
function jsTreeCtrl() {
        /*jshint validthis:true */
        var nodeSerialId = 1;
        var vm = this;

        vm.nodesFingerprint = function (e) {
            if (!e.__uiNodeId) {
                e.__uiNodeId = nodeSerialId++;
            }
            return '' + e.__uiNodeId + (e.id || '') + (e.text || '') + (e.type || '');
        };

        vm.changeWatcher = function (arraySource, tokenFn) {
            var self;
            var getTokens = function () {
                var result = [], token, el;
                if (arraySource) {
                    var array = angular.isFunction(arraySource) ? arraySource() : arraySource;
                    for (var i = 0, n = array.length; i < n; i++) {
                        el = array[i];
                        token = tokenFn(el);
                        map[token] = el;
                        result.push(token);
                    }
                }
                return result;
            };
            // returns elements in that are in a but not in b
            // subtractAsSets([4, 5, 6], [4, 5, 7]) => [6]
            var subtractAsSets = function (a, b) {
                var result = [], inB = {}, i, n;
                for (i = 0, n = b.length; i < n; i++) {
                    inB[b[i]] = true;
                }
                for (i = 0, n = a.length; i < n; i++) {
                    if (!inB[a[i]]) {
                        result.push(a[i]);
                    }
                }
                return result;
            };

            // Map objects to tokens and vice-versa
            var map = {};

            var applyChanges = function (newTokens, oldTokens) {
                var i, n, el, token;
                var replacedTokens = {};
                var removedTokens = subtractAsSets(oldTokens, newTokens);
                for (i = 0, n = removedTokens.length; i < n; i++) {
                    var removedToken = removedTokens[i];
                    el = map[removedToken];
                    delete map[removedToken];
                    var newToken = tokenFn(el);
                    // if the element wasn't removed but simply got a new token, its old token will be different from the current one
                    if (newToken === removedToken) {
                        self.onRemoved(el);
                    } else {
                        replacedTokens[newToken] = removedToken;
                        self.onChanged(el);
                    }
                }

                var addedTokens = subtractAsSets(newTokens, oldTokens);
                for (i = 0, n = addedTokens.length; i < n; i++) {
                    token = addedTokens[i];
                    el = map[token];
                    if (!replacedTokens[token]) {
                        self.onAdded(el);
                    }
                }

            };
            self = {
                subscribe: function (scope, onChanged) {
                    scope.$watch(getTokens, function (newTokens, oldTokens) {
                        if (!onChanged || onChanged(newTokens, oldTokens) !== false) {
                            applyChanges(newTokens, oldTokens);
                        }
                    }, true);
                },
                onAdded: angular.noop,
                onChanged: angular.noop,
                onRemoved: angular.noop
            };
            return self;
        };
    }
448278
def construct_sls_str(self, node):
        '''
        
        '''

        # Ensure obj is str, not py2 unicode or py3 bytes
        obj = self.construct_scalar(node)
        if six.PY2:
            obj = obj.encode('utf-8')
        return SLSString(obj)
846566
function createElement(nodeName) {
  var elem = document.createElement(nodeName);
  elem.className = [].join.call(arguments, ' ');
  return elem;
}
1191899
function (node) {
      let property;
      switch (node.type) {
        case 'ReturnStatement':
          property = 'argument';
          break;
        case 'ArrowFunctionExpression':
          property = 'body';
          break;
        default:
          return false;
      }

      const returnsJSX =
        node[property] &&
        node[property].type === 'JSXElement'
      ;
      const returnsReactCreateElement =
        node[property] &&
        node[property].callee &&
        node[property].callee.property &&
        node[property].callee.property.name === 'createElement'
      ;

      return Boolean(returnsJSX || returnsReactCreateElement);
    }