/*
Parses an X.509 CRL, should be used only by constructors.
551390
private void parse(DerValue val) throws CRLException, IOException {
        // check if can over write the certificate
        if (readOnly)
            throw new CRLException("cannot over-write existing CRL");

        if ( val.getData() == null || val.tag != DerValue.tag_Sequence)
            throw new CRLException("Invalid DER-encoded CRL data");

        signedCRL = val.toByteArray();
        DerValue seq[] = new DerValue[3];

        seq[0] = val.data.getDerValue();
        seq[1] = val.data.getDerValue();
        seq[2] = val.data.getDerValue();

        if (val.data.available() != 0)
            throw new CRLException("signed overrun, bytes = "
                                     + val.data.available());

        if (seq[0].tag != DerValue.tag_Sequence)
            throw new CRLException("signed CRL fields invalid");

        sigAlgId = AlgorithmId.parse(seq[1]);
        signature = seq[2].getBitString();

        if (seq[1].data.available() != 0)
            throw new CRLException("AlgorithmId field overrun");

        if (seq[2].data.available() != 0)
            throw new CRLException("Signature field overrun");

        // the tbsCertsList
        tbsCertList = seq[0].toByteArray();

        // parse the information
        DerInputStream derStrm = seq[0].data;
        DerValue       tmp;
        byte           nextByte;

        // version (optional if v1)
        version = 0;   // by default, version = v1 == 0
        nextByte = (byte)derStrm.peekByte();
        if (nextByte == DerValue.tag_Integer) {
            version = derStrm.getInteger();
            if (version != 1)  // i.e. v2
                throw new CRLException("Invalid version");
        }
        tmp = derStrm.getDerValue();

        // signature
        AlgorithmId tmpId = AlgorithmId.parse(tmp);

        // the "inner" and "outer" signature algorithms must match
        if (! tmpId.equals(sigAlgId))
            throw new CRLException("Signature algorithm mismatch");
        infoSigAlgId = tmpId;

        // issuer
        issuer = new X500Name(derStrm);
        if (issuer.isEmpty()) {
            throw new CRLException("Empty issuer DN not allowed in X509CRLs");
        }

        // thisUpdate
        // check if UTCTime encoded or GeneralizedTime

        nextByte = (byte)derStrm.peekByte();
        if (nextByte == DerValue.tag_UtcTime) {
            thisUpdate = derStrm.getUTCTime();
        } else if (nextByte == DerValue.tag_GeneralizedTime) {
            thisUpdate = derStrm.getGeneralizedTime();
        } else {
            throw new CRLException("Invalid encoding for thisUpdate"
                                   + " (tag=" + nextByte + ")");
        }

        if (derStrm.available() == 0)
           return;     // done parsing no more optional fields present

        // nextUpdate (optional)
        nextByte = (byte)derStrm.peekByte();
        if (nextByte == DerValue.tag_UtcTime) {
            nextUpdate = derStrm.getUTCTime();
        } else if (nextByte == DerValue.tag_GeneralizedTime) {
            nextUpdate = derStrm.getGeneralizedTime();
        } // else it is not present

        if (derStrm.available() == 0)
            return;     // done parsing no more optional fields present

        // revokedCertificates (optional)
        nextByte = (byte)derStrm.peekByte();
        if ((nextByte == DerValue.tag_SequenceOf)
            && (! ((nextByte & 0x0c0) == 0x080))) {
            DerValue[] badCerts = derStrm.getSequence(4);

            X500Principal crlIssuer = getIssuerX500Principal();
            X500Principal badCertIssuer = crlIssuer;
            for (int i = 0; i < badCerts.length; i++) {
                X509CRLEntryImpl entry = new X509CRLEntryImpl(badCerts[i]);
                badCertIssuer = getCertIssuer(entry, badCertIssuer);
                entry.setCertificateIssuer(crlIssuer, badCertIssuer);
                X509IssuerSerial issuerSerial = new X509IssuerSerial
                    (badCertIssuer, entry.getSerialNumber());
                revokedMap.put(issuerSerial, entry);
                revokedList.add(entry);
            }
        }

        if (derStrm.available() == 0)
            return;     // done parsing no extensions

        // crlExtensions (optional)
        tmp = derStrm.getDerValue();
        if (tmp.isConstructed() && tmp.isContextSpecific((byte)0)) {
            extensions = new CRLExtensions(tmp.data);
        }
        readOnly = true;
    }
1169819
function parse (expr) {
		var finalRegexp,
			strSlashPref;

		if (typeof expr !== 'string') {
			// Handle RegExp `expr`
			if (expr instanceof RegExp) {
				finalRegexp = new RegExp(expr);
				finalRegexp.query = execQuery;

				return finalRegexp;
			}

			throw new TypeError(
				'Usage: qbus.parse(<`query` = String|RegExp>)\n' + 
				'Got:   qbus.parse(<`' + typeof expr + '` = ' + expr + '>)'
			);
		}
		
		strSlashPref = expr[expr.length - 1] === '/';

		// Trim slashes and remove doubles
		expr = normalizePath(expr);

		// Pass everything from and including possible beginning frontslash
		// until and not including the next frontslash, to `parseLevel`.
		expr = expr.replace(/\/?[^\/]+?(?=\/|$)/g, function (match, index) {
			// Return level if it doesn't contain any modifiers.
			// : must be preceeded by / or start of string to count
			// ? must be used with valid : to count (so we don't need to check for that)
			// * always counts
			if (match.indexOf('*') === -1 && (match.length <= 2 || !/(^|\/)+\:+?/.test(match))) {
				return match.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
			}

			var slashSuff = match[0] === '/' ? '/' : '',
				slashPref = !!expr[match.length + index] || strSlashPref,
				level = slashSuff ? match.substr(1) : match,
				firstChar = level[0],
				lastChar = level.substr(-1);
			
			// Handle captures
			if (firstChar === ':') {
				// Handle optional :capture?
				if (lastChar === '?') {
					// Wrap any preceding slash in the optional capture group
					return (slashSuff ? '(?:/([^/]+?))?' : '([^/]+?)?');
				}

				// Handle mandatory :capture
				return slashSuff + '([^/]+?)';
			}

			// All matches that end with a slash or does not end with * are easy.
			// We'll just choose to capture anything except a frontslash.
			// 
			// /some/stuff*/   =>   /some/stuff([^/]+)?/
			// /some/st*ff/    =>   /some/st([^/]+)?ff/
			if (slashPref || lastChar !== '*') {
				return slashSuff + level.replace(/\*/g, '([^/]+)?');
			}

			// Handle all matches that ends with * and are not followd by frontslash; 'stuff*', '*'.
			// We'll replace all asterisks except the last with catch-alls. The last one is omitted and replaced with
			// a pattern that matches everything up until, but not included, the last frontslash in the string or end-of-string.
			// 
			// /some/stuff* => some/stuff(.*?(?:(?=\/$)|(?=$)))?
			// /some/st*ff* => some/st(.*)?ff(.*?(?:(?=\/$)|(?=$)))?
			// /*           => (.*?(?:(?=\\/$)|(?=$)))?
			return slashSuff + level.replace(/\*(?!$)/g, '(.*)?').slice(0, -1) + '(.*?(?:(?=/$)|(?=$)))?';
		});

		// Create RegExp object from the parsed query
		finalRegexp = new RegExp('^/?' + expr  + '/?$', 'i');

		// Add `execQuery` to it's properties
		finalRegexp.query = execQuery;

		return finalRegexp;
	}
79654
function parse(tokens) {
    var ast = [];

    var current = ast;

    var _line = 0;
    var _char = 0;

    var openCount = 0;
    var closeCount = 0;

    for (var i = 0; i < tokens.length; i++) {
        var token = tokens[i];

        switch (token.type) {
            case TYPES.open:
                // Every time we open a list, we drop into a sub-array
                var child = [];
                child.parent = current;
                current.push(child);
                current = child;
                openCount += 1;
                break;

            case TYPES.open_array:
            case TYPES.quote:
                var child = [];
                var quote = {"'": child };
                child.parent = current;
                current.push(quote);
                current = child;
                openCount += 1;
                break;

            case TYPES.close_array:
            case TYPES.close:
                // If no current, we probably have too many closing parens
                if (!current) _tooManyClosingParensErr(closeCount, openCount);
                // If we close a list, jump back up to the parent list
                current = current.parent;
                closeCount += 1;
                break;

            case TYPES.identifier:
            case TYPES.suffixed_number:
                current.push(token.string);
                break;

            case TYPES.number:
                current.push(Number(token.string));
                break;

            case TYPES.string:
                // We need to strip the quotes off the string entity
                var dequoted = token.string.slice(1).slice(0, token.string.length - 2);
                current.push(dequoted);
                break;

            case TYPES.json:
                try {
                    var deticked = token.string.slice(1).slice(0, token.string.length - 2);
                    current.push(JSON.parse(deticked));
                }
                catch (e) {
                    throw new Error([
                        'Runiq: Couldn\'t parse inlined JSON!',
                        '--- Error occurred at line ' + _line + ', char ' + _char
                    ].join('\n'));
                }
                break;
        }

        // Capture line numbers and columns for future use
        var lines = token.string.split(NEWLINE);
        _line += lines.length - 1;
        if (lines.length > 1) _char = lines[lines.length - 1].length;
        else _char += token.string.length;
    }

    // Raise error if we have a parentheses mismatch
    if (openCount > closeCount) _tooManyOpenParensErr(closeCount, openCount);
    if (openCount < closeCount) _tooManyClosingParensErr(closeCount, openCount);

    // For both safety and to ensure we actually have a JSON-able AST
    return JSON.parse(JSONStableStringify(ast));
}
1319163
function parseLength (parser) {
  const length = parser.buffer.length - 1
  var offset = parser.offset
  var number = 0

  while (offset < length) {
    const c1 = parser.buffer[offset++]
    if (c1 === 13) {
      parser.offset = offset + 1
      return number
    }
    number = (number * 10) + (c1 - 48)
  }
}
145668
private void parseFlags(byte[] flags) throws ID3v2FormatException
	{
		int bytesRead = 1;

		update = (flags[0]&0x80)!=0;
		if (update) bytesRead++;
		
		crced = (flags[0]&0x40)!=0;
		if (crced)
		{
			bytesRead++;
			for (int i = 0; i < crc.length; i++) crc[i] = flags[bytesRead++];
		}
		
		if ((flags[0]&0x80)!=0)
		{
			bytesRead++;
			byte b = flags[bytesRead];
			maxTagSize = (b&0xC0)>>6;
			textEncode = (b&0x20)!=0;
			maxTextSize = (b&0x18)>>3;
			imageEncode = (b&0x04)!=0;
			imageRestrict = (b&0x03);
			bytesRead++;
		}
		if (bytesRead != numFlagBytes)
		{
			throw new ID3v2FormatException("The number of found flag bytes in the extended header is not equal to the number specified in the extended header.");
		}
	}
223348
public final void mRULE_DECIMAL() throws RecognitionException {
        try {
            int _type = RULE_DECIMAL;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // InternalXbase.g:6353:14: ( RULE_INT ( ( 'e' | 'E' ) ( '+' | '-' )? RULE_INT )? ( ( 'b' | 'B' ) ( 'i' | 'I' | 'd' | 'D' ) | ( 'l' | 'L' | 'd' | 'D' | 'f' | 'F' ) )? )
            // InternalXbase.g:6353:16: RULE_INT ( ( 'e' | 'E' ) ( '+' | '-' )? RULE_INT )? ( ( 'b' | 'B' ) ( 'i' | 'I' | 'd' | 'D' ) | ( 'l' | 'L' | 'd' | 'D' | 'f' | 'F' ) )?
            {
            mRULE_INT(); 
            // InternalXbase.g:6353:25: ( ( 'e' | 'E' ) ( '+' | '-' )? RULE_INT )?
            int alt7=2;
            int LA7_0 = input.LA(1);

            if ( (LA7_0=='E'||LA7_0=='e') ) {
                alt7=1;
            }
            switch (alt7) {
                case 1 :
                    // InternalXbase.g:6353:26: ( 'e' | 'E' ) ( '+' | '-' )? RULE_INT
                    {
                    if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
                        input.consume();

                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        recover(mse);
                        throw mse;}

                    // InternalXbase.g:6353:36: ( '+' | '-' )?
                    int alt6=2;
                    int LA6_0 = input.LA(1);

                    if ( (LA6_0=='+'||LA6_0=='-') ) {
                        alt6=1;
                    }
                    switch (alt6) {
                        case 1 :
                            // InternalXbase.g:
                            {
                            if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
                                input.consume();

                            }
                            else {
                                MismatchedSetException mse = new MismatchedSetException(null,input);
                                recover(mse);
                                throw mse;}


                            }
                            break;

                    }

                    mRULE_INT(); 

                    }
                    break;

            }

            // InternalXbase.g:6353:58: ( ( 'b' | 'B' ) ( 'i' | 'I' | 'd' | 'D' ) | ( 'l' | 'L' | 'd' | 'D' | 'f' | 'F' ) )?
            int alt8=3;
            int LA8_0 = input.LA(1);

            if ( (LA8_0=='B'||LA8_0=='b') ) {
                alt8=1;
            }
            else if ( (LA8_0=='D'||LA8_0=='F'||LA8_0=='L'||LA8_0=='d'||LA8_0=='f'||LA8_0=='l') ) {
                alt8=2;
            }
            switch (alt8) {
                case 1 :
                    // InternalXbase.g:6353:59: ( 'b' | 'B' ) ( 'i' | 'I' | 'd' | 'D' )
                    {
                    if ( input.LA(1)=='B'||input.LA(1)=='b' ) {
                        input.consume();

                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        recover(mse);
                        throw mse;}

                    if ( input.LA(1)=='D'||input.LA(1)=='I'||input.LA(1)=='d'||input.LA(1)=='i' ) {
                        input.consume();

                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        recover(mse);
                        throw mse;}


                    }
                    break;
                case 2 :
                    // InternalXbase.g:6353:87: ( 'l' | 'L' | 'd' | 'D' | 'f' | 'F' )
                    {
                    if ( input.LA(1)=='D'||input.LA(1)=='F'||input.LA(1)=='L'||input.LA(1)=='d'||input.LA(1)=='f'||input.LA(1)=='l' ) {
                        input.consume();

                    }
                    else {
                        MismatchedSetException mse = new MismatchedSetException(null,input);
                        recover(mse);
                        throw mse;}


                    }
                    break;

            }


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
473620
private void parseValue(StringBuffer res, HashMap<String, String> predefs, char preDelim,
                            HashMap<String, String> valids) {
        int len = res.length();

        if (preDelim != (char) 0 && res.charAt(0) != preDelim) {
            if (len == 0) {
                throw new ParseErrorException(HBCIUtils.getLocMsg("EXCMSG_ENDOFSTRG", getPath()));
            }

            // log.("error string: "+res.toString(),log._ERR);
            // log.("current: "+getPath()+":"+type+"("+minsize+","+maxsize+")="+value,log._ERR);
            // log.("predelimiter mismatch (required:"+getPreDelim()+" found:"+temp.charAt(0)+")",log._ERR);
            throw new PredelimErrorException(getPath(), Character.toString(preDelim),
                Character.toString(res.charAt(0)));
        }

        this.value = SyntaxDEFactory.createSyntaxDE(getType(), getPath(), res, minsize, maxsize);

        String valueString = value.toString(0);
        String predefined = predefs.get(getPath());
        if (predefined != null) {
            if (!valueString.equals(predefined)) {
                throw new ParseErrorException(HBCIUtils.getLocMsg("EXCMSG_PREDEFERR",
                    new Object[]{getPath(), predefined, value}));
            }
        }

        boolean atLeastOne = false;
        boolean ok = false;
        if (valids != null) {
            String header = getPath() + ".value";
            for (String key : valids.keySet()) {
                if (key.startsWith(header) &&
                    key.indexOf(".", header.length()) == -1) {

                    atLeastOne = true;
                    String validValue = valids.get(key);
                    if (valueString.equals(validValue)) {
                        ok = true;
                        break;
                    }
                }
            }
        }

        if (atLeastOne && !ok) {
            throw new NoValidValueException(getPath(), valueString);
        }
    }
1071528
function parseValueToStringOrNumber ( value ) {
	let resolvedValue, resolvedUnitValue;
	try {
		resolvedUnitValue = parseUnit(value);
		if ( unitTypes.indexOf(resolvedUnitValue.type) !== -1 ) {
			resolvedValue = new types.Number(resolvedUnitValue.value, resolvedUnitValue.unit);
		} else if ( resolvedUnitValue.type === 'percentage' ) {
			resolvedValue = new types.Number(resolvedUnitValue.value, '%');
		} else {
			resolvedValue = new types.String(resolvedUnitValue.value);
		}
	} catch ( e ) {
		resolvedValue = new types.String(value);
	}
	return resolvedValue;
}
822691
protected static final Object parseNumber(Source src) {
		final int from = src.idx;
		boolean dot = false;
		for (; src.idx < src.chars.length; src.idx++) {
			char c = src.chars[src.idx];
			if (c <= 32 || c == ',' || c == '}' || c == ']') {
				break;
			} else if (c == '.') {
				dot = true;
			}
		}

		// Double / BigDecimal
		final int len = src.idx - from;
		final String txt = new String(src.chars, from, len);
		if (dot) {
			if (len > 18) {
				return new BigDecimal(txt);
			}
			return Double.parseDouble(txt);
		}

		// Integer / Long / BigInteger
		int p = 0;
		int max = 19;
		boolean negative;
		if (txt.charAt(0) == '-') {
			p++;
			max++;
			negative = true;
		} else {
			negative = false;
		}

		boolean check;
		if (len < max) {
			max = len;
			check = false;
		} else if (len > max) {
			return new BigInteger(txt, 10);
		} else {
			max = len - 1;
			check = true;
		}

		long value = 0;
		while (p < max) {
			value = (value * 10L) + ('0' - txt.charAt(p++));
		}
		if (check) {
			boolean isBig;
			if (value > -922337203685477580L) {
				isBig = false;
			} else if (value < -922337203685477580L) {
				isBig = true;
			} else {
				if (negative) {
					isBig = (txt.charAt(p) > '8');
				} else {
					isBig = (txt.charAt(p) > '7');
				}
			}
			if (isBig) {
				return new BigInteger(txt, 10);
			}
			value = (value * 10L) + ('0' - txt.charAt(p));
		}
		if (negative) {
			if (value >= Integer.MIN_VALUE) {
				return (int) value;
			}
			return value;
		}
		value = -value;
		if (value <= Integer.MAX_VALUE) {
			return (int) value;
		}
		return value;
	}
239086
function parse (cstr) {
	var m, parts = [], alpha = 1, space

	if (typeof cstr === 'string') {
		//keyword
		if (names[cstr]) {
			parts = names[cstr].slice()
			space = 'rgb'
		}

		//reserved words
		else if (cstr === 'transparent') {
			alpha = 0
			space = 'rgb'
			parts = [0,0,0]
		}

		//hex
		else if (/^#[A-Fa-f0-9]+$/.test(cstr)) {
			var base = cstr.slice(1)
			var size = base.length
			var isShort = size <= 4
			alpha = 1

			if (isShort) {
				parts = [
					parseInt(base[0] + base[0], 16),
					parseInt(base[1] + base[1], 16),
					parseInt(base[2] + base[2], 16)
				]
				if (size === 4) {
					alpha = parseInt(base[3] + base[3], 16) / 255
				}
			}
			else {
				parts = [
					parseInt(base[0] + base[1], 16),
					parseInt(base[2] + base[3], 16),
					parseInt(base[4] + base[5], 16)
				]
				if (size === 8) {
					alpha = parseInt(base[6] + base[7], 16) / 255
				}
			}

			if (!parts[0]) parts[0] = 0
			if (!parts[1]) parts[1] = 0
			if (!parts[2]) parts[2] = 0

			space = 'rgb'
		}

		//color space
		else if (m = /^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(cstr)) {
			var name = m[1]
			var base = name.replace(/a$/, '')
			space = base
			var size = base === 'cmyk' ? 4 : base === 'gray' ? 1 : 3
			parts = m[2].trim()
				.split(/\s*,\s*/)
				.map(function (x, i) {
					//<percentage>
					if (/%$/.test(x)) {
						//alpha
						if (i === size)	return parseFloat(x) / 100
						//rgb
						if (base === 'rgb') return parseFloat(x) * 255 / 100
						return parseFloat(x)
					}
					//hue
					else if (base[i] === 'h') {
						//<deg>
						if (/deg$/.test(x)) {
							return parseFloat(x)
						}
						//<base-hue>
						else if (baseHues[x] !== undefined) {
							return baseHues[x]
						}
					}
					return parseFloat(x)
				})

			if (name === base) parts.push(1)
			alpha = parts[size] === undefined ? 1 : parts[size]
			parts = parts.slice(0, size)
		}

		//named channels case
		else if (cstr.length > 10 && /[0-9](?:\s|\/)/.test(cstr)) {
			parts = cstr.match(/([0-9]+)/g).map(function (value) {
				return parseFloat(value)
			})

			space = cstr.match(/([a-z])/ig).join('').toLowerCase()
		}
	}

	//numeric case
	else if (!isNaN(cstr)) {
		space = 'rgb'
		parts = [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff]
	}

	//object case - detects css cases of rgb and hsl
	else if (isObject(cstr)) {
		var r = defined(cstr.r, cstr.red, cstr.R, null)

		if (r !== null) {
			space = 'rgb'
			parts = [
				r,
				defined(cstr.g, cstr.green, cstr.G),
				defined(cstr.b, cstr.blue, cstr.B)
			]
		}
		else {
			space = 'hsl'
			parts = [
				defined(cstr.h, cstr.hue, cstr.H),
				defined(cstr.s, cstr.saturation, cstr.S),
				defined(cstr.l, cstr.lightness, cstr.L, cstr.b, cstr.brightness)
			]
		}

		alpha = defined(cstr.a, cstr.alpha, cstr.opacity, 1)

		if (cstr.opacity != null) alpha /= 100
	}

	//array
	else if (Array.isArray(cstr) || global.ArrayBuffer && ArrayBuffer.isView && ArrayBuffer.isView(cstr)) {
		parts = [cstr[0], cstr[1], cstr[2]]
		space = 'rgb'
		alpha = cstr.length === 4 ? cstr[3] : 1
	}

	return {
		space: space,
		values: parts,
		alpha: alpha
	}
}
1043238
private void parseCharRef(boolean doFlush) throws SAXException, IOException {
        int value = 0;
        char c;

        if (tryRead('x')) {
            loop1: while (true) {
                c = readCh();
                if (c == ';') {
                    break loop1;
                } else {
                    int n = Character.digit(c, 16);
                    if (n == -1) {
                        fatal("illegal character in character reference", c,
                                null);
                        break loop1;
                    }
                    value *= 16;
                    value += n;
                }
            }
        } else {
            loop2: while (true) {
                c = readCh();
                if (c == ';') {
                    break loop2;
                } else {
                    int n = Character.digit(c, 10);
                    if (n == -1) {
                        fatal("illegal character in character reference", c,
                                null);
                        break loop2;
                    }
                    value *= 10;
                    value += c - '0';
                }
            }
        }

        // check for character refs being legal XML
        if (((value < 0x0020) && !((value == '\n') || (value == '\t') || (value == '\r')))
                || ((value >= 0xD800) && (value <= 0xDFFF))
                || (value == 0xFFFE)
                || (value == 0xFFFF) || (value > 0x0010ffff)) {
            fatal("illegal XML character reference U+"
                    + Integer.toHexString(value));
        } else if ((value >= 0x007F) && (value <= 0x009F)) // 2006-11-13 hsivonen
        {
            handler.warn("Character reference expands to a control character: U+00"
                    + Integer.toHexString(value) + ".");
        }
        if (isPrivateUse(value)) {
            warnAboutPrivateUseChar();
        }

        // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz
        // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz:
        if (value <= 0x0000ffff) {
            // no surrogates needed
            dataBufferAppend((char) value);
        } else if (value <= 0x0010ffff) {
            value -= 0x10000;
            // > 16 bits, surrogate needed
            dataBufferAppend((char) (0xd800 | (value >> 10)));
            dataBufferAppend((char) (0xdc00 | (value & 0x0003ff)));
        } else {
            // too big for surrogate
            fatal("character reference " + value + " is too large for UTF-16",
                    Integer.valueOf(value).toString(), null);
        }
        if (doFlush) {
            dataBufferFlush();
        }
    }
1156636
function(buf, crc) {

      var c = (typeof(crc) == "undefined" ? 0 : crc) ^ 0xffffffff;
      var bArray  = typeof buf !== "string";
      var n;

      if (bArray) {
        for (n = 0; n < buf.length; n++) {
          c = SAP_CRC32_TABLE[(c ^ buf[n]) & 0xff] ^ (c >>> 8);
        }
      } else {
        for (n = 0; n < buf.length; n++) {
          c = SAP_CRC32_TABLE[(c ^ buf.charCodeAt(n)) & 0xff] ^ (c >>> 8);
        }
      }

      return c ^ 0xffffffff;
    }
490103
private <E> Object parse( String s, Class fclz ) {
    if( fclz.equals(String.class) ) return s; // Strings already the right primitive type
    if( fclz.isArray() ) {      // An array?
      read(s,    0       ,'[',fclz);
      read(s,s.length()-1,']',fclz);
      String[] splits = s.substring(1,s.length()-1).split(",");
      Class<E> afclz = (Class<E>)fclz.getComponentType();
      E[] a= (E[])Array.newInstance(afclz,splits.length);
      for( int i=0; i<splits.length; i++ )
        a[i] = (E)parse(splits[i],afclz);
      return a;
    }
    if( fclz.equals(Key.class) ) return Key.make(s);

    throw new RuntimeException("Unimplemented schema fill from "+fclz.getSimpleName());
  }  
  private int read( String s, int x, char c, Class fclz ) {
    if( peek(s,x,c) ) return x+1;
    throw new IllegalArgumentException("Expected '"+c+"' while reading a "+fclz.getSimpleName()+", but found "+s);
  }
  private boolean peek( String s, int x, char c ) { return x < s.length() && s.charAt(x) == c; }
}
1131209
function parse(rbp, initial) {
        var left;
        var o;
        if (nexttoken.id === '(end)') {
            error("Unexpected early end of program.", token);
        }
        advance();
        if (option.adsafe && token.value === 'ADSAFE') {
            if (nexttoken.id !== '.' || !(peek(0).identifier) ||
                    peek(1).id !== '(') {
                warning('ADsafe violation.', token);
            }
        }
        if (initial) {
            anonname = 'anonymous';
            funct['(verb)'] = token.value;
        }
        if (initial && token.fud) {
            left = token.fud();
        } else {
            if (token.nud) {
                o = token.exps;
                left = token.nud();
            } else {
                if (nexttoken.type === '(number)' && token.id === '.') {
                    warning(
"A leading decimal point can be confused with a dot: '.{a}'.",
                            token, nexttoken.value);
                    advance();
                    return token;
                } else {
                    error("Expected an identifier and instead saw '{a}'.",
                            token, token.id);
                }
            }
            while (rbp < nexttoken.lbp) {
                o = nexttoken.exps;
                advance();
                if (token.led) {
                    left = token.led(left);
                } else {
                    error("Expected an operator and instead saw '{a}'.",
                        token, token.id);
                }
            }
            if (initial && !o) {
                warning(
"Expected an assignment or function call and instead saw an expression.",
                        token);
            }
        }
        if (!option.evil && left && left.value === 'eval') {
            warning("eval is evil.", left);
        }
        return left;
    }
433798
public static int consumeCRLF(final Buffer buffer) throws SipParseException {
        try {
            buffer.markReaderIndex();
            final byte cr = buffer.readByte();
            final byte lf = buffer.readByte();
            if (cr == CR && lf == LF) {
                return 2;
            }
        } catch (final IndexOutOfBoundsException e) {
            // fall through
        } catch (final IOException e) {
            throw new SipParseException(buffer.getReaderIndex(), UNABLE_TO_READ_FROM_STREAM, e);
        }
        buffer.resetReaderIndex();
        return 0;
    }
596799
function parseFloatOperand(reader) {
            var s = '';
            var eof = 15;
            var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-'];

            while (true) {
                var b = reader.readUint8();
                var n1 = b >> 4;
                var n2 = b & 15;

                if (n1 === eof) {
                    break;
                }

                s += lookup[n1];

                if (n2 === eof) {
                    break;
                }

                s += lookup[n2];
            }

            return parseFloat(s);
        }
270217
int parse(final IntBuffer buff, final int start) {
        int pos = start;

        byte[] bytes = NumberFacility.getBytes(buff.get(pos));
        type = AceType.parseValue(bytes[0]);
        flags = AceFlag.parseValue(bytes[1]);

        int size = NumberFacility.getInt(bytes[3], bytes[2]);

        pos++;
        rights = AceRights.parseValue(NumberFacility.getReverseInt(buff.get(pos)));

        if (type == AceType.ACCESS_ALLOWED_OBJECT_ACE_TYPE || type == AceType.ACCESS_DENIED_OBJECT_ACE_TYPE) {
            pos++;
            objectFlags = AceObjectFlags.parseValue(NumberFacility.getReverseInt(buff.get(pos)));

            if (objectFlags.getFlags().contains(AceObjectFlags.Flag.ACE_OBJECT_TYPE_PRESENT)) {
                objectType = new byte[16];
                for (int j = 0; j < 4; j++) {
                    pos++;
                    System.arraycopy(NumberFacility.getBytes(buff.get(pos)), 0, objectType, j * 4, 4);
                }
            }

            if (objectFlags.getFlags().contains(AceObjectFlags.Flag.ACE_INHERITED_OBJECT_TYPE_PRESENT)) {
                inheritedObjectType = new byte[16];
                for (int j = 0; j < 4; j++) {
                    pos++;
                    System.arraycopy(NumberFacility.getBytes(buff.get(pos)), 0, inheritedObjectType, j * 4, 4);
                }
            }
        }

        pos++;
        sid = new SID();
        pos = sid.parse(buff, pos);

        int lastPos = start + (size / 4) - 1;
        applicationData = new byte[4 * (lastPos - pos)];

        int index = 0;
        while (pos < lastPos) {
            pos++;
            System.arraycopy(NumberFacility.getBytes(buff.get(pos)), 0, applicationData, index, 4);
            index += 4;
        }

        return pos;
    }