@Override protected com.ochafik.lang.jnaerator.parser.ObjCppParser newObjCppParser(TypeConversion typeConverter, String s, boolean verbose, PrintStream errorOut) throws IOException { com.ochafik.lang.jnaerator.parser.ObjCppParser parser = super.newObjCppParser(typeConverter, s, verbose, errorOut); parser.allowKinds(ModifierKind.OpenCL); return parser; }
static List<Declaration> parseDeclarations(String source) throws IOException, LexerException, InterruptedException { JNAeratorConfig config = new JNAeratorConfig(); JNAeratorConfigUtils.autoConfigure(config); //config.noCPlusPlus = true; config.preprocessorConfig.includeStrings.add(source); Result result = new Result(config, null, null); SourceFiles parse = new JNAeratorParser().parse(config, result.typeConverter, null); List<Declaration> ret = new ArrayList<Declaration>(); flatten(parse, ret); return ret; }
Expression expression = new JNAeratorParser().newObjCppParser(typeConverter, preprocessedMacro, verbose, null).expression();//.expr; if (expression == null) { continue;
sourceContent = removeInlineAsm(sourceContent); Future<SourceFile> fut = executor.submit(createParsingCallable(config, typeConverter, sourceContent, topLevelTypeDefs, true)); try { sourceFiles.add(fut.get(config.fullParsingTimeout, TimeUnit.MILLISECONDS)); return removeTypeDefsConflictingWithForcedTypeDefs(sourceFiles, topLevelTypeDefs); } catch (Throwable ex) { ex.printStackTrace(); List<Slice> slices = cutSourceContentInSlices(sourceContent, System.out); if (config.verbose) { System.out.println("Now parsing " + slices.size() + " slices"); for (Slice slice : slices) { try { sourceFiles.add(executor.submit(createParsingCallable(config, typeConverter, slice.text, topLevelTypeDefs, false)).get(config.sliceParsingTimeout, TimeUnit.MILLISECONDS)); } catch (Throwable ex) { if (firstFailure) { return removeTypeDefsConflictingWithForcedTypeDefs(sourceFiles, topLevelTypeDefs); } finally { executor.shutdown();
public SourceFiles parseSources(Feedback feedback, TypeConversion typeConverter) throws IOException, LexerException { feedback.setStatus("Parsing native headers..."); return createJNAeratorParser().parse(config, typeConverter, null); }
protected JNAeratorParser createJNAeratorParser() { return new JNAeratorParser(); }
Expression expression = new JNAeratorParser().newObjCppParser(typeConverter, preprocessedMacro, verbose, null).expression();//.expr; if (expression == null) { continue;
sourceContent = removeInlineAsm(sourceContent); Future<SourceFile> fut = executor.submit(createParsingCallable(config, typeConverter, sourceContent, topLevelTypeDefs, true)); try { sourceFiles.add(fut.get(config.fullParsingTimeout, TimeUnit.MILLISECONDS)); return removeTypeDefsConflictingWithForcedTypeDefs(sourceFiles, topLevelTypeDefs); } catch (Throwable ex) { ex.printStackTrace(); List<Slice> slices = cutSourceContentInSlices(sourceContent, System.out); if (config.verbose) { System.out.println("Now parsing " + slices.size() + " slices"); for (Slice slice : slices) { try { sourceFiles.add(executor.submit(createParsingCallable(config, typeConverter, slice.text, topLevelTypeDefs, false)).get(config.sliceParsingTimeout, TimeUnit.MILLISECONDS)); } catch (Throwable ex) { if (firstFailure) { return removeTypeDefsConflictingWithForcedTypeDefs(sourceFiles, topLevelTypeDefs); } finally { executor.shutdown();
public SourceFiles parseSources(Feedback feedback, TypeConversion typeConverter) throws IOException, LexerException { feedback.setStatus("Parsing native headers..."); return createJNAeratorParser().parse(config, typeConverter, null); }
protected JNAeratorParser createJNAeratorParser() { return new JNAeratorParser(); }
public TypeRef parseType(Node node) throws XPathExpressionException, RecognitionException, IOException { if (node == null) { return null; } TypeRef declaredType = null; try { String dt = XMLUtils.getAttribute(node, "declared_type"); if (dt != null) { ObjCppParser parser = new JNAeratorParser().newObjCppParser(result.typeConverter, dt, false, null); parser.setupScopes(); declaredType = parser.mutableTypeRef(); } } catch (Exception ex) { ex.printStackTrace(); } TypeRef inferredType = null; if (declaredType == null || declaredType instanceof SimpleTypeRef) { inferredType = parseAndReconciliateType(XMLUtils.getAttribute(node, "type"), XMLUtils.getAttribute(node, "type64")); if (inferredType != null && declaredType instanceof SimpleTypeRef && !inferredType.toString().equals(declaredType.toString())) { String sn = ((SimpleTypeRef) declaredType).getName().toString(); result.addWeakTypeDef(inferredType.clone(), sn); } } return declaredType != null ? declaredType : inferredType; }
ObjCppParser parser = newObjCppParser(typeConverter, source, config.verbose, pout); if (topLevelTypeDefs != null) { parser.topLevelTypeIdentifiers = topLevelTypeDefs;
static List<Declaration> parseDeclarations(String source) throws IOException, LexerException, InterruptedException { JNAeratorConfig config = new JNAeratorConfig(); JNAeratorConfigUtils.autoConfigure(config); //config.noCPlusPlus = true; config.preprocessorConfig.includeStrings.add(source); Result result = new Result(config, null, null); SourceFiles parse = new JNAeratorParser().parse(config, result.typeConverter, null); List<Declaration> ret = new ArrayList<Declaration>(); flatten(parse, ret); return ret; }
public TypeRef parseType(Node node) throws XPathExpressionException, RecognitionException, IOException { if (node == null) { return null; } TypeRef declaredType = null; try { String dt = XMLUtils.getAttribute(node, "declared_type"); if (dt != null) { ObjCppParser parser = new JNAeratorParser().newObjCppParser(result.typeConverter, dt, false, null); parser.setupScopes(); declaredType = parser.mutableTypeRef(); } } catch (Exception ex) { ex.printStackTrace(); } TypeRef inferredType = null; if (declaredType == null || declaredType instanceof SimpleTypeRef) { inferredType = parseAndReconciliateType(XMLUtils.getAttribute(node, "type"), XMLUtils.getAttribute(node, "type64")); if (inferredType != null && declaredType instanceof SimpleTypeRef && !inferredType.toString().equals(declaredType.toString())) { String sn = ((SimpleTypeRef) declaredType).getName().toString(); result.addWeakTypeDef(inferredType.clone(), sn); } } return declaredType != null ? declaredType : inferredType; }
ObjCppParser parser = newObjCppParser(typeConverter, source, config.verbose, pout); if (topLevelTypeDefs != null) { parser.topLevelTypeIdentifiers = topLevelTypeDefs;