Java Code Examples for jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode#length()
The following examples show how to use
jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode#length() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrayCompiler.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
private static int compileLengthStringNode(final Node node) { final StringNode sn = (StringNode)node; if (sn.length() <= 0) { return 0; } final boolean ambig = sn.isAmbig(); int p, prev; p = prev = sn.p; final int end = sn.end; final char[] chars = sn.chars; p++; int slen = 1; int rlen = 0; while (p < end) { slen++; p++; } final int r = addCompileStringlength(chars, prev, slen, ambig); rlen += r; return rlen; }
Example 2
Source File: ArrayCompiler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static int compileLengthStringNode(final Node node) { final StringNode sn = (StringNode)node; if (sn.length() <= 0) { return 0; } final boolean ambig = sn.isAmbig(); int p, prev; p = prev = sn.p; final int end = sn.end; final char[] chars = sn.chars; p++; int slen = 1; int rlen = 0; while (p < end) { slen++; p++; } final int r = addCompileStringlength(chars, prev, slen, ambig); rlen += r; return rlen; }
Example 3
Source File: ArrayCompiler.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private int compileLengthStringNode(Node node) { StringNode sn = (StringNode)node; if (sn.length() <= 0) return 0; boolean ambig = sn.isAmbig(); int p, prev; p = prev = sn.p; int end = sn.end; char[] chars = sn.chars; p++; int slen = 1; int rlen = 0; while (p < end) { slen++; p++; } int r = addCompileStringlength(chars, prev, slen, ambig); rlen += r; return rlen; }
Example 4
Source File: ArrayCompiler.java From nashorn with GNU General Public License v2.0 | 6 votes |
private int compileLengthStringNode(Node node) { StringNode sn = (StringNode)node; if (sn.length() <= 0) return 0; boolean ambig = sn.isAmbig(); int p, prev; p = prev = sn.p; int end = sn.end; char[] chars = sn.chars; p++; int slen = 1; int rlen = 0; while (p < end) { slen++; p++; } int r = addCompileStringlength(chars, prev, slen, ambig); rlen += r; return rlen; }
Example 5
Source File: Compiler.java From nashorn with GNU General Public License v2.0 | 6 votes |
private void compileStringNode(StringNode node) { StringNode sn = node; if (sn.length() <= 0) return; boolean ambig = sn.isAmbig(); int p, prev; p = prev = sn.p; int end = sn.end; char[] chars = sn.chars; p++; int slen = 1; while (p < end) { slen++; p++; } addCompileString(chars, prev, slen, ambig); }
Example 6
Source File: Analyser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void updateStringNodeCaseFoldMultiByte(StringNode sn) { char[] chars = sn.chars; int end = sn.end; value = sn.p; int sp = 0; char buf; while (value < end) { int ovalue = value; buf = Character.toLowerCase(chars[value++]); if (chars[ovalue] != buf) { char[] sbuf = new char[sn.length() << 1]; System.arraycopy(chars, sn.p, sbuf, 0, ovalue - sn.p); value = ovalue; while (value < end) { buf = Character.toLowerCase(chars[value++]); if (sp >= sbuf.length) { char[]tmp = new char[sbuf.length << 1]; System.arraycopy(sbuf, 0, tmp, 0, sbuf.length); sbuf = tmp; } sbuf[sp++] = buf; } sn.set(sbuf, 0, sp); return; } sp++; } }
Example 7
Source File: Analyser.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void updateStringNodeCaseFoldMultiByte(final StringNode sn) { final char[] ch = sn.chars; final int end = sn.end; value = sn.p; int sp = 0; char buf; while (value < end) { final int ovalue = value; buf = EncodingHelper.toLowerCase(ch[value++]); if (ch[ovalue] != buf) { char[] sbuf = new char[sn.length() << 1]; System.arraycopy(ch, sn.p, sbuf, 0, ovalue - sn.p); value = ovalue; while (value < end) { buf = EncodingHelper.toLowerCase(ch[value++]); if (sp >= sbuf.length) { final char[]tmp = new char[sbuf.length << 1]; System.arraycopy(sbuf, 0, tmp, 0, sbuf.length); sbuf = tmp; } sbuf[sp++] = buf; } sn.set(sbuf, 0, sp); return; } sp++; } }
Example 8
Source File: Analyser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void updateStringNodeCaseFoldMultiByte(final StringNode sn) { final char[] ch = sn.chars; final int end = sn.end; value = sn.p; int sp = 0; char buf; while (value < end) { final int ovalue = value; buf = EncodingHelper.toLowerCase(ch[value++]); if (ch[ovalue] != buf) { char[] sbuf = new char[sn.length() << 1]; System.arraycopy(ch, sn.p, sbuf, 0, ovalue - sn.p); value = ovalue; while (value < end) { buf = EncodingHelper.toLowerCase(ch[value++]); if (sp >= sbuf.length) { final char[]tmp = new char[sbuf.length << 1]; System.arraycopy(sbuf, 0, tmp, 0, sbuf.length); sbuf = tmp; } sbuf[sp++] = buf; } sn.set(sbuf, 0, sp); return; } sp++; } }
Example 9
Source File: Analyser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void updateStringNodeCaseFoldMultiByte(final StringNode sn) { final char[] ch = sn.chars; final int end = sn.end; value = sn.p; int sp = 0; char buf; while (value < end) { final int ovalue = value; buf = EncodingHelper.toLowerCase(ch[value++]); if (ch[ovalue] != buf) { char[] sbuf = new char[sn.length() << 1]; System.arraycopy(ch, sn.p, sbuf, 0, ovalue - sn.p); value = ovalue; while (value < end) { buf = EncodingHelper.toLowerCase(ch[value++]); if (sp >= sbuf.length) { final char[]tmp = new char[sbuf.length << 1]; System.arraycopy(sbuf, 0, tmp, 0, sbuf.length); sbuf = tmp; } sbuf[sp++] = buf; } sn.set(sbuf, 0, sp); return; } sp++; } }
Example 10
Source File: Analyser.java From nashorn with GNU General Public License v2.0 | 5 votes |
private void updateStringNodeCaseFoldMultiByte(StringNode sn) { char[] chars = sn.chars; int end = sn.end; value = sn.p; int sp = 0; char buf; while (value < end) { int ovalue = value; buf = Character.toLowerCase(chars[value++]); if (chars[ovalue] != buf) { char[] sbuf = new char[sn.length() << 1]; System.arraycopy(chars, sn.p, sbuf, 0, ovalue - sn.p); value = ovalue; while (value < end) { buf = Character.toLowerCase(chars[value++]); if (sp >= sbuf.length) { char[]tmp = new char[sbuf.length << 1]; System.arraycopy(sbuf, 0, tmp, 0, sbuf.length); sbuf = tmp; } sbuf[sp++] = buf; } sn.set(sbuf, 0, sp); return; } sp++; } }
Example 11
Source File: Compiler.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private void compileStringRawNode(final StringNode sn) { if (sn.length() <= 0) { return; } addCompileString(sn.chars, sn.p, sn.length(), false); }
Example 12
Source File: Compiler.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private void compileStringRawNode(StringNode sn) { if (sn.length() <= 0) return; addCompileString(sn.chars, sn.p, sn.length(), false); }
Example 13
Source File: ArrayCompiler.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private static int compileLengthStringRawNode(final StringNode sn) { if (sn.length() <= 0) { return 0; } return addCompileStringlength(sn.chars, sn.p, sn.length(), false); }
Example 14
Source File: ArrayCompiler.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static int compileLengthStringRawNode(final StringNode sn) { if (sn.length() <= 0) { return 0; } return addCompileStringlength(sn.chars, sn.p, sn.length(), false); }
Example 15
Source File: Analyser.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private Node expandCaseFoldString(final Node node) { final StringNode sn = (StringNode)node; if (sn.isAmbig() || sn.length() <= 0) { return node; } final char[] chars1 = sn.chars; int pt = sn.p; final int end = sn.end; int altNum = 1; ConsAltNode topRoot = null, r = null; @SuppressWarnings("unused") final ObjPtr<Node> prevNode = new ObjPtr<Node>(); StringNode stringNode = null; while (pt < end) { final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars1[pt]); if (items.length == 0) { if (stringNode == null) { if (r == null && prevNode.p != null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } prevNode.p = stringNode = new StringNode(); // onig_node_new_str(NULL, NULL); if (r != null) { ConsAltNode.listAdd(r, stringNode); } } stringNode.cat(chars1, pt, pt + 1); } else { altNum *= (items.length + 1); if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) { break; } if (r == null && prevNode.p != null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } expandCaseFoldStringAlt(items.length, items, chars1, pt, 1, end, prevNode); if (r != null) { ConsAltNode.listAdd(r, prevNode.p); } stringNode = null; } pt++; } if (pt < end) { final Node srem = expandCaseFoldMakeRemString(chars1, pt, end); if (prevNode.p != null && r == null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } if (r == null) { prevNode.p = srem; } else { ConsAltNode.listAdd(r, srem); } } /* ending */ final Node xnode = topRoot != null ? topRoot : prevNode.p; swap(node, xnode); return xnode; }
Example 16
Source File: Compiler.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void compileStringRawNode(final StringNode sn) { if (sn.length() <= 0) { return; } addCompileString(sn.chars, sn.p, sn.length(), false); }
Example 17
Source File: Analyser.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private Node expandCaseFoldString(final Node node) { final StringNode sn = (StringNode)node; if (sn.isAmbig() || sn.length() <= 0) { return node; } final char[] chars1 = sn.chars; int pt = sn.p; final int end = sn.end; int altNum = 1; ConsAltNode topRoot = null, r = null; @SuppressWarnings("unused") final ObjPtr<Node> prevNode = new ObjPtr<Node>(); StringNode stringNode = null; while (pt < end) { final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars1[pt]); if (items.length == 0) { if (stringNode == null) { if (r == null && prevNode.p != null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } prevNode.p = stringNode = new StringNode(); // onig_node_new_str(NULL, NULL); if (r != null) { ConsAltNode.listAdd(r, stringNode); } } stringNode.cat(chars1, pt, pt + 1); } else { altNum *= (items.length + 1); if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) { break; } if (r == null && prevNode.p != null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } expandCaseFoldStringAlt(items.length, items, chars1, pt, 1, end, prevNode); if (r != null) { ConsAltNode.listAdd(r, prevNode.p); } stringNode = null; } pt++; } if (pt < end) { final Node srem = expandCaseFoldMakeRemString(chars1, pt, end); if (prevNode.p != null && r == null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } if (r == null) { prevNode.p = srem; } else { ConsAltNode.listAdd(r, srem); } } /* ending */ final Node xnode = topRoot != null ? topRoot : prevNode.p; swap(node, xnode); return xnode; }
Example 18
Source File: Compiler.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
private void compileStringRawNode(final StringNode sn) { if (sn.length() <= 0) { return; } addCompileString(sn.chars, sn.p, sn.length(), false); }
Example 19
Source File: Compiler.java From nashorn with GNU General Public License v2.0 | 4 votes |
private void compileStringRawNode(StringNode sn) { if (sn.length() <= 0) return; addCompileString(sn.chars, sn.p, sn.length(), false); }
Example 20
Source File: Analyser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private Node expandCaseFoldString(final Node node) { final StringNode sn = (StringNode)node; if (sn.isAmbig() || sn.length() <= 0) { return node; } final char[] chars1 = sn.chars; int pt = sn.p; final int end = sn.end; int altNum = 1; ConsAltNode topRoot = null, r = null; @SuppressWarnings("unused") final ObjPtr<Node> prevNode = new ObjPtr<Node>(); StringNode stringNode = null; while (pt < end) { final char[] items = EncodingHelper.caseFoldCodesByString(regex.caseFoldFlag, chars1[pt]); if (items.length == 0) { if (stringNode == null) { if (r == null && prevNode.p != null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } prevNode.p = stringNode = new StringNode(); // onig_node_new_str(NULL, NULL); if (r != null) { ConsAltNode.listAdd(r, stringNode); } } stringNode.cat(chars1, pt, pt + 1); } else { altNum *= (items.length + 1); if (altNum > THRESHOLD_CASE_FOLD_ALT_FOR_EXPANSION) { break; } if (r == null && prevNode.p != null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } expandCaseFoldStringAlt(items.length, items, chars1, pt, 1, end, prevNode); if (r != null) { ConsAltNode.listAdd(r, prevNode.p); } stringNode = null; } pt++; } if (pt < end) { final Node srem = expandCaseFoldMakeRemString(chars1, pt, end); if (prevNode.p != null && r == null) { topRoot = r = ConsAltNode.listAdd(null, prevNode.p); } if (r == null) { prevNode.p = srem; } else { ConsAltNode.listAdd(r, srem); } } /* ending */ final Node xnode = topRoot != null ? topRoot : prevNode.p; swap(node, xnode); return xnode; }