Expands the macro reference.

    Args:
      macro_ref_str: String of a macro reference (i.e. foo(a, b)).

    Returns:
      The text from the expansion.

    Raises:
      PDDMError if there are any issues.
340767
def Expand(self, macro_ref_str):
    
    match = _MACRO_RE.match(macro_ref_str)
    if match is None or match.group(0) != macro_ref_str:
      raise PDDMError('Failed to parse macro reference: "%s"' % macro_ref_str)
    if match.group('name') not in self._macros:
      raise PDDMError('No macro named "%s".' % match.group('name'))
    return self._Expand(match, [], macro_ref_str)
277612
def p_const_ref(self, p):
        ''''''
        p[0] = ast.ConstReference(p[1], lineno=p.lineno(1))
213579
def show_xref(self, f_a):
        
        if f_a:
            bytecode._PrintSubBanner("XREF Read")
            xrefs_from = f_a.get_xref_read()
            for ref_class, ref_method in xrefs_from:
                bytecode._PrintDefault(ref_method.get_name())
                bytecode._PrintDefault('\n')

            bytecode._PrintDefault('\n')

            bytecode._PrintSubBanner("XREF Write")
            xrefs_to = f_a.get_xref_write()
            for ref_class, ref_method in xrefs_to:
                bytecode._PrintDefault(ref_method.get_name())
                bytecode._PrintDefault('\n')
463989
function replaceArgsExpr(ctx, forms, expansioncode, replacements, isrestarg) {
  var macroname = forms[0].value;

  var expr_name = expansioncode[0] ? expansioncode[0].value : ""
  var marker = (expr_name !== "#args-get" ? expansioncode[1].value :
        expansioncode[2].value ? expansioncode[2].value : expansioncode[2][0].value);

  if(marker.charAt(0) === "~") {
    marker = marker.substring(1);
  }
  var isSplice = false;
  if(marker.charAt(0) === "@") {
    marker = marker.substring(1);
    isSplice = true;
  }
  var replarray = replacements[marker];
  if (expr_name === "#args-shift") {
    if (!Array.isArray(replarray)) {
      expansioncode[1].error('can\'t #args-shift: invalid argument type in "' + macroname + '"');
    }
    var argshift = replarray.shift()
    if (typeof argshift === "undefined") {
      expansioncode[1].error('can\'t #args-shift: invalid number of arguments to "' + macroname + '"');
    }
    return spliceArgsExprResult(isSplice, argshift);
  }
  if (expr_name === "#args-erase-head") {
    if (!Array.isArray(replarray)) {
      expansioncode[1].error('can\'t #args-rest: invalid argument type in "' + macroname + '"');
    }
    replacements[marker] = replarray.splice(1, replarray.length);
    return undefined;
  }
  if (expr_name === "#args-rest") {
    if (!Array.isArray(replarray)) {
      expansioncode[1].error('can\'t #args-rest: invalid argument type in "' + macroname + '"');
    }
    var argsrest = replarray.splice(1, replarray.length);
    if (typeof argsrest === "undefined") {
      expansioncode[1].error('can\'t #args-rest: invalid number of arguments to "' + macroname + '"');
    }
    return spliceArgsExprResult(isSplice, argsrest);
  }
  if (expr_name === "#args-second") {
    if (!Array.isArray(replarray)) {
      expansioncode[1].error('can\'t #args-second: invalid argument type in "' + macroname + '"');
    }
    // note splice here does *remove* the second element from the array (a side effect!)
    var argsecond = replarray.splice(1, 1)[0]
    if (typeof argsecond === "undefined") {
      expansioncode[1].error('no #args-second: invalid number of arguments to "' + macroname + '"');
    }
    return spliceArgsExprResult(isSplice, argsecond);
  }
  if (expr_name === "#args-get") {
    // we have an extra arg compared to the other #args expressions
    var whichArg = expansioncode[1].value;

    if (!Array.isArray(replarray)) {
      expansioncode[2].error('can\'t #args-get: invalid argument type in "' + macroname + '"');
    }
    if (whichArg < 0 || whichArg >= replarray.length) {
      expansioncode[2].error("can\'t #args-get: no argument at position " + whichArg +
                                ' in "' + macroname + '"');
    }
    var argVal = replarray[whichArg];

    if (typeof argVal === "undefined") {
      expansioncode[2].error("no #args-get: undefined argument at position " + whichArg +
                                ' in "' + macroname + '"');
    }
    return spliceArgsExprResult(isSplice, argVal);

  }
  if (expr_name === "#args-if") {
    var argsif;
    if (!Array.isArray(replarray)) {
      expansioncode[1].error('can\'t #args-if: invalid argument type in "' + macroname + '"');
    }
    if (replarray.length) {
      argsif = replaceCode(ctx, forms, expansioncode[2], replacements, isrestarg);
    } else if (expansioncode[3]) {
      argsif = replaceCode(ctx, forms, expansioncode[3], replacements, isrestarg);
    } else {
      return
    }
    return spliceArgsExprResult(isSplice, argsif);
  }
}
403076
def add_ref(self, ref):
        

        self.refs[ref.insn_addr].append(ref)
        self.data_addr_to_ref[ref.memory_data.addr].append(ref)
498187
def ref=(cell_reference)
      cell_reference = cell_reference.r if cell_reference.is_a?(Cell)
      Axlsx::validate_string cell_reference
      @ref = cell_reference
    end
410461
def substitute_url_with_ref(self, txt):
        

        # Find links
        mi = re.finditer(r'\[([^\]]+|\[[^\]]+\])\]\(([^\)]+)\)', txt)
        if mi:
            # Iterate over match objects in iterator returned by
            # re.finditer
            for mo in mi:
                # Get components of current match: full matching text,
                # the link label, and the postfix to the base url in the
                # link url
                mtxt = mo.group(0)
                lbl = mo.group(1)
                url = mo.group(2)

                # Try to look up the current link url. Issue a warning if
                # the lookup fails, and do the substitution if it succeeds.
                try:
                    ref = self.get_sphinx_ref(url, lbl)
                except KeyError as ex:
                    print('Warning: %s' % ex.args[0])
                else:
                    txt = re.sub(re.escape(mtxt), ref, txt)

        return txt
923719
def MACRO_DEFINITION(self, cursor):
        
        # TODO: optionalize macro parsing. It takes a LOT of time.
        # ignore system macro
        if (not hasattr(cursor, 'location') or cursor.location is None or
                cursor.location.file is None):
            return False
        name = self.get_unique_name(cursor)
        # if name == 'A':
        #    code.interact(local=locals())
        # Tokens !!! .kind = {IDENTIFIER, KEYWORD, LITERAL, PUNCTUATION,
        # COMMENT ? } etc. see TokenKinds.def
        comment = None
        tokens = self._literal_handling(cursor)
        # Macro name is tokens[0]
        # get Macro value(s)
        value = True
        if isinstance(tokens, list):
            if len(tokens) == 2:
                value = tokens[1]
            else:
                # just merge the list of tokens
                value = ''.join(tokens[1:])
        # macro comment maybe in tokens. Not in cursor.raw_comment
        for t in cursor.get_tokens():
            if t.kind == TokenKind.COMMENT:
                comment = t.spelling
        # special case. internal __null
        # FIXME, there are probable a lot of others.
        # why not Cursor.kind GNU_NULL_EXPR child instead of a token ?
        if name == 'NULL' or value == '__null':
            value = None
        log.debug('MACRO: #define %s %s', tokens[0], value)
        obj = typedesc.Macro(name, None, value)
        try:
            self.register(name, obj)
        except DuplicateDefinitionException:
            log.info(
                'Redefinition of %s %s->%s',
                name, self.parser.all[name].args, value)
            # HACK
            self.parser.all[name] = obj
        self.set_location(obj, cursor)
        # set the comment in the obj
        obj.comment = comment
        return True
1368230
def set_message_ref(self, value):
        
        if value is None:
            self.__message_ref = value
        if not isinstance(value, str):
            raise TypeError("MessageRef must be set to a String")
        else:
            self.__message_ref = value
654042
def get_change_type(self, ref, a1, a2):
        
        if ref == '.':
            return self.INSERTION
        elif a1 == '.' or a2 == '.':
            return self.DELETION
1227923
def _add_reference(reference, statement):
    '''
    
    '''
    type_, value = _expand_one_key_dictionary(reference)
    opt = Option(type_)
    param = SimpleParameter(value)
    opt.add_parameter(param)
    statement.add_child(opt)
734040
def reference(self):
        """"""

        # Import from_didl_string if it isn't present already. The import
        # happens here because it would cause cyclic import errors if the
        # import happened at load time.
        global _FROM_DIDL_STRING_FUNCTION  # pylint: disable=global-statement
        if not _FROM_DIDL_STRING_FUNCTION:
            from . import data_structures_entry
            _FROM_DIDL_STRING_FUNCTION = data_structures_entry.from_didl_string

        ref = _FROM_DIDL_STRING_FUNCTION(
            getattr(self, 'resource_meta_data'))[0]
        # The resMD metadata lacks a <res> tag, so we use the resources from
        # the favorite to make 'reference' playable.
        ref.resources = self.resources
        return ref
121741
def refs_section(doc):
    
    lines = []
    if "References" in doc and len(doc["References"]) > 0:
        # print("Found refs")
        for ref in doc["References"]:
            # print(ref)
            ref_num = re.findall("\[([0-9]+)\]", ref)[0]
            # print(ref_num)
            ref_body = " ".join(ref.split(" ")[2:])
            # print(f"[^{ref_num}] {ref_body}" + "\n")
            lines.append(f"[^{ref_num}]: {ref_body}" + "\n\n")
            # print(lines)
    return lines
1027684
def expand(template_str, dictionary, **kwargs):
    
    t = Template(template_str, **kwargs)
    return t.expand(dictionary)
1061884
def refsDecl(self):
        
        for refsDecl in self.graph.objects(self.asNode(), RDF_NAMESPACES.TEI.replacementPattern):
            return str(refsDecl)
571189
def p_example_field_ref(self, p):
        ''
        p[0] = AstExampleField(self.path, p.lineno(1), p.lexpos(1),
            p[1], AstExampleRef(self.path, p.lineno(3), p.lexpos(3), p[3]))
439474
def add_reference(self, reftype: str, label: str, target):
        

        # The self.data[reftype] dict springs into being during the
        # register_references event handler at startup, which looks in the
        # kb registry for all registered reference names.
        self.data[reftype][label] = target