Returns false if parsing failed
519581
private void parseVersionXML( final List versionList, final List platformList, final String dir,
                                  final JnlpResource versionRes )
    {
        if ( !versionRes.exists() )
        {
            return;
        }

        // Parse XML into a more understandable format
        XMLNode root = null;
        try
        {
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
            Document doc = docBuilder.parse( new BufferedInputStream( versionRes.getResource().openStream() ) );
            doc.getDocumentElement().normalize();

            // Convert document into an XMLNode structure, since we already got utility methods
            //  to handle these. We should really use the data-binding stuff here - but that will come
            //  later
            //
            root = XMLParsing.convert( doc.getDocumentElement() );
        }
        catch ( SAXParseException err )
        {
            _log.addWarning( "servlet.log.warning.xml.parsing", versionRes.getPath(),
                             Integer.toString( err.getLineNumber() ), err.getMessage() );
            return;
        }
        catch ( Throwable t )
        {
            _log.addWarning( "servlet.log.warning.xml.reading", versionRes.getPath(), t );
            return;
        }

        // Check that root element is a <jnlp> tag
        if ( !root.getName().equals( "jnlp-versions" ) )
        {
            _log.addWarning( "servlet.log.warning.xml.missing-jnlp", versionRes.getPath() );
            return;
        }

        // Visit all <resource> elements
        XMLParsing.visitElements( root, "<resource>", new XMLParsing.ElementVisitor()
        {
            public void visitElement( XMLNode node )
            {
                XMLNode pattern = XMLParsing.findElementPath( node, "<pattern>" );
                if ( pattern == null )
                {
                    _log.addWarning( "servlet.log.warning.xml.missing-pattern", versionRes.getPath() );
                }
                else
                {
                    // Parse pattern
                    String name = XMLParsing.getElementContent( pattern, "<name>", "" );
                    String versionId = XMLParsing.getElementContent( pattern, "<version-id>" );
                    String[] os = XMLParsing.getMultiElementContent( pattern, "<os>" );
                    String[] arch = XMLParsing.getMultiElementContent( pattern, "<arch>" );
                    String[] locale = XMLParsing.getMultiElementContent( pattern, "<locale>" );
                    // Get return request
                    String file = XMLParsing.getElementContent( node, "<file>" );
                    if ( versionId == null || file == null )
                    {
                        _log.addWarning( "servlet.log.warning.xml.missing-elems", versionRes.getPath() );
                    }
                    else
                    {
                        JnlpResource res =
                                new JnlpResource( _servletContext, name, versionId, os, arch, locale, dir + file,
                                                  versionId );
                        if ( res.exists() )
                        {
                            versionList.add( res );
                            if ( _log.isDebugLevel() )
                            {
                                _log.addDebug( "Read resource: " + res );
                            }
                        }
                        else
                        {
                            _log.addWarning( "servlet.log.warning.missing-file", file, versionRes.getPath() );
                        }
                    }
                }
            }
        } );

        // Visit all <resource> elements
        XMLParsing.visitElements( root, "<platform>", new XMLParsing.ElementVisitor()
        {
            public void visitElement( XMLNode node )
            {
                XMLNode pattern = XMLParsing.findElementPath( node, "<pattern>" );
                if ( pattern == null )
                {
                    _log.addWarning( "servlet.log.warning.xml.missing-pattern", versionRes.getPath() );
                }
                else
                {
                    // Parse pattern
                    String name = XMLParsing.getElementContent( pattern, "<name>", "" );
                    String versionId = XMLParsing.getElementContent( pattern, "<version-id>" );
                    String[] os = XMLParsing.getMultiElementContent( pattern, "<os>" );
                    String[] arch = XMLParsing.getMultiElementContent( pattern, "<arch>" );
                    String[] locale = XMLParsing.getMultiElementContent( pattern, "<locale>" );
                    // Get return request
                    String file = XMLParsing.getElementContent( node, "<file>" );
                    String productId = XMLParsing.getElementContent( node, "<product-version-id>" );

                    if ( versionId == null || file == null || productId == null )
                    {
                        _log.addWarning( "servlet.log.warning.xml.missing-elems2", versionRes.getPath() );
                    }
                    else
                    {
                        JnlpResource res =
                                new JnlpResource( _servletContext, name, versionId, os, arch, locale, dir + file,
                                                  productId );
                        if ( res.exists() )
                        {
                            platformList.add( res );
                            if ( _log.isDebugLevel() )
                            {
                                _log.addDebug( "Read platform resource: " + res );
                            }
                        }
                        else
                        {
                            _log.addWarning( "servlet.log.warning.missing-file", file, versionRes.getPath() );
                        }
                    }
                }
            }
        } );
    }
334149
def parse(self, key, value):
        
        if value is not None:
            try:
                return self._parser(value)
            except Exception:
                raise ParsingError("Error parsing {}".format(key))
        elif self._default is not SENTINAL:
            return self._default
        else:
            raise KeyError(key)
1075049
function parseBoolean(value, context) {
    if (value === true || value === 'true') return true;
    if (value === false || value === 'false') return false;
    throw new ImplementationError(`Invalid boolean value "${value}"${context.errorContext}`);
}
38412
def _parse_boolean(value):
    
    if not value:
        return False

    try:
        # Lower string to check known "false" value
        value = value.lower()
        return value not in ("none", "0", "false", "no")
    except AttributeError:
        # Not a string, but has a value
        return True
192858
def __assert_false(returned):
        '''
        
        '''
        result = "Pass"
        if isinstance(returned, str):
            try:
                returned = bool(returned)
            except ValueError:
                raise
        try:
            assert (returned is False), "{0} not False".format(returned)
        except AssertionError as err:
            result = "Fail: " + six.text_type(err)
        return result
1228588
def unvalidated_parm(self, parm: str) -> bool:
        
        return parm.startswith("_") or parm == self.TYPE or parm in self.IGNORE or \
            (self.JSON_LD and parm.startswith('@'))
601245
def parse(self, rule: str):
        

        # Empty rule means always accept
        if not rule:
            return checks.TrueCheck()

        for token, value in self._parse_tokenize(rule):
            self._shift(token, value)

        try:
            return self.result
        except ValueError:
            LOG.exception('Failed to understand rule %r', rule)
            # Fail closed
            return checks.FalseCheck()
518186
public boolean exactOrError(String match,TextProvider textProvider) 
    {
        if (!exact(match,textProvider,false))
        {
            throw new ParserException("Expected "+match,textProvider);
        }
        return true;
    }
837504
def parseErrorAndResponse(self, data):
        """"""

        xml = fromstring(data)
        error = xml.find('.//ERROR')

        if error is None:
            self.deferred.callback(self.parseResponse(xml))
            return

        try:
            code = int(error.attrib['CODE'])
        except ValueError:
            code = 0

        self.deferred.errback(CIMError(code, error.attrib['DESCRIPTION']))
633580
def match?(str, parser=nil)
      node = self.class.parse(str.to_s, parser) rescue (return false)
      self == node
    end
1125597
function ParseError(message, start, end, next) {
	this.message = message;
	this.start = start;
	this.end = end;
	this.next = next;
}
860628
def _parse_failures(gallery_conf):
    """"""
    failing_examples = set(gallery_conf['failing_examples'].keys())
    expected_failing_examples = set(
        os.path.normpath(os.path.join(gallery_conf['src_dir'], path))
        for path in gallery_conf['expected_failing_examples'])
    failing_as_expected = failing_examples.intersection(
        expected_failing_examples)
    failing_unexpectedly = failing_examples.difference(
        expected_failing_examples)
    passing_unexpectedly = expected_failing_examples.difference(
        failing_examples)
    # filter from examples actually run
    passing_unexpectedly = [
        src_file for src_file in passing_unexpectedly
        if re.search(gallery_conf.get('filename_pattern'), src_file)]
    return failing_as_expected, failing_unexpectedly, passing_unexpectedly
58006
def match?(arr, parser=nil)
      arr = arr.to_a
      return false if arr.length != self.length
      each_with_index do |node, i|
        node.match?(arr[i], parser) or return false
      end
      return true
    end
743914
def _check_not_empty(string):
    
    string = string.strip()

    if len(string) == 0:
        message = 'The string should not be empty'
        raise pp.ParseException(message)
752198
def __assert_true(returned):
        '''
        
        '''
        result = "Pass"
        try:
            assert (returned is True), "{0} not True".format(returned)
        except AssertionError as err:
            result = "Fail: " + six.text_type(err)
        return result
732488
function parseError(error) {
  // If this file is at the root of your project
  var pathRegexp = new RegExp(__dirname, 'g');
  var display = '';
  if (error.code) { display += 'Error code: ' + error.code + '\n\n' };
  if (error.stack) { display += error.stack.replace(pathRegexp, ''); }
  if (!display) { display = error.toString(); }
  return display;
}
882663
public function canParse($data)
	{
		$data = trim($data);

		if ($data && strpos($data, '=') === false)
		{
			return false;
		}

		if ((substr($data, 0, 1) == '{') && (substr($data, -1, 1) == '}'))
		{
			return false;
		}

		$obj = @parse_ini_string($data);

		if (!$obj)
		{
			return false;
		}

		return true;
	}