ModifierKinds_scope getModifierKinds() { if (!hasModifierKinds()) setupScopes(); // return null; return (ModifierKinds_scope)ModifierKinds_stack.get(ModifierKinds_stack.size() - 1); } public void forbidKinds(ModifierKind... kinds) {
public boolean isAllowed(Modifier mod) { if (!hasModifierKinds()) setupScopes(); int nScopes = ModifierKinds_stack.size(); for (int i = nScopes; i-- != 0;) { ModifierKinds_scope scope = (ModifierKinds_scope)ModifierKinds_stack.get(i); boolean allowed = false; for (ModifierKind kind : mod.getKinds()) { if (scope.forbiddenKinds != null && scope.forbiddenKinds.contains(kind)) return false; if (scope.allowedKinds != null && scope.allowedKinds.contains(kind)) allowed = true; } if (allowed) return true; } return true; //if (true) return true; /*ModifierKinds_scope scope = getModifierKinds(); if (scope == null) return true; return scope.allowedKinds.containsAll(mod.getKinds());*/ } public void addTypeIdent(String ident) {
protected ObjCppParser newObjCppParser(TypeConversion typeConverter, String s, final boolean verbose, final PrintStream errorOut) throws IOException { ObjCppParser parser = new ObjCppParser( new CommonTokenStream( new ObjCppLexer( new ANTLRReaderStream(new StringReader(s)))) // , new DummyDebugEventListener() ) { @Override public void emitErrorMessage(String msg) { if (errorOut == null) { // if (verbose) // super.emitErrorMessage(msg); } else { errorOut.println(msg); } } @Override public void reportError(RecognitionException arg0) { if (verbose) { super.reportError(arg0); } } }; parser.setupScopes(); parser.objCParserHelper = typeConverter; return parser; } }
protected ObjCppParser newObjCppParser(TypeConversion typeConverter, String s, final boolean verbose, final PrintStream errorOut) throws IOException { ObjCppParser parser = new ObjCppParser( new CommonTokenStream( new ObjCppLexer( new ANTLRReaderStream(new StringReader(s)))) // , new DummyDebugEventListener() ) { @Override public void emitErrorMessage(String msg) { if (errorOut == null) { // if (verbose) // super.emitErrorMessage(msg); } else { errorOut.println(msg); } } @Override public void reportError(RecognitionException arg0) { if (verbose) { super.reportError(arg0); } } }; parser.setupScopes(); parser.objCParserHelper = typeConverter; return parser; } }
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; }
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; }