• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中jdk.nashorn.internal.runtime.regexp.joni.ast.Node的典型用法代码示例。如果您正苦于以下问题:Java Node类的具体用法?Java Node怎么用?Java Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Node类属于jdk.nashorn.internal.runtime.regexp.joni.ast包,在下文中一共展示了Node类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: compileLengthStringNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:ArrayCompiler.java


示例2: parseExpTkByte

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
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
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Parser.java


示例3: parseBranch

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
private Node parseBranch(final TokenType term) {
    Node node = parseExp(term);

    if (token.type == TokenType.EOT || token.type == term || token.type == TokenType.ALT) {
        return node;
    }
    final ConsAltNode top = ConsAltNode.newListNode(node, null);
    ConsAltNode t = top;

    while (token.type != TokenType.EOT && token.type != term && token.type != TokenType.ALT) {
        node = parseExp(term);
        if (node.getType() == NodeType.LIST) {
            t.setCdr((ConsAltNode)node);
            while (((ConsAltNode)node).cdr != null ) {
                node = ((ConsAltNode)node).cdr;
            }

            t = ((ConsAltNode)node);
        } else {
            t.setCdr(ConsAltNode.newListNode(node, null));
            t = t.cdr;
        }
    }
    return top;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:Parser.java


示例4: parseSubExp

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
private Node parseSubExp(final TokenType term) {
    Node node = parseBranch(term);

    if (token.type == term) {
        return node;
    } else if (token.type == TokenType.ALT) {
        final ConsAltNode top = ConsAltNode.newAltNode(node, null);
        ConsAltNode t = top;
        while (token.type == TokenType.ALT) {
            fetchToken();
            node = parseBranch(term);

            t.setCdr(ConsAltNode.newAltNode(node, null));
            t = t.cdr;
        }

        if (token.type != term) {
            parseSubExpError(term);
        }
        return top;
    } else {
        parseSubExpError(term);
        return null; //not reached
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:Parser.java


示例5: setupLookBehind

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
private Node setupLookBehind(final Node node) {
    final AnchorNode an = (AnchorNode)node;
    final int len = getCharLengthTree(an.target);
    switch (returnCode) {
    case 0:
        an.charLength = len;
        break;
    case GET_CHAR_LEN_VARLEN:
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    case GET_CHAR_LEN_TOP_ALT_VARLEN:
        if (syntax.differentLengthAltLookBehind()) {
            return divideLookBehindAlternatives(node);
        }
        throw new SyntaxException(ERR_INVALID_LOOK_BEHIND_PATTERN);
    default:
        break;
    }
    return node;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:Analyser.java


示例6: compileTreeEmptyCheck

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
private void compileTreeEmptyCheck(final Node node, final int emptyInfo) {
    final int savedNumNullCheck = regex.numNullCheck;

    if (emptyInfo != 0) {
        addOpcode(OPCode.NULL_CHECK_START);
        addMemNum(regex.numNullCheck); /* NULL CHECK ID */
        regex.numNullCheck++;
    }

    compileTree(node);

    if (emptyInfo != 0) {
        switch (emptyInfo) {
        case TargetInfo.IS_EMPTY:
            addOpcode(OPCode.NULL_CHECK_END);
            break;
        case TargetInfo.IS_EMPTY_MEM:
            addOpcode(OPCode.NULL_CHECK_END_MEMST);
            break;
        default:
            break;
        } // switch

        addMemNum(savedNumNullCheck); /* NULL CHECK ID */
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:ArrayCompiler.java


示例7: addMemEntry

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
public int addMemEntry() {
    if (numMem++ == 0) {
        memNodes = new Node[SCANENV_MEMNODES_SIZE];
    } else if (numMem >= memNodes.length) {
        final Node[]tmp = new Node[memNodes.length << 1];
        System.arraycopy(memNodes, 0, tmp, 0, memNodes.length);
        memNodes = tmp;
    }

    return numMem;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ScanEnvironment.java


示例8: setMemNode

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
public void setMemNode(final int num, final Node node) {
    if (numMem >= num) {
        memNodes[num] = node;
    } else {
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ScanEnvironment.java


示例9: compileTreeEmptyCheck

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
private void compileTreeEmptyCheck(final Node node, final int emptyInfo) {
    final int savedNumNullCheck = regex.numNullCheck;

    if (emptyInfo != 0) {
        addOpcode(OPCode.NULL_CHECK_START);
        addMemNum(regex.numNullCheck); /* NULL CHECK ID */
        regex.numNullCheck++;
    }

    compileTree(node);

    if (emptyInfo != 0) {
        switch (emptyInfo) {
        case TargetInfo.IS_EMPTY:
            addOpcode(OPCode.NULL_CHECK_END);
            break;
        case TargetInfo.IS_EMPTY_MEM:
            addOpcode(OPCode.NULL_CHECK_END_MEMST);
            break;
        case TargetInfo.IS_EMPTY_REC:
            addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH);
            break;
        default:
            break;
        } // switch

        addMemNum(savedNumNullCheck); /* NULL CHECK ID */
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:ArrayCompiler.java


示例10: parseExpTkRawByte

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:Parser.java


示例11: parseExpRepeat

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
private Node parseExpRepeat(final Node targetp, final boolean group) {
    Node target = targetp;
    while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat:
        if (target.isInvalidQuantifier()) {
            throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID);
        }

        final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(),
                                                 token.getRepeatUpper(),
                                                 token.type == TokenType.INTERVAL);

        qtfr.greedy = token.getRepeatGreedy();
        final int ret = qtfr.setQuantifier(target, group, env, chars, getBegin(), getEnd());
        Node qn = qtfr;

        if (token.getRepeatPossessive()) {
            final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
            en.setTarget(qn);
            qn = en;
        }

        if (ret == 0) {
            target = qn;
        } else if (ret == 2) { /* split case: /abc+/ */
            target = ConsAltNode.newListNode(target, null);
            final ConsAltNode tmp = ((ConsAltNode)target).setCdr(ConsAltNode.newListNode(qn, null));

            fetchToken();
            return parseExpRepeatForCar(target, tmp, group);
        }
        fetchToken(); // goto re_entry
    }
    return target;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:Parser.java


示例12: parseExpRepeatForCar

import jdk.nashorn.internal.runtime.regexp.joni.ast.Node; //导入依赖的package包/类
private Node parseExpRepeatForCar(final Node top, final ConsAltNode target, final boolean group) {
    while (token.type == TokenType.OP_REPEAT || token.type == TokenType.INTERVAL) { // repeat:
        if (target.car.isInvalidQuantifier()) {
            throw new SyntaxException(ERR_TARGET_OF_REPEAT_OPERATOR_INVALID);
        }

        final QuantifierNode qtfr = new QuantifierNode(token.getRepeatLower(),
                                                 token.getRepeatUpper(),
                                                 token.type == TokenType.INTERVAL);

        qtfr.greedy = token.getRepeatGreedy();
        final int ret = qtfr.setQuantifier(target.car, group, env, chars, getBegin(), getEnd());
        Node qn = qtfr;

        if (token.getRepeatPossessive()) {
            final EncloseNode en = new EncloseNode(EncloseType.STOP_BACKTRACK); // node_new_enclose
            en.setTarget(qn);
            qn = en;
        }

        if (ret == 0) {
            target.setCar(qn);
        } else if (ret == 2) { /* split case: /abc+/ */
            assert false;
        }
        fetchToken(); // goto re_entry
    }
    return top;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:Parser.java



注:本文中的jdk.nashorn.internal.runtime.regexp.joni.ast.Node类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WrappedRunnable类代码示例发布时间:2022-05-22
下一篇:
Java Element类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap