"in_pointer", Charset.class, t.getEncoding(), Integer.valueOf(t.getMaximumStringLength().getValue().intValue())); meta_field_name, c, t.getMaximumStringLength().getValue(), t.getEncoding());
@Test public final void testRecordTypeExprStringEncodingSupported() throws Exception { final JPRAParserType p = this.newParser(); final GlobalContextType c = GlobalContexts.newContext(new AlwaysEmptyLoader()); final JPRAResolverType r = this.newResolver(c); final JPRACheckerType ch = this.newChecker( c, JPRACheckerStandardCapabilities.newCapabilities()); final TypeExprType<IdentifierType, Untyped> te = r.resolveTypeExpression( p.parseTypeExpression( this.newStringSExpr("(string 32 \"UTF-8\")"))); final TypeExprString<IdentifierType, TType> e = TypeExprString.class.cast(ch.checkTypeExpression(te)); final TString ti = TString.class.cast(e.getType()); Assert.assertEquals( BigInteger.valueOf(288L), ti.getSizeInBits().getValue()); Assert.assertEquals( BigInteger.valueOf(32L), ti.getMaximumStringLength().getValue()); Assert.assertEquals("UTF-8", ti.getEncoding()); }
private TypeExprString<IdentifierType, TType> checkTypeExprString( final TypeExprString<IdentifierType, Untyped> e) throws JPRACompilerCheckerException { final SizeExprType<IdentifierType, TType> se = this.checkSizeExpr(e.getSize()); final Size<SizeUnitOctetsType> size = this.evaluateSize(se); if (this.caps.isStringEncodingSupported(e.getEncoding())) { final TString type = new TString(e.getLexicalInformation(), e.getEncoding(), size); return new TypeExprString<>( type, e.getLexicalInformation(), se, e.getEncoding()); } throw JPRACompilerCheckerException.stringEncodingNotSupported( e, e.getEncoding(), this.caps.getStringEncodingsSupported()); }
private TypeExprString<IdentifierType, TType> checkTypeExprString( final TypeExprString<IdentifierType, Untyped> e) throws JPRACompilerCheckerException { final SizeExprType<IdentifierType, TType> se = this.checkSizeExpr(e.getSize()); final Size<SizeUnitOctetsType> size = JPRAChecker.evaluateSize(se); if (this.caps.isStringEncodingSupported(e.getEncoding())) { final TString type = new TString(e.getLexicalInformation(), e.getEncoding(), size); return new TypeExprString<>( type, e.getLexicalInformation(), se, e.getEncoding()); } throw JPRACompilerCheckerException.stringEncodingNotSupported( e, e.getEncoding(), this.caps.getStringEncodingsSupported()); }