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


Java ICharacterScanner类代码示例

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


ICharacterScanner类属于org.eclipse.jface.text.rules包,在下文中一共展示了ICharacterScanner类的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 scanner1, boolean resume) {
	if (!(scanner1 instanceof BatchDocumentPartitionScanner)){
		return Token.UNDEFINED;
	}
	BatchDocumentPartitionScanner scanner = (BatchDocumentPartitionScanner)scanner1;
	if (scanner.getOffset()<ECHO.length()){
		/* would be a problem on start on going back...*/
		return Token.UNDEFINED;
	}
	scanner.unread(); // go to character before
	int charBeforeAsInt = scanner.read(); // get character, moves to origin pos again
	/* fast guard closing:*/
	if (charBeforeAsInt!='o' && charBeforeAsInt!='O'){ // echo ECHO <- last character must be an o other wise guard close...
		return Token.UNDEFINED;
	}
	ICharacterScannerCodePosSupport codePosSupport = new ICharacterScannerCodePosSupport(scanner);
	if (parserSupport.isAfterEchoHandled(codePosSupport)){
		return getSuccessToken();
	}
	codePosSupport.resetToStartPos();
	return Token.UNDEFINED;
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:24,代码来源:AfterEchoDocumentRule.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 (hereStringSupport.isHereStringStateHandled(codePosSupport)){
		return getSuccessToken();
	}
	codePosSupport.resetToStartPos();
	return Token.UNDEFINED;
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:17,代码来源:HereStringRule.java

示例4: 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

示例5: 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

示例6: isList

import org.eclipse.jface.text.rules.ICharacterScanner; //导入依赖的package包/类
private boolean isList(ICharacterScanner scanner) {
	int n = scanner.read();
	if (isEol(n)) return false;					// blank line

	if (n == '-' || n == '+' || n == '*') {
		// Log.error("List mark at " + getOffset(scanner));
		if (spaceFollows(scanner)) {			// skip unordered lists
			// Log.error("List item at " + getOffset(scanner));
			gotoBOL(scanner);					// align, then consume the list
			gotoEOB(scanner);
			return true;
		}
		return false;
	}
	if (Character.isDigit(n)) {
		// Log.error("Digit mark at " + getOffset(scanner));
		if (isDigitSeq(scanner)) {		// skip ordered lists
			// Log.error("Digit item at " + getOffset(scanner));
			gotoBOL(scanner);			// align, then consume the list
			gotoEOB(scanner);
			return true;
		}
	}
	return false;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:26,代码来源:IndentedCodeRule.java

示例7: cleanupAndReturn

import org.eclipse.jface.text.rules.ICharacterScanner; //导入依赖的package包/类
private 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,项目名称:egradle,代码行数:21,代码来源:ExactWordPatternRule.java

示例8: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入依赖的package包/类
public IToken evaluate( ICharacterScanner scanner){

      buffer.setLength(0);

      int c = read(scanner);
      if (c == '&') {

         int i = 0;
         do {
            c = read(scanner);
            i++;

            if (c == '<' || c == ']') {
               for (int j = i - 1; j > 0; j--)
                  scanner.unread();
               return Token.UNDEFINED;
            }
         } while (c != ';');
         return fToken;
      }

      scanner.unread();
      return Token.UNDEFINED;
   }
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:25,代码来源:EscapedCharRule.java

示例9: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入依赖的package包/类
public IToken evaluate( ICharacterScanner scanner){

      buffer.setLength(0);

      charsRead = 0;
      int c = read(scanner);

      if (c == matchString.charAt(0)) {
         do {
            c = read(scanner);
         } while (isOK((char) c));

         if (charsRead == matchString.length()) {
            return fToken;
         } else {
            rewind(scanner);
            return Token.UNDEFINED;
         }

      }

      scanner.unread();
      return Token.UNDEFINED;
   }
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:25,代码来源:CDataRule.java

示例10: 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

示例11: 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

示例12: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入依赖的package包/类
public IToken evaluate(ICharacterScanner scanner) {

		buffer.setLength(0);

		int c = read(scanner);
		if (c == '&') {

			int i = 0;
			do {
				c = read(scanner);
				i++;

				if (c == '<' || c == ']') {
					for (int j = i - 1; j > 0; j--)
						scanner.unread();
					return Token.UNDEFINED;
				}
			} while (c != ';');
			return fToken;
		}

		scanner.unread();
		return Token.UNDEFINED;
	}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:25,代码来源:EscapedCharRule.java

示例13: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入依赖的package包/类
public IToken evaluate(ICharacterScanner scanner) {

		buffer.setLength(0);

		charsRead = 0;
		int c = read(scanner);

		if (c == matchString.charAt(0)) {
			do {
				c = read(scanner);
			} while (isOK((char) c));

			if (charsRead == matchString.length()) {
				return fToken;
			} else {
				rewind(scanner);
				return Token.UNDEFINED;
			}

		}

		scanner.unread();
		return Token.UNDEFINED;
	}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:25,代码来源:CDataRule.java

示例14: evaluate

import org.eclipse.jface.text.rules.ICharacterScanner; //导入依赖的package包/类
@Override
public IToken evaluate(ICharacterScanner scanner) {
	found = false;

	int c = scanner.read();
	scanner.unread();
	if (isHws(c)) {
		int col = scanner.getColumn();
		if (col == 1) {
			scanner.unread();
			int p = scanner.read();
			if (p == '\n') col = 0;
		}
		if (col == 0) {
			tabWidth = FluentMkUI.getDefault().getPreferenceStore().getInt(Prefs.EDITOR_TAB_WIDTH);
			if (tabWidth < 2) tabWidth = 4;
			line = 0;
			while (evaluateLine(scanner)) {
				found = true;
				line++;
			}
		}
	}
	if (found) return token;
	return Token.UNDEFINED;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:27,代码来源:IndentedCodeRule.java

示例15: 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


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