def test_typeClassExp(self): g = JavaGrammar() self._parseStringTest( g.primary(), 'float.class', Schema.TypeClassExp(typeExp=Schema.FloatTypeRef())) self._parseStringTest( g.primary(), 'ArrayList<Integer>.class', Schema.TypeClassExp(typeExp=Schema.GenericTypeExp( target='ArrayList', args=[Schema.ClassOrInterfaceTypeRef(name='Integer')]))) self._parseStringTest(g.primary(), 'void.class', Schema.VoidClassExp())
def voidClassExp(self): return ( Keyword(Keywords.voidKeyword) + Literal('.') + Keyword(Keywords.classKeyword) ).action(lambda input, begin, end, xs, bindings: Schema.VoidClassExp())