Java Code Examples for jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode. These examples are extracted from open source projects. 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 Project: TencentKona-8   Source File: ArrayCompiler.java    License: GNU General Public License v2.0 6 votes vote down vote up
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 Project: TencentKona-8   Source File: Compiler.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void compileStringNode(final StringNode node) {
    final StringNode sn = node;
    if (sn.length() <= 0) {
        return;
    }

    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;

    while (p < end) {
        slen++;
        p++;
    }
    addCompileString(chars, prev, slen, ambig);
}
 
Example 3
Source Project: TencentKona-8   Source File: Parser.java    License: GNU General Public License v2.0 6 votes vote down vote up
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars, token.backP, p); // tk_byte:
    while (true) {
        fetchToken();
        if (token.type != TokenType.STRING) {
            break;
        }

        if (token.backP == node.end) {
            node.end = p; // non escaped character, remain shared, just increase shared range
        } else {
            node.cat(chars, token.backP, p); // non continuous string stream, need to COW
        }
    }
    // targetp = node;
    return parseExpRepeat(node, group); // string_end:, goto repeat
}
 
Example 4
Source Project: jdk8u60   Source File: Compiler.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void compileStringNode(final StringNode node) {
    final StringNode sn = node;
    if (sn.length() <= 0) {
        return;
    }

    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;

    while (p < end) {
        slen++;
        p++;
    }
    addCompileString(chars, prev, slen, ambig);
}
 
Example 5
Source Project: jdk8u_nashorn   Source File: Parser.java    License: GNU General Public License v2.0 6 votes vote down vote up
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars, token.backP, p); // tk_byte:
    while (true) {
        fetchToken();
        if (token.type != TokenType.STRING) {
            break;
        }

        if (token.backP == node.end) {
            node.end = p; // non escaped character, remain shared, just increase shared range
        } else {
            node.cat(chars, token.backP, p); // non continuous string stream, need to COW
        }
    }
    // targetp = node;
    return parseExpRepeat(node, group); // string_end:, goto repeat
}
 
Example 6
Source Project: openjdk-jdk8u   Source File: ArrayCompiler.java    License: GNU General Public License v2.0 6 votes vote down vote up
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 7
Source Project: openjdk-jdk8u   Source File: Compiler.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void compileStringNode(final StringNode node) {
    final StringNode sn = node;
    if (sn.length() <= 0) {
        return;
    }

    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;

    while (p < end) {
        slen++;
        p++;
    }
    addCompileString(chars, prev, slen, ambig);
}
 
Example 8
Source Project: openjdk-jdk8u   Source File: Parser.java    License: GNU General Public License v2.0 6 votes vote down vote up
private Node parseExpTkByte(final boolean group) {
    final StringNode node = new StringNode(chars, token.backP, p); // tk_byte:
    while (true) {
        fetchToken();
        if (token.type != TokenType.STRING) {
            break;
        }

        if (token.backP == node.end) {
            node.end = p; // non escaped character, remain shared, just increase shared range
        } else {
            node.cat(chars, token.backP, p); // non continuous string stream, need to COW
        }
    }
    // targetp = node;
    return parseExpRepeat(node, group); // string_end:, goto repeat
}
 
Example 9
Source Project: openjdk-jdk9   Source File: ArrayCompiler.java    License: GNU General Public License v2.0 6 votes vote down vote up
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 10
Source Project: hottub   Source File: ArrayCompiler.java    License: GNU General Public License v2.0 6 votes vote down vote up
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 11
Source Project: hottub   Source File: Compiler.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void compileStringNode(final StringNode node) {
    final StringNode sn = node;
    if (sn.length() <= 0) {
        return;
    }

    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;

    while (p < end) {
        slen++;
        p++;
    }
    addCompileString(chars, prev, slen, ambig);
}
 
Example 12
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 13
Source Project: openjdk-8-source   Source File: Parser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node parseExpTkByte(boolean group) {
    StringNode node = new StringNode(chars, token.backP, p); // tk_byte:
    while (true) {
        fetchToken();
        if (token.type != TokenType.STRING) break;

        if (token.backP == node.end) {
            node.end = p; // non escaped character, remain shared, just increase shared range
        } else {
            node.cat(chars, token.backP, p); // non continuous string stream, need to COW
        }
    }
    // targetp = node;
    return parseExpRepeat(node, group); // string_end:, goto repeat
}
 
Example 14
Source Project: TencentKona-8   Source File: Parser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node parseExpTkRawByte(final boolean group) {
    // tk_raw_byte:

    // important: we don't use 0xff mask here neither in the compiler
    // (in the template string) so we won't have to mask target
    // strings when comparing against them in the matcher
    final StringNode node = new StringNode((char)token.getC());
    node.setRaw();

    fetchToken();
    node.clearRaw();
    // !goto string_end;!
    return parseExpRepeat(node, group);
}
 
Example 15
Source Project: TencentKona-8   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 16
Source Project: TencentKona-8   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node expandCaseFoldMakeRemString(final char[] ch, final int pp, final int end) {
    final StringNode node = new StringNode(ch, pp, end);

    updateStringNodeCaseFold(node);
    node.setAmbig();
    node.setDontGetOptInfo();
    return node;
}
 
Example 17
Source Project: jdk8u_nashorn   Source File: Parser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node parseExpTkRawByte(final boolean group) {
    // tk_raw_byte:

    // important: we don't use 0xff mask here neither in the compiler
    // (in the template string) so we won't have to mask target
    // strings when comparing against them in the matcher
    final StringNode node = new StringNode((char)token.getC());
    node.setRaw();

    fetchToken();
    node.clearRaw();
    // !goto string_end;!
    return parseExpRepeat(node, group);
}
 
Example 18
Source Project: nashorn   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node expandCaseFoldMakeRemString(char[] chars, int p, int end) {
    StringNode node = new StringNode(chars, p, end);

    updateStringNodeCaseFold(node);
    node.setAmbig();
    node.setDontGetOptInfo();
    return node;
}
 
Example 19
Source Project: openjdk-8   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 20
Source Project: jdk8u60   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 21
Source Project: jdk8u_nashorn   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node expandCaseFoldMakeRemString(final char[] ch, final int pp, final int end) {
    final StringNode node = new StringNode(ch, pp, end);

    updateStringNodeCaseFold(node);
    node.setAmbig();
    node.setDontGetOptInfo();
    return node;
}
 
Example 22
Source Project: openjdk-8-source   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node expandCaseFoldMakeRemString(char[] chars, int p, int end) {
    StringNode node = new StringNode(chars, p, end);

    updateStringNodeCaseFold(node);
    node.setAmbig();
    node.setDontGetOptInfo();
    return node;
}
 
Example 23
Source Project: openjdk-jdk8u   Source File: Parser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node parseExpTkRawByte(final boolean group) {
    // tk_raw_byte:

    // important: we don't use 0xff mask here neither in the compiler
    // (in the template string) so we won't have to mask target
    // strings when comparing against them in the matcher
    final StringNode node = new StringNode((char)token.getC());
    node.setRaw();

    fetchToken();
    node.clearRaw();
    // !goto string_end;!
    return parseExpRepeat(node, group);
}
 
Example 24
Source Project: nashorn   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 25
Source Project: openjdk-jdk8u-backup   Source File: Parser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node parseExpTkRawByte(final boolean group) {
    // tk_raw_byte:

    // important: we don't use 0xff mask here neither in the compiler
    // (in the template string) so we won't have to mask target
    // strings when comparing against them in the matcher
    final StringNode node = new StringNode((char)token.getC());
    node.setRaw();

    fetchToken();
    node.clearRaw();
    // !goto string_end;!
    return parseExpRepeat(node, group);
}
 
Example 26
Source Project: openjdk-8   Source File: Parser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node parseExpTkByte(boolean group) {
    StringNode node = new StringNode(chars, token.backP, p); // tk_byte:
    while (true) {
        fetchToken();
        if (token.type != TokenType.STRING) break;

        if (token.backP == node.end) {
            node.end = p; // non escaped character, remain shared, just increase shared range
        } else {
            node.cat(chars, token.backP, p); // non continuous string stream, need to COW
        }
    }
    // targetp = node;
    return parseExpRepeat(node, group); // string_end:, goto repeat
}
 
Example 27
Source Project: jdk8u_nashorn   Source File: Analyser.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 28
private Node expandCaseFoldMakeRemString(final char[] ch, final int pp, final int end) {
    final StringNode node = new StringNode(ch, pp, end);

    updateStringNodeCaseFold(node);
    node.setAmbig();
    node.setDontGetOptInfo();
    return node;
}
 
Example 29
Source Project: openjdk-8-source   Source File: Parser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node parseExpTkRawByte(boolean group) {
    // tk_raw_byte:

    // important: we don't use 0xff mask here neither in the compiler
    // (in the template string) so we won't have to mask target
    // strings when comparing against them in the matcher
    StringNode node = new StringNode((char)token.getC());
    node.setRaw();

    fetchToken();
    node.clearRaw();
    // !goto string_end;!
    return parseExpRepeat(node, group);
}
 
Example 30
Source Project: openjdk-jdk9   Source File: Parser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Node parseExpTkRawByte(final boolean group) {
    // tk_raw_byte:

    // important: we don't use 0xff mask here neither in the compiler
    // (in the template string) so we won't have to mask target
    // strings when comparing against them in the matcher
    final StringNode node = new StringNode((char)token.getC());
    node.setRaw();

    fetchToken();
    node.clearRaw();
    // !goto string_end;!
    return parseExpRepeat(node, group);
}