當前位置: 首頁>>代碼示例>>Java>>正文


Java CommonToken.setChannel方法代碼示例

本文整理匯總了Java中org.antlr.runtime.CommonToken.setChannel方法的典型用法代碼示例。如果您正苦於以下問題:Java CommonToken.setChannel方法的具體用法?Java CommonToken.setChannel怎麽用?Java CommonToken.setChannel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.antlr.runtime.CommonToken的用法示例。


在下文中一共展示了CommonToken.setChannel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createToken

import org.antlr.runtime.CommonToken; //導入方法依賴的package包/類
/**
 * Create a new token from the given prototype. Any argument besides the prototype is optional and
 * will be ignored if its value is <code>null</code>.
 */
protected CommonToken createToken(CommonToken prototype, String text, 
		Integer charPosInLine, Integer channel, Integer start, Integer stop, Integer type) {
	if (prototype == null)
		throw new IllegalArgumentException("Prototype may not be null.");
	CommonToken result = new CommonToken(prototype);
	if (text != null)
		result.setText(text);
	if (charPosInLine != null)
		result.setCharPositionInLine(charPosInLine.intValue());
	if (channel != null)
		result.setChannel(channel.intValue());
	if (start != null)
		result.setStartIndex(start.intValue());
	if (stop != null)
		result.setStopIndex(stop.intValue());
	if (type != null)
		result.setType(type.intValue());
	return result;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:24,代碼來源:AbstractSplittingTokenSource.java

示例2: processHiddenToken

import org.antlr.runtime.CommonToken; //導入方法依賴的package包/類
/**
 * Skips the given leaf as it's hidden. If it was the last token to be returned, a hidden token may be syntesized if
 * would affect the semicolon insertion.
 */
private Token processHiddenToken(ILeafNode leaf) {
	Token result = nextToken();
	if (result == Token.EOF_TOKEN && Strings.countLineBreaks(leaf.getText()) > 0) {
		next = result;
		CommonToken hidden = new CommonToken(tokenTypeMapper.getInternalTokenType(leaf), leaf.getText());
		hidden.setChannel(Token.HIDDEN_CHANNEL);
		return hidden;
	}
	return result;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:NodeModelTokenSource.java

示例3: createEndToken

import org.antlr.runtime.CommonToken; //導入方法依賴的package包/類
protected Token createEndToken(int offset) {
	CommonToken result = new CommonToken(getEndTokenType());
	result.setText("");
	result.setChannel(Token.DEFAULT_CHANNEL);
	result.setStartIndex(offset);
	result.setStopIndex(offset-1);
	return result;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:9,代碼來源:AbstractIndentationTokenSource.java

示例4: createBeginToken

import org.antlr.runtime.CommonToken; //導入方法依賴的package包/類
protected Token createBeginToken(int offset) {
	CommonToken result = new CommonToken(getBeginTokenType());
	result.setText("");
	result.setChannel(Token.DEFAULT_CHANNEL);
	result.setStartIndex(offset);
	result.setStopIndex(offset-1);
	return result;
}
 
開發者ID:eclipse,項目名稱:xtext-core,代碼行數:9,代碼來源:AbstractIndentationTokenSource.java


注:本文中的org.antlr.runtime.CommonToken.setChannel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。