if elt matches a member of the head substitutionGroup, return 
    the GED typecode.

    head -- ElementDeclaration typecode, 
    elt -- the DOM element being parsed
    ps -- ParsedSoap Instance
437923
def _get_substitute_element(head, elt, ps):
    '''
    '''
    if not isinstance(head, ElementDeclaration):
        return None

    return ElementDeclaration.getSubstitutionElement(head, elt, ps)
187337
protected AbstractRule getMemberRule(CodeElementExtractor.ElementDescription description) {
		for (final Assignment assignment : GrammarUtil.containedAssignments(description.getGrammarComponent())) {
			if (Objects.equals(getCodeBuilderConfig().getMemberCollectionExtensionGrammarName(), assignment.getFeature())) {
				if (assignment.getTerminal() instanceof RuleCall) {
					return ((RuleCall) assignment.getTerminal()).getRule();
				}
			}
		}
		return null;
	}
398524
function() {
    var XML_GRAMMAR_SPEC = 'grammars/xml.peg';
    var NAMESPACE_SPEC = xml2js.opts.inputdir + '/namespace' + xml2js.opts.module + '.xml';
    var CLASS_SPEC = function(c) { return xml2js.opts.inputdir + '/' + c + '.xml'; }
    var TYPES_SPEC = xml2js.opts.inputdir + '/types_8h.xml';
    xml2js.MODULE = xml2js.opts.module;
    return Promise.join(createXmlParser(XML_GRAMMAR_SPEC),
                        xml2js.opts.typemaps ? initCustomPointerTypemaps(xml2js.opts.typemaps) : Promise.resolve(),
                        fs.readFileAsync(NAMESPACE_SPEC, 'utf8'),
                        fs.existsSync(TYPES_SPEC) ? fs.readFileAsync(TYPES_SPEC, 'utf8') : Promise.resolve(null),
                        function(xmlparser, ignore, xml, xml_types) {
      if (xml_types != null) {
        _.extend(xml2js.ENUMS, getEnums(xmlparser.parse(xml_types)[0], false));
        _.extend(xml2js.ENUMS_BY_GROUP, getEnums(xmlparser.parse(xml_types)[0], true));
      }
      var spec_c = xmlparser.parse(xml)[0];
      _.extend(xml2js.ENUMS, getEnums(spec_c, false));
      _.extend(xml2js.ENUMS_BY_GROUP, getEnums(spec_c, true));
      _.extend(xml2js.METHODS, getMethods(spec_c));
      _.each(getSubclassNames(spec_c), function(className) { xml2js.CLASSES[className] = {} });
      var parseClasses = _.map(getSubclasses(spec_c), function(c) {
        return fs.readFileAsync(CLASS_SPEC(c), 'utf8').then(function(xml) {
          try {
            var spec_c = xmlparser.parse(xml)[0];
            var className = getName(spec_c);
            _.extend(xml2js.CLASSES[className], {
              description: getDescription(spec_c),
              parent: getParent(spec_c, className),
              enums: getEnums(spec_c, false, className),
              enums_by_group: getEnums(spec_c, true, className),
              variables: getVariables(spec_c, className),
              methods: getMethods(spec_c, className)
            });
          } catch(e) {
            console.log(e.toString() + ': class ' + className + ' was not parsed correctly.');
          }
        });
      });
      var parseGroups = fs.readdirAsync(xml2js.opts.inputdir).then(function(files) {
        var groupxmlfiles = _.filter(files, function(fn) {
          return ((path.extname(fn) == '.xml') && (path.basename(fn).search(/^group/) != -1));
        });
        return Promise.all(_.map(groupxmlfiles, function(fn) {
          return fs.readFileAsync(xml2js.opts.inputdir + '/' + fn, 'utf8').then(function(xml) {
            var spec_c = xmlparser.parse(xml)[0];
            if (_.isEmpty(getSubmodules(spec_c))) {
              var group = getName(spec_c);
              var classes = getSubclassNames(spec_c);
              xml2js.CLASSGROUPS[group] = {
                description: getDescription(spec_c),
                classes: classes
              };
              _.each(classes, function(c) {
                if (_.has(xml2js.CLASSES, c)) {
                  xml2js.CLASSES[c].group = group;
                } else {
                  console.log('Warning: Group ' + group + ' has unknown class ' + c);
                }
              });
            }
          });
        }));
      });
      return Promise.all(parseClasses.concat(parseGroups));
    }).then(function() {
      if (!_.isEmpty(xml2js.CLASSGROUPS)) {
        // try to categorize ungrouped classes, if any
        var grouped = _.flatten(_.pluck(_.values(xml2js.CLASSGROUPS), 'classes'));
        var ungrouped = _.difference(_.keys(xml2js.CLASSES), grouped);
        _.each(ungrouped, function(c) {
          _.each(findUsage(c), function(group) {
            xml2js.CLASSGROUPS[group].classes.push(c);
          });
        });
        grouped = _.flatten(_.pluck(_.values(xml2js.CLASSGROUPS), 'classes'));
        ungrouped = _.difference(_.keys(xml2js.CLASSES), grouped);
        // try to categorize ungrouped enums, if any
        _.each(xml2js.ENUMS_BY_GROUP, function(enumGroupSpec, enumGroupName) {
          _.each(findUsage(enumGroupName, true), function(c) {
            xml2js.CLASSES[c].enums_by_group[enumGroupName] = enumGroupSpec;            
            _.each(enumGroupSpec.members, function(enumName) {
              xml2js.CLASSES[c].enums[enumName] = xml2js.ENUMS[enumName];
              delete xml2js.ENUMS[enumName];
            });
            delete xml2js.ENUMS_BY_GROUP[enumGroupName];
          });
        });
      }
    }).then(function() {
      if (xml2js.opts.custom && fs.existsSync(xml2js.opts.custom)) {
        return fs.readFileAsync(xml2js.opts.custom, 'utf8').then(function(custom) {
          try {
            customizeMethods(JSON.parse(custom));
          } catch(e) {
            console.log('invalid custom.json, ignored. ' + e.toString());
          }
        });
      } else {
        console.log(xml2js.opts.custom ? ('Error: No such customization file exists: ' + xml2js.opts.custom) : 'No customizations given.');
      }
    }).then(function() {
      generateCustomPointerClasses();       
      validateMethods();
      validateVars();
      return _.pick(xml2js, 'MODULE', 'ENUMS', 'ENUMS_BY_GROUP', 'METHODS', 'CLASSES', 'CLASSGROUPS');
    });
  }
1126629
function(sel) {
      if (!this.length) {
        return this;
      }
      var matched = [],
    	 		el = this[0];

    	while (el = el.nextElementSibling) {
    		sel ?
    			(u(el).is(sel) && matched.push(el)) :
    			matched.push(el);
    	}
    	return u(matched);
    }
1323548
def find_elt(modvars, keyword, match_last=False):
    ""
    keyword = strip_fastai(keyword)
    if keyword in modvars: return modvars[keyword]
    comps = keyword.split('.')
    comp_elt = modvars.get(comps[0])
    if hasattr(comp_elt, '__dict__'): return find_elt(comp_elt.__dict__, '.'.join(comps[1:]), match_last=match_last)
365348
static TypeMirror getClassArg(Elements elements, Types types, DeclaredType classType) {
    TypeElement classElement = elements.getTypeElement(Class.class.getName());
    TypeParameterElement param = classElement.getTypeParameters().get(0);
    return paramAsMemberOf(types, classType, param);
  }
48107
def simple_value(self, elt, ps, mixed=False):
        '''
        '''
        if not _valid_encoding(elt):
            raise EvaluateException('Invalid encoding', ps.Backtrace(elt))
        c = _children(elt)
        if mixed is False:
            if len(c) == 0:
                raise EvaluateException('Value missing', ps.Backtrace(elt))
            for c_elt in c:
                if c_elt.nodeType == _Node.ELEMENT_NODE:
                    raise EvaluateException('Sub-elements in value',
                        ps.Backtrace(c_elt))

        # It *seems* to be consensus that ignoring comments and
        # concatenating the text nodes is the right thing to do.
        return ''.join([E.nodeValue for E in c
                if E.nodeType 
                in [ _Node.TEXT_NODE, _Node.CDATA_SECTION_NODE ]])
722796
function parseGroupExpression() {
        var expr, expressions, startToken, i, params = [];

        expect('(');

        if (match(')')) {
            lex();
            if (!match('=>')) {
                expect('=>');
            }
            return {
                type: PlaceHolders.ArrowParameterPlaceHolder,
                params: [],
                rawParams: []
            };
        }

        startToken = lookahead;
        if (match('...')) {
            expr = parseRestElement(params);
            expect(')');
            if (!match('=>')) {
                expect('=>');
            }
            return {
                type: PlaceHolders.ArrowParameterPlaceHolder,
                params: [expr]
            };
        }

        isBindingElement = true;
        expr = inheritCoverGrammar(parseAssignmentExpression);

        if (match(',')) {
            isAssignmentTarget = false;
            expressions = [expr];

            while (startIndex < length) {
                if (!match(',')) {
                    break;
                }
                lex();

                if (match('...')) {
                    if (!isBindingElement) {
                        throwUnexpectedToken(lookahead);
                    }
                    expressions.push(parseRestElement(params));
                    expect(')');
                    if (!match('=>')) {
                        expect('=>');
                    }
                    isBindingElement = false;
                    for (i = 0; i < expressions.length; i++) {
                        reinterpretExpressionAsPattern(expressions[i]);
                    }
                    return {
                        type: PlaceHolders.ArrowParameterPlaceHolder,
                        params: expressions
                    };
                }

                expressions.push(inheritCoverGrammar(parseAssignmentExpression));
            }

            expr = new WrappingNode(startToken).finishSequenceExpression(expressions);
        }


        expect(')');

        if (match('=>')) {
            if (expr.type === Syntax.Identifier && expr.name === 'yield') {
                return {
                    type: PlaceHolders.ArrowParameterPlaceHolder,
                    params: [expr]
                };
            }

            if (!isBindingElement) {
                throwUnexpectedToken(lookahead);
            }

            if (expr.type === Syntax.SequenceExpression) {
                for (i = 0; i < expr.expressions.length; i++) {
                    reinterpretExpressionAsPattern(expr.expressions[i]);
                }
            } else {
                reinterpretExpressionAsPattern(expr);
            }

            expr = {
                type: PlaceHolders.ArrowParameterPlaceHolder,
                params: expr.type === Syntax.SequenceExpression ? expr.expressions : [expr]
            };
        }
        isBindingElement = false;
        return expr;
    }
689737
public void parseReplacedMethodSubElements(Element beanEle, MethodOverrides overrides) {
    NodeList nl = beanEle.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
      Node node = nl.item(i);
      if (node instanceof Element && nodeNameEquals(node, REPLACED_METHOD_ELEMENT)) {
        Element replacedMethodEle = (Element) node;
        String name = replacedMethodEle.getAttribute(NAME_ATTRIBUTE);
        String callback = replacedMethodEle.getAttribute(REPLACER_ATTRIBUTE);
        ReplaceOverride replaceOverride = new ReplaceOverride(name, callback);
        // Look for arg-type match elements.
        List<Element> argTypeEles = DomUtils.getChildElementsByTagName(replacedMethodEle, ARG_TYPE_ELEMENT);
        for (Element argTypeEle : argTypeEles) {
          replaceOverride.addTypeIdentifier(argTypeEle.getAttribute(ARG_TYPE_MATCH_ATTRIBUTE));
        }
        replaceOverride.setSource(extractSource(replacedMethodEle));
        overrides.addOverride(replaceOverride);
      }
    }
  }
377075
def checkname(self, elt, ps):
        '''
        '''

        parselist,errorlist = self.get_parse_and_errorlist()
        ns, name = _get_element_nsuri_name(elt)
        if ns == SOAP.ENC:
            # Element is in SOAP namespace, so the name is a type.
            if parselist and \
            (None, name) not in parselist and (ns, name) not in parselist:
                raise EvaluateException(
                'Element mismatch (got %s wanted %s) (SOAP encoding namespace)' % \
                        (name, errorlist), ps.Backtrace(elt))
            return (ns, name)

        # Not a type, check name matches.
        if self.nspname and ns != self.nspname:
            raise EvaluateException('Element NS mismatch (got %s wanted %s)' % \
                (ns, self.nspname), ps.Backtrace(elt))

        if self.pname and name != self.pname:
            raise EvaluateException('Element Name mismatch (got %s wanted %s)' % \
                (name, self.pname), ps.Backtrace(elt))
        return self.checktype(elt, ps)
1317956
def GetClassText(heading, name, showprivate=False, showinh=False):
        """"""
        und = '-'*len(heading)
        avail = [':private-members:', ':inherited-members:']
        opts = []
        if showprivate:
            opts.append(avail[0])
        if showinh:
            opts.append(avail[1])
        opts = '\n'.join(opts)
        return r'''

%s
%s

.. autoclass:: %s
    :show-inheritance:
    :members:
    :undoc-members:
    %s

''' % (heading, und, name, opts)
1354113
def _handle_codeblock(self, match):
        
        from pygments.lexers import get_lexer_by_name

        # section header
        yield match.start(1), String        , match.group(1)
        yield match.start(2), String        , match.group(2)
        yield match.start(3), Text          , match.group(3)

        # lookup lexer if wanted and existing
        lexer = None
        if self.handlecodeblocks:
            try:
                lexer = get_lexer_by_name( match.group(2).strip() )
            except ClassNotFound:
                pass
        code = match.group(4)

        # no lexer for this language. handle it like it was a code block
        if lexer is None:
            yield match.start(4), String, code
            return

        for item in do_insertions([], lexer.get_tokens_unprocessed(code)):
            yield item

        yield match.start(5), String        , match.group(5)
47521
def from_elements(cls, elts=None):
        
        node = cls()
        if elts is None:
            node.elts = []
        else:
            node.elts = [const_factory(e) if _is_const(e) else e for e in elts]
        return node
1341571
function(el) {
  var typeAttr;
  var $el = $(el);
  var tagName = $el[0].tagName;
  var type = tagName;

  if (tagName.toLowerCase() === 'input') {
    typeAttr = $el.attr('type');
    if (typeAttr) {
      type = typeAttr;
    } else {
      type = 'text';
    }
  }

  if (('' + $el.attr('contenteditable')).toLowerCase() === 'true') {
    type = 'contenteditable';
  }

  // Always return the type as lowercase
  // so it can be matched to lowercase
  // type registrations.
  return type.toLowerCase();
}
711918
def name_match(self, elt):
        '''
        '''
        return self.pname == elt.localName and \
                    self.nspname in [None, '', elt.namespaceURI]
97795
private JCTree matchAnnoToTree(AnnotationMirror findme,
                                   Element e, JCTree tree) {
        Symbol sym = cast(Symbol.class, e);
        class Vis extends JCTree.Visitor {
            List<JCAnnotation> result = null;
            public void visitTopLevel(JCCompilationUnit tree) {
                result = tree.packageAnnotations;
            }
            public void visitClassDef(JCClassDecl tree) {
                result = tree.mods.annotations;
            }
            public void visitMethodDef(JCMethodDecl tree) {
                result = tree.mods.annotations;
            }
            public void visitVarDef(JCVariableDecl tree) {
                result = tree.mods.annotations;
            }
        }
        Vis vis = new Vis();
        tree.accept(vis);
        if (vis.result == null)
            return null;

        List<Attribute.Compound> annos = sym.getRawAttributes();
        return matchAnnoToTree(cast(Attribute.Compound.class, findme),
                               annos,
                               vis.result);
    }
79147
def SimpleHREF(self, elt, ps, tag):
        ''' 
        '''
        if len(_children(elt)): return elt
        href = _find_href(elt)
        if not href:
            if self.minOccurs is 0: return None
            raise EvaluateException('Required' + tag + ' missing',
                    ps.Backtrace(elt))
        return ps.FindLocalHREF(href, elt, 0)