• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InvalidInputException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



InvalidInputException类属于org.eclipse.jdt.core.compiler包,在下文中一共展示了InvalidInputException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: tokenize

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
@Override
public List<String> tokenize(String source) {
	try {
		char[] charArray = source.toCharArray();
           scanner.setSource(source.toCharArray());
           List<String> tokens = new ArrayList<>();
           int token;
           while ((token = scanner.getNextToken()) != ITerminalSymbols.TokenNameEOF) {
               int tokenStart = scanner.getCurrentTokenStartPosition();
               int tokenEnd = scanner.getCurrentTokenEndPosition();
               if (token != ITerminalSymbols.TokenNameWHITESPACE) {
               	tokens.add(new String(charArray, tokenStart, tokenEnd - tokenStart + 1));
               }
           }
           return tokens;
       } catch (InvalidInputException e) {
           throw new RuntimeException(e);
       }
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:20,代码来源:JavaSourceTokenizer.java


示例2: checkMethodsWithSharedAttributes

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
/**
 * Method to check with methods share common attributes, according to
 * CK definition.
 * @author Mariana Azevedo
 * @since 13/07/2014
 * @param methods
 */
private void checkMethodsWithSharedAttributes(IMethod[] methods){
	
	IScanner scanner = null;
	for (IMethod method : methods) {
		String methodName = method.getElementName();
		
		try {
			scanner = ToolFactory.createScanner(false, false, false, false);
			scanner.setSource(method.getSource().toCharArray());
			while(true){
				int charactere = scanner.getNextToken();
				if (charactere == ITerminalSymbols.TokenNameEOF) break;
				if (charactere == ITerminalSymbols.TokenNameIdentifier) {
					addMethods(new String(scanner.getCurrentTokenSource()), methodName);
				}
			}
		} catch (JavaModelException exception1) {
			logger.error(exception1);
		} catch (InvalidInputException exception2) {
			logger.error(exception2);
		}
		
	}
}
 
开发者ID:mariazevedo88,项目名称:o3smeasures-tool,代码行数:32,代码来源:LackCohesionMethodsJavaModel.java


示例3: normalizeReference

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
/**
 * Removes comments and whitespace
 *
 * @param reference
 *            the type reference
 * @return the reference only consisting of dots and java identifier
 *         characters
 */
public static String normalizeReference(String reference) {
	IScanner scanner = ToolFactory.createScanner(false, false, false, false);
	scanner.setSource(reference.toCharArray());
	StringBuffer sb = new StringBuffer();
	try {
		int tokenType = scanner.getNextToken();
		while (tokenType != ITerminalSymbols.TokenNameEOF) {
			sb.append(scanner.getRawTokenSource());
			tokenType = scanner.getNextToken();
		}
	} catch (InvalidInputException e) {
		Assert.isTrue(false, reference);
	}
	reference = sb.toString();
	return reference;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:25,代码来源:CommentAnalyzer.java


示例4: isJustWhitespaceOrComment

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
private static boolean isJustWhitespaceOrComment(int start, int end, IBuffer buffer) {
  if (start == end) return true;
  Assert.isTrue(start <= end);
  String trimmedText = buffer.getText(start, end - start).trim();
  if (0 == trimmedText.length()) {
    return true;
  } else {
    IScanner scanner = ToolFactory.createScanner(false, false, false, null);
    scanner.setSource(trimmedText.toCharArray());
    try {
      return scanner.getNextToken() == ITerminalSymbols.TokenNameEOF;
    } catch (InvalidInputException e) {
      return false;
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:Util.java


示例5: doScan

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
private void doScan() {
  try {
    int token = fScanner.getNextToken();
    while (token != ITerminalSymbols.TokenNameEOF) {
      switch (token) {
        case ITerminalSymbols.TokenNameStringLiteral:
        case ITerminalSymbols.TokenNameCOMMENT_JAVADOC:
        case ITerminalSymbols.TokenNameCOMMENT_LINE:
        case ITerminalSymbols.TokenNameCOMMENT_BLOCK:
          parseCurrentToken();
      }
      token = fScanner.getNextToken();
    }
  } catch (InvalidInputException e) {
    // ignore
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:RefactoringScanner.java


示例6: normalizeReference

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
/**
 * Removes comments and whitespace
 *
 * @param reference the type reference
 * @return the reference only consisting of dots and java identifier characters
 */
public static String normalizeReference(String reference) {
  IScanner scanner = ToolFactory.createScanner(false, false, false, false);
  scanner.setSource(reference.toCharArray());
  StringBuffer sb = new StringBuffer();
  try {
    int tokenType = scanner.getNextToken();
    while (tokenType != ITerminalSymbols.TokenNameEOF) {
      sb.append(scanner.getRawTokenSource());
      tokenType = scanner.getNextToken();
    }
  } catch (InvalidInputException e) {
    Assert.isTrue(false, reference);
  }
  reference = sb.toString();
  return reference;
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:CommentAnalyzer.java


示例7: getSurroundingComment

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
private int getSurroundingComment(IScanner scanner) {
  try {
    int start = fLocation.getOffset();
    int end = start + fLocation.getLength();

    int token = scanner.getNextToken();
    while (token != ITerminalSymbols.TokenNameEOF) {
      if (TokenScanner.isComment(token)) {
        int currStart = scanner.getCurrentTokenStartPosition();
        int currEnd = scanner.getCurrentTokenEndPosition() + 1;
        if (currStart <= start && end <= currEnd) {
          return token;
        }
      }
      token = scanner.getNextToken();
    }

  } catch (InvalidInputException e) {
    // ignore
  }
  return ITerminalSymbols.TokenNameEOF;
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:TaskMarkerProposal.java


示例8: retrieveStartBlockPosition

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
/**
 * This method is used to retrieve the start position of the block.
 * @return int the dimension found, -1 if none
 */
protected int retrieveStartBlockPosition(int start, int end) {
	this.scanner.resetTo(start, end);
	try {
		int token;
		while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
			switch(token) {
				case TerminalTokens.TokenNameLBRACE://110
					return this.scanner.startPosition;
			}
		}
	} catch(InvalidInputException e) {
		// ignore
	}
	return -1;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ASTConverter.java


示例9: tokenListFromCode

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
@Override
public List<String> tokenListFromCode(final char[] code) {
	final List<String> tokens = Lists.newArrayList();
	tokens.add(SENTENCE_START);
	final PublicScanner scanner = prepareScanner(code);
	do {
		try {
			final int token = scanner.getNextToken();
			if (token == ITerminalSymbols.TokenNameEOF) {
				break;
			}
			tokens.addAll(getConvertedToken(scanner, token));
		} catch (final InvalidInputException e) {
			LOGGER.warning(ExceptionUtils.getFullStackTrace(e));
		}
	} while (!scanner.atEnd());
	tokens.add(SENTENCE_END);
	return tokens;
}
 
开发者ID:mast-group,项目名称:codemining-core,代码行数:20,代码来源:JavaWhitespaceTokenizer.java


示例10: getTokenListFromCode

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
@Override
public List<FullToken> getTokenListFromCode(final char[] code) {
	final List<FullToken> tokens = Lists.newArrayList();
	tokens.add(new FullToken(SENTENCE_START, SENTENCE_START));
	final PublicScanner scanner = prepareScanner(code);
	do {
		try {
			final int token = scanner.getNextToken();
			if (token == ITerminalSymbols.TokenNameEOF) {
				break;
			}
			for (final String cToken : getConvertedToken(scanner, token)) {
				tokens.add(new FullToken(cToken, ""));
			}
		} catch (final InvalidInputException e) {
			LOGGER.warning(ExceptionUtils.getFullStackTrace(e));
		}
	} while (!scanner.atEnd());
	tokens.add(new FullToken(SENTENCE_END, SENTENCE_END));
	return tokens;
}
 
开发者ID:mast-group,项目名称:tassal,代码行数:22,代码来源:JavaWhitespaceTokenizer.java


示例11: consumeDigits

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
private final void consumeDigits(int radix, boolean expectingDigitFirst) throws InvalidInputException {
	final int USING_UNDERSCORE = 1;
	final int INVALID_POSITION = 2;
	switch(consumeDigits0(radix, USING_UNDERSCORE, INVALID_POSITION, expectingDigitFirst)) {
		case USING_UNDERSCORE :
			if (this.sourceLevel < ClassFileConstants.JDK1_7) {
				throw new InvalidInputException(UNDERSCORES_IN_LITERALS_NOT_BELOW_17);
			}
			break;
		case INVALID_POSITION :
			if (this.sourceLevel < ClassFileConstants.JDK1_7) {
				throw new InvalidInputException(UNDERSCORES_IN_LITERALS_NOT_BELOW_17);
			}
			throw new InvalidInputException(INVALID_UNDERSCORE);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:Scanner.java


示例12: retrieveEndOfRightParenthesisPosition

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
/**
 * This method is used to retrieve the position after the right parenthesis.
 * @return int the position found
 */
protected int retrieveEndOfRightParenthesisPosition(int start, int end) {
	this.scanner.resetTo(start, end);
	try {
		int token;
		while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
			switch(token) {
				case TerminalTokens.TokenNameRPAREN:
					return this.scanner.currentPosition;
			}
		}
	} catch(InvalidInputException e) {
		// ignore
	}
	return -1;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:ASTConverter.java


示例13: doScan

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
private void doScan() {
	try{
		int token = fScanner.getNextToken();
		while (token != ITerminalSymbols.TokenNameEOF) {
			switch (token) {
				case ITerminalSymbols.TokenNameStringLiteral :
				case ITerminalSymbols.TokenNameCOMMENT_JAVADOC :
				case ITerminalSymbols.TokenNameCOMMENT_LINE :
				case ITerminalSymbols.TokenNameCOMMENT_BLOCK :
					parseCurrentToken();
			}
			token = fScanner.getNextToken();
		}
	} catch (InvalidInputException e){
		//ignore
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:RefactoringScanner.java


示例14: isJustWhitespaceOrComment

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
private static boolean isJustWhitespaceOrComment(int start, int end, IBuffer buffer) {
	if (start == end)
		return true;
	Assert.isTrue(start <= end);
	String trimmedText= buffer.getText(start, end - start).trim();
	if (0 == trimmedText.length()) {
		return true;
	} else {
		IScanner scanner= ToolFactory.createScanner(false, false, false, null);
		scanner.setSource(trimmedText.toCharArray());
		try {
			return scanner.getNextToken() == ITerminalSymbols.TokenNameEOF;
		} catch (InvalidInputException e) {
			return false;
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:Util.java


示例15: createFieldReference

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
protected Object createFieldReference(Object receiver) throws InvalidInputException {
	try {
		MemberRef fieldRef = this.ast.newMemberRef();
		SimpleName fieldName = new SimpleName(this.ast);
		fieldName.internalSetIdentifier(new String(this.identifierStack[0]));
		fieldRef.setName(fieldName);
		int start = (int) (this.identifierPositionStack[0] >>> 32);
		int end = (int) this.identifierPositionStack[0];
		fieldName.setSourceRange(start, end - start + 1);
		if (receiver == null) {
			start = this.memberStart;
			fieldRef.setSourceRange(start, end - start + 1);
		} else {
			Name typeRef = (Name) receiver;
			fieldRef.setQualifier(typeRef);
			start = typeRef.getStartPosition();
			end = fieldName.getStartPosition()+fieldName.getLength()-1;
			fieldRef.setSourceRange(start, end-start+1);
		}
		return fieldRef;
	}
	catch (ClassCastException ex) {
			throw new InvalidInputException();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:DocCommentParser.java


示例16: syntaxRecoverQualifiedName

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
protected Object syntaxRecoverQualifiedName(int primitiveToken) throws InvalidInputException {
	if (this.cursorLocation == ((int)this.identifierPositionStack[this.identifierPtr])) {
		// special case of completion just before the dot.
		return createTypeReference(primitiveToken);
	}
	int idLength = this.identifierLengthStack[this.identifierLengthPtr];
	char[][] tokens = new char[idLength][];
	int startPtr = this.identifierPtr-idLength+1;
	System.arraycopy(this.identifierStack, startPtr, tokens, 0, idLength);
	long[] positions = new long[idLength+1];
	System.arraycopy(this.identifierPositionStack, startPtr, positions, 0, idLength);
	positions[idLength] = (((long)this.tokenPreviousPosition)<<32) + this.tokenPreviousPosition;
	this.completionNode = new CompletionOnJavadocQualifiedTypeReference(tokens, CharOperation.NO_CHAR, positions, this.tagSourceStart, this.tagSourceEnd);

	if (CompletionEngine.DEBUG) {
		System.out.println("	completion partial qualified type="+this.completionNode); //$NON-NLS-1$
	}
	return this.completionNode;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:CompletionJavadocParser.java


示例17: retrieveRightBrace

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
/**
 * This method is used to retrieve position before the next right brace or semi-colon.
 * @return int the position found.
 */
protected int retrieveRightBrace(int start, int end) {
	this.scanner.resetTo(start, end);
	try {
		int token;
		while ((token = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
			switch(token) {
				case TerminalTokens.TokenNameRBRACE :
					return this.scanner.currentPosition - 1;
			}
		}
	} catch(InvalidInputException e) {
		// ignore
	}
	return -1;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:ASTConverter.java


示例18: createFieldReference

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
protected Object createFieldReference(Object receiver) throws InvalidInputException {
	int refStart = (int) (this.identifierPositionStack[0] >>> 32);
	int refEnd = (int) this.identifierPositionStack[0];
	boolean inCompletion = (refStart <= (this.cursorLocation+1) && this.cursorLocation <= refEnd) // completion cursor is between first and last stacked identifiers
		|| ((refStart == (refEnd+1) && refEnd == this.cursorLocation)) // or it's a completion on empty token
		|| (this.memberStart == this.cursorLocation); // or it's a completion just after the member separator with an identifier after the cursor
	if (inCompletion) {
		JavadocFieldReference fieldRef = (JavadocFieldReference) super.createFieldReference(receiver);
		char[] name = this.sourceParser.compilationUnit.getMainTypeName();
		TypeDeclaration typeDecl = getParsedTypeDeclaration();
		if (typeDecl != null) {
			name = typeDecl.name;
		}
		this.completionNode = new CompletionOnJavadocFieldReference(fieldRef, this.memberStart, name);
		if (CompletionEngine.DEBUG) {
			System.out.println("	completion field="+this.completionNode); //$NON-NLS-1$
		}
		return this.completionNode;
	}
	return super.createFieldReference(receiver);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:CompletionJavadocParser.java


示例19: printNextToken

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
public void printNextToken(int[] expectedTokenTypes, boolean considerSpaceIfAny){
	printComment(CodeFormatter.K_UNKNOWN, NO_TRAILING_COMMENT);
	try {
		this.currentToken = this.scanner.getNextToken();
		if (Arrays.binarySearch(expectedTokenTypes, this.currentToken) < 0) {
			StringBuffer expectations = new StringBuffer(5);
			for (int i = 0; i < expectedTokenTypes.length; i++){
				if (i > 0) {
					expectations.append(',');
				}
				expectations.append(expectedTokenTypes[i]);
			}
			throw new AbortFormatting("unexpected token type, expecting:["+expectations.toString()+"], actual:"+this.currentToken);//$NON-NLS-1$//$NON-NLS-2$
		}
		print(this.scanner.currentPosition - this.scanner.startPosition, considerSpaceIfAny);
	} catch (InvalidInputException e) {
		throw new AbortFormatting(e);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:Scribe.java


示例20: isNextToken

import org.eclipse.jdt.core.compiler.InvalidInputException; //导入依赖的package包/类
private boolean isNextToken(int tokenName) {
	this.localScanner.resetTo(this.scribe.scanner.currentPosition, this.scribe.scannerEndPosition - 1);
	try {
		int token = this.localScanner.getNextToken();
		loop: while(true) {
			switch(token) {
				case TerminalTokens.TokenNameCOMMENT_BLOCK :
				case TerminalTokens.TokenNameCOMMENT_JAVADOC :
				case TerminalTokens.TokenNameCOMMENT_LINE :
					token = this.localScanner.getNextToken();
					continue loop;
				default:
					break loop;
			}
		}
		return  token == tokenName;
	} catch(InvalidInputException e) {
		// ignore
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:CodeFormatterVisitor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConsistencyLevel类代码示例发布时间:2022-05-21
下一篇:
Java NodeTraversor类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap