本文整理汇总了Java中jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType类的典型用法代码示例。如果您正苦于以下问题:Java TokenType类的具体用法?Java TokenType怎么用?Java TokenType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TokenType类属于jdk.nashorn.internal.runtime.regexp.joni.constants包,在下文中一共展示了TokenType类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseExpTkByte
import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType; //导入依赖的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
示例2: parseBranch
import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType; //导入依赖的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
示例3: parseSubExp
import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType; //导入依赖的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
示例4: fetchTokenInCCFor_u
import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType; //导入依赖的package包/类
private void fetchTokenInCCFor_u() {
if (!left()) {
return;
}
final int last = p;
if (syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but, it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:Lexer.java
示例5: fetchTokenFor_uHex
import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType; //导入依赖的package包/类
private void fetchTokenFor_uHex() {
if (!left()) {
return;
}
final int last = p;
if (syntax.op2EscUHex4()) {
int num = scanUnsignedHexadecimalNumber(4);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but, it's not error */
}
token.type = TokenType.CODE_POINT;
token.setCode(num);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:Lexer.java
示例6: fetchTokenFor_digit
import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType; //导入依赖的package包/类
private void fetchTokenFor_digit() {
unfetch();
final int last = p;
final int num = scanUnsignedNumber();
if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
} else if (syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
if (syntax.strictCheckBackref()) {
if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
throw new ValueException(ERR_INVALID_BACKREF);
}
}
token.type = TokenType.BACKREF;
token.setBackrefRef(num);
return;
}
if (c == '8' || c == '9') { /* normal char */ // skip_backref:
p = last;
inc();
return;
}
p = last;
fetchTokenFor_zero(); /* fall through */
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:Lexer.java
示例7: fetchTokenFor_zero
import jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType; //导入依赖的package包/类
private void fetchTokenFor_zero() {
if (syntax.opEscOctal3()) {
final int last = p;
int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
if (num < 0) {
throw new ValueException(ERR_TOO_BIG_NUMBER);
}
if (p == last) { /* can't read nothing. */
num = 0; /* but, it's not error */
}
token.type = TokenType.RAW_BYTE;
token.setC(num);
} else if (c != '0') {
inc();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:Lexer.java
注:本文中的jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论