当前位置: 首页>>代码示例>>Java>>正文


Java TokenRewriteStream.delete方法代码示例

本文整理汇总了Java中org.antlr.runtime.TokenRewriteStream.delete方法的典型用法代码示例。如果您正苦于以下问题:Java TokenRewriteStream.delete方法的具体用法?Java TokenRewriteStream.delete怎么用?Java TokenRewriteStream.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.antlr.runtime.TokenRewriteStream的用法示例。


在下文中一共展示了TokenRewriteStream.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testReplaceThenDeleteMiddleIndex

import org.antlr.runtime.TokenRewriteStream; //导入方法依赖的package包/类
public void testReplaceThenDeleteMiddleIndex() throws Exception {
	Grammar g = new Grammar(
		"lexer grammar t;\n"+
		"A : 'a';\n" +
		"B : 'b';\n" +
		"C : 'c';\n");
	CharStream input = new ANTLRStringStream("abc");
	Interpreter lexEngine = new Interpreter(g, input);
	TokenRewriteStream tokens = new TokenRewriteStream(lexEngine);
	tokens.LT(1); // fill buffer
	tokens.replace(1, "x");
	tokens.delete(1);
	String result = tokens.toString();
	String expecting = "ac";
	assertEquals(result, expecting);
}
 
开发者ID:Sable,项目名称:mclab-core,代码行数:17,代码来源:TestTokenRewriteStream.java

示例2: testReplaceThenDeleteMiddleIndex

import org.antlr.runtime.TokenRewriteStream; //导入方法依赖的package包/类
public void testReplaceThenDeleteMiddleIndex() throws Exception {
	Grammar g = new Grammar(
		"lexer grammar t;\n"+
		"A : 'a';\n" +
		"B : 'b';\n" +
		"C : 'c';\n");
	CharStream input = new ANTLRStringStream("abc");
	Interpreter lexEngine = new Interpreter(g, input);
	TokenRewriteStream tokens = new TokenRewriteStream(lexEngine);
	tokens.LT(1); // fill buffer
	tokens.replace(1, "x");
	tokens.delete(1);
	String result = tokens.toString();
	String expecting = "ac";
	assertEquals(expecting, result);
}
 
开发者ID:pcingola,项目名称:jFuzzyLogic,代码行数:17,代码来源:TestTokenRewriteStream.java

示例3: testCombineInsertOnLeftWithDelete

import org.antlr.runtime.TokenRewriteStream; //导入方法依赖的package包/类
public void testCombineInsertOnLeftWithDelete() throws Exception {
	Grammar g = new Grammar(
		"lexer grammar t;\n"+
		"A : 'a';\n" +
		"B : 'b';\n" +
		"C : 'c';\n");
	CharStream input = new ANTLRStringStream("abc");
	Interpreter lexEngine = new Interpreter(g, input);
	TokenRewriteStream tokens = new TokenRewriteStream(lexEngine);
	tokens.LT(1); // fill buffer
	tokens.delete(0, 2);
	tokens.insertBefore(0, "z"); // combine with left edge of rewrite
	String result = tokens.toString();
	String expecting = "z"; // make sure combo is not znull
	assertEquals(expecting, result);
}
 
开发者ID:pcingola,项目名称:jFuzzyLogic,代码行数:17,代码来源:TestTokenRewriteStream.java


注:本文中的org.antlr.runtime.TokenRewriteStream.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。