• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IParserLogService类的典型用法和代码示例

java 2次浏览

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

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

示例1: parseExpression

点赞 3

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
public IValue parseExpression(IString expression, IEvaluatorContext ctx) throws CoreException, IOException {
	setIEvaluatorContext(ctx);
	if (!expression.getValue().endsWith(";"))
		expression.concat(vf.string(";"));
	String expr = "void main() {\n\t" + expression.getValue() + "\n}";
	FileContent fc = FileContent.create("", expr.toCharArray());
	Map<String, String> macroDefinitions = new HashMap<String, String>();
	String[] includeSearchPaths = new String[0];
	IScannerInfo si = new ScannerInfo(macroDefinitions, includeSearchPaths);
	IncludeFileContentProvider ifcp = IncludeFileContentProvider.getEmptyFilesProvider();
	IIndex idx = null;
	int options = ILanguage.OPTION_PARSE_INACTIVE_CODE;
	IParserLogService log = new DefaultLogService();
	IASTTranslationUnit tu = GPPLanguage.getDefault().getASTTranslationUnit(fc, si, ifcp, idx, options, log);

	IASTFunctionDefinition main = (IASTFunctionDefinition) tu.getDeclarations()[0];
	IASTCompoundStatement body = (IASTCompoundStatement) main.getBody();
	IASTExpression ex = ((IASTExpressionStatement) body.getStatements()[0]).getExpression();
	ex.accept(this);
	return stack.pop();
}
 

开发者ID:cwi-swat,
项目名称:clair,
代码行数:22,
代码来源:Parser.java

示例2: mycreateScanner

点赞 3

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
protected IScanner mycreateScanner(
		FileContent content, IScannerInfo scanInfo, IncludeFileContentProvider fcp, IParserLogService log) {
	/*
	 * gccのプロジェクト設定(include path,マクロ定義etc)を元に
	 * ScannerInfoを作成してProCPreprocessorに渡す
	 */
	String afile = content.getFileLocation();
	IResource res = ParserUtil.getResourceForFilename(afile);
	if (res != null) {
		scanInfo =
			LanguageSettingsScannerInfoProvider.getScannerInformation(
					res, new String[]{"org.eclipse.cdt.core.gcc"});
	}
	return new ProCPreprocessor(
			content, scanInfo, getParserLanguage(), log, getScannerExtensionConfiguration(scanInfo), fcp);
}
 

开发者ID:buntatsu,
项目名称:cdt-proc,
代码行数:17,
代码来源:ProCLanguage.java

示例3: getAst

点赞 3

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
public static IASTTranslationUnit getAst(String code) {
	IParserLogService log = new DefaultLogService();
	CodeReader reader = new CodeReader(code.toCharArray());
	Map definedSymbols = new HashMap();
	String[] includePaths = new String[0];
	IScannerInfo info = new ScannerInfo(definedSymbols, includePaths);
	ICodeReaderFactory readerFactory = FileCodeReaderFactory.getInstance();
	IASTTranslationUnit ast = null;
	try {
		ast = GPPLanguage.getDefault().getASTTranslationUnit(
				reader, info, readerFactory, null, log);
	} catch (CoreException e) {
		// TODO Auto-generated catch block
		System.out.println("getAST fail");
		e.printStackTrace();
	}
	return ast;
}
 

开发者ID:elenno,
项目名称:simtest,
代码行数:19,
代码来源:getAST.java

示例4: parseString

点赞 2

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
public IValue parseString(IString code, IEvaluatorContext ctx) throws CoreException {
	setIEvaluatorContext(ctx);
	FileContent fc = FileContent.create("", code.getValue().toCharArray());
	IScannerInfo si = new ScannerInfo();
	IncludeFileContentProvider ifcp = IncludeFileContentProvider.getEmptyFilesProvider();
	int options = ILanguage.OPTION_PARSE_INACTIVE_CODE;
	IParserLogService log = new DefaultLogService();
	IASTTranslationUnit tu = GPPLanguage.getDefault().getASTTranslationUnit(fc, si, ifcp, null, options, log);
	tu.accept(this);
	return stack.pop();
}
 

开发者ID:cwi-swat,
项目名称:clair,
代码行数:12,
代码来源:Parser.java

示例5: getAstForLanguage

点赞 2

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
@Override
protected IASTTranslationUnit getAstForLanguage(final FileContent fc,
		final IScannerInfo si, final IncludeFileContentProvider ifcp,
		final IIndex idx, final int options, final IParserLogService log)
		throws CoreException {
	return GPPLanguage.getDefault().getASTTranslationUnit(fc, si, ifcp,
			idx, options, log);
}
 

开发者ID:mast-group,
项目名称:tassal,
代码行数:9,
代码来源:CppASTExtractor.java

示例6: getAstForLanguage

点赞 2

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
@Override
protected IASTTranslationUnit getAstForLanguage(final FileContent fc,
		final IScannerInfo si, final IncludeFileContentProvider ifcp,
		final IIndex idx, final int options, final IParserLogService log)
		throws CoreException {
	return GCCLanguage.getDefault().getASTTranslationUnit(fc, si, ifcp,
			idx, options, log);
}
 

开发者ID:mast-group,
项目名称:tassal,
代码行数:9,
代码来源:CAstExtractor.java

示例7: getAST

点赞 2

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
/**
 * Return an AST for the following CDT-compatible code;
 * 
 * @param code
 * @return
 * @throws CoreException
 */
public final IASTTranslationUnit getAST(final char[] code,
		final String baseIncludePath) throws CoreException {
	final FileContent fc = FileContent.create(baseIncludePath, code);
	final Map<String, String> macroDefinitions = Maps.newHashMap();
	final String[] includeSearchPaths = new String[0];
	final IScannerInfo si = new ScannerInfo(macroDefinitions,
			includeSearchPaths);
	final IncludeFileContentProvider ifcp = IncludeFileContentProvider
			.getEmptyFilesProvider();
	final IIndex idx = null;
	final int options = ILanguage.OPTION_IS_SOURCE_UNIT;
	final IParserLogService log = new DefaultLogService();
	return getAstForLanguage(fc, si, ifcp, idx, options, log);
}
 

开发者ID:mast-group,
项目名称:tassal,
代码行数:22,
代码来源:AbstractCdtAstExtractor.java

示例8: ProCPreprocessor

点赞 2

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
public ProCPreprocessor(FileContent fileContent, IScannerInfo info,
		ParserLanguage language, IParserLogService log,
		IScannerExtensionConfiguration configuration,
		IncludeFileContentProvider readerFactory) {

	super(fileContent, info, language, log, configuration, readerFactory);

	addProCHeaderReplaces();
	addProCKeywords();
}
 

开发者ID:buntatsu,
项目名称:cdt-proc,
代码行数:11,
代码来源:ProCPreprocessor.java

示例9: getASTTranslationUnit

点赞 2

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
@Override
public IASTTranslationUnit getASTTranslationUnit(FileContent reader, IScannerInfo scanInfo,
		IncludeFileContentProvider fileCreator, IIndex index, int options, IParserLogService log)
		throws CoreException {

	//final IScanner scanner= createScanner(reader, scanInfo, fileCreator, log);
	final IScanner scanner= mycreateScanner(reader, scanInfo, fileCreator, log);
	scanner.setComputeImageLocations((options & OPTION_NO_IMAGE_LOCATIONS) == 0);
	scanner.setProcessInactiveCode((options & OPTION_PARSE_INACTIVE_CODE) != 0);

	IParserSettings parserSettings= null;
	if (scanInfo instanceof ExtendedScannerInfo) {
		ExtendedScannerInfo extendedScannerInfo = (ExtendedScannerInfo) scanInfo;
		parserSettings = extendedScannerInfo.getParserSettings();
	}
	final ISourceCodeParser parser= createParser(scanner, log, index, false, options, parserSettings);

	// Make it possible to cancel parser by reconciler - http://bugs.eclipse.org/226682
	ICanceler canceler= null;
	if (log instanceof ICanceler) {
		canceler= (ICanceler) log;
		canceler.setCancelable(new ICancelable() {
			@Override
			public void cancel() {
				scanner.cancel();
				parser.cancel();
			}});
	}

	try {
		// Parse
		IASTTranslationUnit ast= parser.parse();
		ast.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0);
		return ast;
	} finally {
		if (canceler != null) {
			canceler.setCancelable(null);
		}
	}
}
 

开发者ID:buntatsu,
项目名称:cdt-proc,
代码行数:41,
代码来源:ProCLanguage.java

示例10: ProCSourceParser

点赞 2

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
public ProCSourceParser(IScanner scanner, ParserMode parserMode,
		IParserLogService logService, ICParserExtensionConfiguration config) {
	this(scanner, parserMode, logService, config, null);
}
 

开发者ID:buntatsu,
项目名称:cdt-proc,
代码行数:5,
代码来源:ProCSourceParser.java

示例11: createParser

点赞 2

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
@Override
protected ISourceCodeParser createParser(IScanner scanner,
		ParserMode parserMode, IParserLogService logService, IIndex index) {
	return new ProCSourceParser(scanner, parserMode, logService,
			getParserExtensionConfiguration(), index);
}
 

开发者ID:buntatsu,
项目名称:cdt-proc,
代码行数:7,
代码来源:ProCLanguage.java

示例12: getAstForLanguage

点赞 1

import org.eclipse.cdt.core.parser.IParserLogService; //导入依赖的package包/类
/**
 * To be overrided for each language.
 * 
 * @param fc
 * @param si
 * @param ifcp
 * @param idx
 * @param options
 * @param log
 * @return
 * @throws CoreException
 */
protected abstract IASTTranslationUnit getAstForLanguage(FileContent fc,
		IScannerInfo si, IncludeFileContentProvider ifcp, IIndex idx,
		int options, IParserLogService log) throws CoreException;
 

开发者ID:mast-group,
项目名称:tassal,
代码行数:16,
代码来源:AbstractCdtAstExtractor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)