private Node parseQuoteOpen() { int[]endOp = new int[]{syntax.metaCharTable.esc, 'E'}; int qstart = p; Ptr nextChar = new Ptr(); int qend = findStrPosition(endOp, endOp.length, qstart, stop, nextChar); if (qend == -1) nextChar.p = qend = stop; Node node = new StringNode(bytes, qstart, qend); p = nextChar.p; return node; }
private Node parseQuoteOpen() { int[]endOp = new int[]{syntax.metaCharTable.esc, 'E'}; int qstart = p; Ptr nextChar = new Ptr(); int qend = findStrPosition(endOp, endOp.length, qstart, stop, nextChar); if (qend == -1) nextChar.p = qend = stop; Node node = new StringNode(bytes, qstart, qend); p = nextChar.p; return node; }
/** * A version of transcodeLoop for working without any Ruby runtime available. * * MRI: transcode_loop with no fallback and java.lang.String input */ public static ByteList transcodeString(String string, Encoding toEncoding, int ecflags) { Encoding encoding; encoding = getUTF16ForPlatform(); EConv ec = TranscoderDB.open(encoding.getName(), toEncoding.getName(), ecflags); byte[] inBytes = string.getBytes(EncodingUtils.charsetForEncoding(encoding)); Ptr inPos = new Ptr(0); int inStop = inBytes.length; // most encodings will be shorter than UTF-16 for typical input int outStop = (int)((double) inBytes.length / 1.5 + 1); byte[] outBytes = new byte[outStop]; Ptr outPos = new Ptr(0); ByteList destination = new ByteList(outBytes, toEncoding, false); boolean success = transcodeLoop(ec, null, null, null, inBytes, inPos, outBytes, outPos, inStop, outStop, destination, strTranscodingResize); if (!success) { // TODO: anything? } return destination; }
/** * A version of transcodeLoop for working without any Ruby runtime available. * * MRI: transcode_loop with no fallback and java.lang.String input */ public static ByteList transcodeString(String string, Encoding toEncoding, int ecflags) { Encoding encoding; encoding = getUTF16ForPlatform(); EConv ec = TranscoderDB.open(encoding.getName(), toEncoding.getName(), ecflags); byte[] inBytes = string.getBytes(EncodingUtils.charsetForEncoding(encoding)); Ptr inPos = new Ptr(0); int inStop = inBytes.length; // most encodings will be shorter than UTF-16 for typical input int outStop = (int)((double) inBytes.length / 1.5 + 1); byte[] outBytes = new byte[outStop]; Ptr outPos = new Ptr(0); ByteList destination = new ByteList(outBytes, toEncoding, false); boolean success = transcodeLoop(ec, null, null, null, inBytes, inPos, outBytes, outPos, inStop, outStop, destination, strTranscodingResize); if (!success) { // TODO: anything? } return destination; }
protected final Node disableNoNameGroupCapture(Node root) { int[]map = new int[env.numMem + 1]; root = noNameDisableMap(root, map, new Ptr(0)); renumberByMap(root, map); for (int i=1, pos=1; i<=env.numMem; i++) { if (map[i] > 0) { env.memNodes[pos] = env.memNodes[i]; pos++; } } int loc = env.captureHistory; env.captureHistory = bsClear(); for (int i=1; i<=Config.MAX_CAPTURE_HISTORY_GROUP; i++) { if (bsAt(loc, i)) { env.captureHistory = bsOnAtSimple(env.captureHistory, map[i]); } } env.numMem = env.numNamed; regex.numMem = env.numNamed; regex.renumberNameTable(map); return root; }
protected final Node disableNoNameGroupCapture(Node root) { int[]map = new int[env.numMem + 1]; root = noNameDisableMap(root, map, new Ptr(0)); renumberByMap(root, map); for (int i=1, pos=1; i<=env.numMem; i++) { if (map[i] > 0) { env.memNodes[pos] = env.memNodes[i]; pos++; } } int loc = env.captureHistory; env.captureHistory = bsClear(); for (int i=1; i<=Config.MAX_CAPTURE_HISTORY_GROUP; i++) { if (bsAt(loc, i)) { env.captureHistory = bsOnAtSimple(env.captureHistory, map[i]); } } env.numMem = env.numNamed; regex.numMem = env.numNamed; regex.renumberNameTable(map); return root; }
Ruby runtime = context.runtime; EConv ec; Ptr outStop = new Ptr(_outStop); IRubyObject fallback = context.nil; TranscodeFallback fallbackFunc = null;
Ruby runtime = context.runtime; EConv ec; Ptr outStop = new Ptr(_outStop); IRubyObject fallback = context.nil; TranscodeFallback fallbackFunc = null;