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


Java ICharacterScanner.read方法代码示例

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


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

示例1: cleanupAndReturn

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
boolean cleanupAndReturn(ICharacterScanner scanner, boolean result){
	if (result){
		return true; // do not clean up - pos is as wanted
	}
	if (count==0){
		return result;
	}
	if (count>0){
		while(count!=0){
			scanner.unread();
			count--;
		}
	}else{
		while(count!=0){
			scanner.read();
			count++;
		}
	}
	return false;
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:21,代码来源:Counter.java

示例2: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
	int r = scanner.read();
	scanner.unread();
	/* fast guard closing:*/
	if (ICharacterScanner.EOF==r || r!='<'){
		return Token.UNDEFINED;
	}
	
	ICharacterScannerCodePosSupport codePosSupport = new ICharacterScannerCodePosSupport(scanner);
	if (hereStringSupport.isHereStringStateHandled(codePosSupport)){
		return getSuccessToken();
	}
	codePosSupport.resetToStartPos();
	return Token.UNDEFINED;
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:17,代码来源:HereStringRule.java

示例3: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
	int r = scanner.read();
	scanner.unread();
	/* fast guard closing:*/
	if (ICharacterScanner.EOF==r || r!='<'){
		return Token.UNDEFINED;
	}
	
	ICharacterScannerCodePosSupport codePosSupport = new ICharacterScannerCodePosSupport(scanner);
	if (hereDocSupport.isHereDocStateHandled(codePosSupport)){
		return getSuccessToken();
	}
	codePosSupport.resetToStartPos();
	return Token.UNDEFINED;
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:17,代码来源:HereDocumentRule.java

示例4: doEvaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
protected IToken doEvaluate(final ICharacterScanner scanner, final boolean resume) {

  if (resume) {
    if (this.endSequenceDetected(scanner)) {
      return this.fToken;
    }
  } else {
    final int c = scanner.read();
    if (c == this.fStartSequence[0]) {
      if (this.sequenceDetected(scanner, this.fStartSequence, false)) {
        if (this.endSequenceDetected(scanner)) {
          return this.fToken;
        }
      }
    }
  }

  scanner.unread();
  return Token.UNDEFINED;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:22,代码来源:RelationBoundsRule.java

示例5: gotoEOL

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private boolean gotoEOL(ICharacterScanner scanner, boolean consumeEOL) {
	boolean blank = true;
	int b = scanner.read();
	while (!isEol(b)) {
		blank = blank && Character.isWhitespace(b);
		b = scanner.read();
	}
	if (b == ICharacterScanner.EOF) scanner.unread();
	if (consumeEOL) {
		b = scanner.read();
		if (b == '\r') {
			b = scanner.read();
		}
		if (b == ICharacterScanner.EOF) scanner.unread();
	}
	return blank;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:18,代码来源:HtmlCodeRule.java

示例6: sequenceDetected

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private boolean sequenceDetected(ICharacterScanner scanner, char[] sequence, boolean forward, boolean eofAllowed) {
	int c = scanner.read();
	if (c == ICharacterScanner.EOF) {
		if (forward) return false;
		return eofAllowed ? true : false;
	}
	scanner.unread();

	try {
		String txt = getScanText(scanner, 6, forward);
		String regex = String.valueOf(sequence);
		if (forward && txt.matches(regex + ".*")) {
			return true;
		}
		if (!forward && txt.matches(".*" + regex)) {
			return true;
		}
	} catch (BadLocationException e) {}
	return false;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:21,代码来源:MatchRule.java

示例7: sequenceDetected

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected boolean sequenceDetected( ICharacterScanner scanner, char[] sequence, boolean eofAllowed){
   int c = scanner.read();
   if (sequence[0] == '<') {
      if (c == '?') {
         // processing instruction - abort
         scanner.unread();
         return false;
      }
      if (c == '!') {
         scanner.unread();
         // comment - abort
         return false;
      }
   } else if (sequence[0] == '>') {
      scanner.unread();
   }
   return super.sequenceDetected(scanner, sequence, eofAllowed);
}
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:19,代码来源:StartTagRule.java

示例8: doEvaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
/**
 * Does the actual evaluation of the stream.
 * 
 * @param scanner The scanner
 * @param count The initial count of {
 * @return <code>fToken</code> on success, <code>Token.UNDEFINED</code> if
 * the match doesn't succeed
 */
private IToken doEvaluate(ICharacterScanner scanner, int count) {
    boolean inString = false;
    int c = scanner.read();

    if (((char) c) == '{') {
        do {
            c = scanner.read();
            if (((char) c) == '{' && !inString)
                count++;
            else if (((char) c) == '}' && !inString)
                count--;
            else if (((char) c) == '"' && !inString)
                inString = true;
            else if (((char) c) == '"' && inString)
                inString = false;
            else if (c == ICharacterScanner.EOF)
            	return Token.UNDEFINED;
        } while (count > 0);
        return fToken;
    }
    scanner.unread();
    return Token.UNDEFINED;
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:32,代码来源:BibBraceRule.java

示例9: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
    if (resume) {
        boolean inString = false;
        do {
            int c = scanner.read();
            if (((char) c) == ',' && !inString)
                break;
            else if (((char) c) == '@') {
                scanner.unread();
                return Token.UNDEFINED;
            } else if (((char) c) == '"' && !inString)
                inString = true;
            else if (((char) c) == '"' && inString)
                inString = false;
            else if (c == ICharacterScanner.EOF)
                return Token.UNDEFINED;
        } while (true);
    }
    return doEvaluate(scanner, 1);
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:21,代码来源:BibBraceRule.java

示例10: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
	if (fColumn == UNDEFINED) return doEvaluate(scanner, resume);

	int c = scanner.read();
	scanner.unread();
	if (c == fStartSequence[0]) {
		int col = scanner.getColumn();
		if (col == 1) {
			scanner.unread();
			int p = scanner.read();
			if (p == '\n') col = 0;
		}
		return (fColumn == col ? doEvaluate(scanner, resume) : Token.UNDEFINED);
	}
	return Token.UNDEFINED;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:18,代码来源:FirstColumnRule.java

示例11: sequenceDetected

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected boolean sequenceDetected(ICharacterScanner scanner,
		char[] sequence, boolean eofAllowed) {
	int c = scanner.read();
	if (sequence[0] == '<') {
		if (c == '?') {
			// processing instruction - abort
			scanner.unread();
			return false;
		}
		if (c == '!') {
			scanner.unread();
			// comment - abort
			return false;
		}
		if (c == '/') {
			// end tag
			scanner.unread();
			return false;
		}
	} else if (sequence[0] == '>') {
		scanner.unread();
	}
	return super.sequenceDetected(scanner, sequence, eofAllowed);
}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:25,代码来源:StartTagRule.java

示例12: gotoEOL

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private boolean gotoEOL(ICharacterScanner scanner, boolean consumeEOL) {
	int b = scanner.read();
	scanner.unread();
	while (!isEol(b)) {
		b = scanner.read();
	}
	if (b == ICharacterScanner.EOF) {
		scanner.unread();
		return false;
	}
	if (consumeEOL) {
		b = scanner.read();
		if (b == '\r') {
			b = scanner.read();
		}
		if (b == ICharacterScanner.EOF) {
			scanner.unread();
			return false;
		}
	}
	return true;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:23,代码来源:DotCodeRule.java

示例13: scannerRead

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
private int scannerRead(ICharacterScanner scanner, Counter counter) {
	int c = scanner.read();
	if (c==ICharacterScanner.EOF){
		return c;
	}
	counter.count++;
	if (trace){
		traceSb.append((char)c);
	}
	return c;
	
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:13,代码来源:ExactWordPatternRule.java

示例14: doEvaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {

		if (resume) {

			if (endSequenceDetected(scanner))
				return fToken;

		} else {
			int c= scanner.read();
			if (c == fStartSequence[0]) {
				scanner.unread();
				scanner.unread();
				int before = scanner.read();
				
				if (before=='\\'){
					return Token.UNDEFINED;
				}
				scanner.read();
				
				if (sequenceDetected(scanner, fStartSequence, false)) {
					if (endSequenceDetected(scanner))
						return fToken;
				}
			}
		}

		scanner.unread();
		return Token.UNDEFINED;
	}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:30,代码来源:BatchStringRule.java

示例15: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入方法依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
	char start = (char) scanner.read();
	if ('-' !=start) {
		scanner.unread();
		return Token.UNDEFINED;
	}

	/* check if the former character is a space - if not this is not an argument */
	scanner.unread();
	scanner.unread();
	char beforeStart = (char) scanner.read();
	if (' ' !=beforeStart){
		/* no unread necessary, scanner is at start start*/
		return Token.UNDEFINED;
	}
	/* go after start again*/
	scanner.read();
	
	/* okay could be a parameter*/
	do {
		char c = (char) scanner.read();
		if (! isPartOfParameter(c)) {
			scanner.unread();
			break;
		}
	} while (true);
	return getSuccessToken();
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:30,代码来源:CommandParameterRule.java


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