Generates AST Nodes for a preprocessor branch.
347737
function preprocessor_branch(if_directive,
                                 elif_directives,
                                 else_directive) {
      var elseList = elif_directives;
      if (else_directive) {
        elseList = elseList.concat([else_directive]);
      }
      var result = if_directive[0];
      result.guarded_statements = if_directive[1].statements;
      var current_branch = result;
      for (var i = 0; i < elseList.length; i++) {
        current_branch.elseBody = elseList[i][0];
        current_branch.elseBody.guarded_statements =
          elseList[i][1].statements;
        current_branch = current_branch.elseBody;
      }
      return result;
    }
726610
async function generateNodeSource() {
  const sourceText = await fs.readFile(sourceFile, 'utf8');

  // Parse index.d.ts. A dummy filename is required but it doesn't create a
  // file.
  let typescriptSourceFile = typescript.createSourceFile(
    'temp.d.ts',
    sourceText,
    typescript.ScriptTarget.ES2015,
    /*setParentNodes */ false
  );

  /**
   * Typescript transformer function. Removes nodes tagged with @webonly.
   */
  const removeWebOnlyNodes = context => rootNode => {
    function visit(node) {
      if (
        node.jsDoc &&
        node.jsDoc.some(
          item =>
            item.tags &&
            item.tags.some(tag => tag.tagName.escapedText === 'webonly')
        )
      ) {
        return null;
      }
      return typescript.visitEachChild(node, visit, context);
    }
    return typescript.visitNode(rootNode, visit);
  };

  // Use above transformer on source AST to remove nodes tagged with @webonly.
  const result = typescript.transform(typescriptSourceFile, [
    removeWebOnlyNodes
  ]);

  // Convert transformed AST to text and write to file.
  const printer = typescript.createPrinter();
  return fs.writeFile(
    tempNodeSourcePath,
    printer.printFile(result.transformed[0])
  );
}
322531
def nodes_dump(self):
        """"""
        self._flush_nodes()
        for (graph, node, branch, turn,tick, extant) in self.sql('nodes_dump'):
            yield (
                self.unpack(graph),
                self.unpack(node),
                branch,
                turn,
                tick,
                bool(extant)
            )
587609
def generate(env):
    """"""
    static_obj, shared_obj = SCons.Tool.createObjBuilders(env)

    for suffix in ASSuffixes:
        static_obj.add_action(suffix, SCons.Defaults.ASAction)
        static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter)

    for suffix in ASPPSuffixes:
        static_obj.add_action(suffix, SCons.Defaults.ASPPAction)
        static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter)

    env['AS']        = 'nasm'
    env['ASFLAGS']   = SCons.Util.CLVar('')
    env['ASPPFLAGS'] = '$ASFLAGS'
    env['ASCOM']     = '$AS $ASFLAGS -o $TARGET $SOURCES'
    env['ASPPCOM']   = '$CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES'
1364593
def generate(env):
    """"""
    c_file, cxx_file = SCons.Tool.createCFileBuilders(env)

    # C
    c_file.add_action(".l", LexAction)
    c_file.add_emitter(".l", lexEmitter)

    c_file.add_action(".lex", LexAction)
    c_file.add_emitter(".lex", lexEmitter)

    # Objective-C
    cxx_file.add_action(".lm", LexAction)
    cxx_file.add_emitter(".lm", lexEmitter)

    # C++
    cxx_file.add_action(".ll", LexAction)
    cxx_file.add_emitter(".ll", lexEmitter)

    env["LEX"]      = env.Detect("flex") or "lex"
    env["LEXFLAGS"] = SCons.Util.CLVar("")
    env["LEXCOM"] = "$LEX $LEXFLAGS -t $SOURCES > $TARGET"
77730
def _nodes(output, parent=None):
    """"""
    # NOTE refactor so all outputs behave the same
    entity = getattr(output, 'entity', output)

    if isinstance(entity, Collection):
        for member in entity.members:
            if parent is not None:
                member = attr.evolve(member, parent=parent)
            yield from _nodes(member)
        yield output
    else:
        yield output
945166
protected function processBranch(DOMNode $branch)
	{
		$list = $this->childrenAsArray($branch->childNodes);

		for ($i = 0; $i < count($list); $i++)
		{
			$node = $list[$i];
			if ($node->namespaceURI == self::NS)
			{
				$node = $this->processExtendedNode($node);
			}

			if ($node && in_array($node->nodeName, $this->inputs))
			{
				$node = $this->processInput($node);
			}

			if ($node)
			{
				$this->processBranch($node);
			}
			//$this->processExtendedAttributes($node);
		}

	}
645668
def until_node(node, indent)
      # Until we have a branch that doesn't meet the condition, generate code for the
      # children related to that specific branch
      buffer_eval "until #{node[@value]}"

      # Evaluate child nodes
      node[@children].each do |child|
        root child, indent
      end

      # End
      buffer_eval 'end'
    end
1134174
def from_ast(
        pyast_node, node=None, node_cls=None, Node=Node,
        iter_fields=ast.iter_fields, AST=ast.AST):
    '''
    '''
    node_cls = node_cls or Node
    node = node or node_cls()
    name = pyast_node.__class__.__name__

    attrs = []
    for field, value in iter_fields(pyast_node):
        if name == 'Dict':
            for key, value in zip(pyast_node.keys, pyast_node.values):
                if isinstance(value, list):
                    for item in value:
                        if isinstance(item, AST):
                            value = from_ast(item)
                elif isinstance(value, AST):
                    value = from_ast(value)
                attrs.append((key.s, value))
        else:
            if isinstance(value, list):
                for item in value:
                    if isinstance(item, AST):
                        value = from_ast(item)
            elif isinstance(value, AST):
                value = from_ast(value)
            attrs.append((field, value))
    node.update(attrs, type=name)
    return node
946828
function _initBranch(branchToken) {
  const [, keyword, name, remainder] = branchToken.match(BRANCH_REGEX);

  return {
    name: name.toLowerCase(),
    keyword,
    params: _parseParams(remainder),
    fields: {},
  };
}
186777
def subgraph_from(self, targets: sos_targets):
        ''''''
        if 'DAG' in env.config['SOS_DEBUG'] or 'ALL' in env.config['SOS_DEBUG']:
            env.log_to_file('DAG', 'create subgraph')
        # first, find all nodes with targets
        subnodes = []
        for node in self.nodes():
            if node._output_targets.valid() and any(
                    x in node._output_targets for x in targets):
                subnodes.append(node)
        #
        ancestors = set()
        for node in subnodes:
            ancestors |= nx.ancestors(self, node)
        return SoS_DAG(nx.subgraph(self, subnodes + list(ancestors)))
711124
def typeCompileAst(ast):
    
    children = list(ast.children)
    if ast.astType == 'op':
        retsig = ast.typecode()
        basesig = ''.join(x.typecode() for x in list(ast.children))
        # Find some operation that will work on an acceptable casting of args.
        for sig in sigPerms(basesig):
            value = (ast.value + '_' + retsig + sig).encode('ascii')
            if value in interpreter.opcodes:
                break
        else:
            for sig in sigPerms(basesig):
                funcname = (ast.value + '_' + retsig + sig).encode('ascii')
                if funcname in interpreter.funccodes:
                    value = ('func_%sn' % (retsig + sig)).encode('ascii')
                    children += [ASTNode('raw', 'none',
                                         interpreter.funccodes[funcname])]
                    break
            else:
                raise NotImplementedError(
                    "couldn't find matching opcode for '%s'"
                    % (ast.value + '_' + retsig + basesig))
        # First just cast constants, then cast variables if necessary:
        for i, (have, want) in enumerate(zip(basesig, sig)):
            if have != want:
                kind = typecode_to_kind[want]
                if children[i].astType == 'constant':
                    children[i] = ASTNode('constant', kind, children[i].value)
                else:
                    opname = "cast"
                    children[i] = ASTNode('op', kind, opname, [children[i]])
    else:
        value = ast.value
        children = ast.children
    return ASTNode(ast.astType, ast.astKind, value,
                   [typeCompileAst(c) for c in children])
896766
def create_helper_trans_node(op_name, input_node, node_name):
    """"""
    node_name = op_name + "_" + node_name
    trans_node = onnx.helper.make_node(
        'Transpose',
        inputs=[input_node],
        outputs=[node_name],
        name=node_name
    )
    return trans_node
1330586
function preProcessSymbols(symbols) {
			// Create treeName and modify module names
			symbols.forEach(oSymbol => {
				let sModuleClearName = oSymbol.name.replace(/^module:/, "");
				oSymbol.displayName = sModuleClearName;
				oSymbol.treeName = sModuleClearName.replace(/\//g, ".");
			});

			// Create missing - virtual namespaces
			symbols.forEach(oSymbol => {
				oSymbol.treeName.split(".").forEach((sPart, i, a) => {
					let sName = a.slice(0, (i + 1)).join(".");

					if (!symbols.find(o => o.treeName === sName)) {
						symbols.push({
							name: sName,
							displayName: sName,
							treeName: sName,
							lib: oSymbol.lib,
							kind: "namespace"
						});
					}
				});
			});

			// Discover parents
			symbols.forEach(oSymbol => {
				let aParent = oSymbol.treeName.split("."),
					sParent;

				// Extract parent name
				aParent.pop();
				sParent = aParent.join(".");

				// Mark parent
				if (symbols.find(({treeName}) => treeName === sParent)) {
					oSymbol.parent = sParent;
				}
			});

			// Attach children info
			symbols.forEach(oSymbol => {
				if (oSymbol.parent) {
					let oParent = symbols.find(({treeName}) => treeName === oSymbol.parent);

					if (!oParent.nodes) oParent.nodes = [];
					oParent.nodes.push({
						name: oSymbol.displayName,
						description: formatters._preProcessLinksInTextBlock(oSymbol.description),
						href: "#/api/" + encodeURIComponent(oSymbol.name)
					});
				}
			});

			// Clean list - keep file size down
			symbols.forEach(o => {
				delete o.treeName;
				delete o.parent;
			});
		}
1334283
def prepend(self, *nodes: Union[str, AbstractNode]) -> None:
        """"""
        node = _to_node_list(nodes)
        if self.firstChild:
            self.insertBefore(node, self.firstChild)
        else:
            self.appendChild(node)
580384
def generate_dep_names(self, target: Target):
        """"""
        yield from sorted(get_descendants(self.target_graph, target.name))
161666
def on_branch(node, compiled_grammar)
      steps = process(node.children[0], compiled_grammar)

      if node.children[1]
        code = process(node.children[1], compiled_grammar)
      else
        code = nil
      end

      return Branch.new(steps, node.source_line, code)
    end