@Test public void testDeclareAllTheTypes() { final SubroutineDeclaration declaration = parser.parse( "declare allTheTypes(arg1 = vc, arg2 = vc(ref), arg3 = f4, arg4 = f4(ref), arg5 = f8, arg6 = f8(ref), " + "arg7 = i1, arg8 = i1(ref), arg9 = ui1, arg10 = ui1(ref), arg11 = i2, arg12 = i2(ref), arg13 = ui2, arg14 = ui2(ref), " + "arg15 = i4, arg16 = i4(ref), arg17 = ui4, arg18 = ui4(ref), arg19 = w8, arg20 = w8(ref), arg21 = uw8, arg22 = uw8(ref), " + "arg23 = h, arg24 = h(ref), arg25 = gvc, arg26 = gvc(ref), arg27 = ZVC, arg28 = ZVC(ref), arg29 = ZGVC, arg30 = ZGVC(ref), " + "arg31 = DQ8, arg32 = DQ8(ref), arg33 = DM12, arg34 = DM12(ref), arg35 = DM14, arg36 = DM14(ref)) = vc"); final List<SubroutineArgumentDeclaration> argDeclarations = declaration.getArguments(); assertThat(argDeclarations).hasSize(36); final SubroutineArgumentDeclaration arg0Declaration = argDeclarations.get(0); assertThat(arg0Declaration.getName()).isEqualTo("arg1"); assertThat(arg0Declaration.getDataType()).isEqualTo(DataType.VC); assertThat(arg0Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg1Declaration = argDeclarations.get(1); assertThat(arg1Declaration.getName()).isEqualTo("arg2"); assertThat(arg1Declaration.getDataType()).isEqualTo(DataType.VC); assertThat(arg1Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg2Declaration = argDeclarations.get(2); assertThat(arg2Declaration.getName()).isEqualTo("arg3"); assertThat(arg2Declaration.getDataType()).isEqualTo(DataType.F4); assertThat(arg2Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg3Declaration = argDeclarations.get(3); assertThat(arg3Declaration.getName()).isEqualTo("arg4"); assertThat(arg3Declaration.getDataType()).isEqualTo(DataType.F4); assertThat(arg3Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg4Declaration = argDeclarations.get(4); assertThat(arg4Declaration.getName()).isEqualTo("arg5"); assertThat(arg4Declaration.getDataType()).isEqualTo(DataType.F8); assertThat(arg4Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg5Declaration = argDeclarations.get(5); assertThat(arg5Declaration.getName()).isEqualTo("arg6"); assertThat(arg5Declaration.getDataType()).isEqualTo(DataType.F8); assertThat(arg5Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg6Declaration = argDeclarations.get(6); assertThat(arg6Declaration.getName()).isEqualTo("arg7"); assertThat(arg6Declaration.getDataType()).isEqualTo(DataType.I1); assertThat(arg6Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg7Declaration = argDeclarations.get(7); assertThat(arg7Declaration.getName()).isEqualTo("arg8"); assertThat(arg7Declaration.getDataType()).isEqualTo(DataType.I1); assertThat(arg7Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg8Declaration = argDeclarations.get(8); assertThat(arg8Declaration.getName()).isEqualTo("arg9"); assertThat(arg8Declaration.getDataType()).isEqualTo(DataType.UI1); assertThat(arg8Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg9Declaration = argDeclarations.get(9); assertThat(arg9Declaration.getName()).isEqualTo("arg10"); assertThat(arg9Declaration.getDataType()).isEqualTo(DataType.UI1); assertThat(arg9Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg10Declaration = argDeclarations.get(10); assertThat(arg10Declaration.getName()).isEqualTo("arg11"); assertThat(arg10Declaration.getDataType()).isEqualTo(DataType.I2); assertThat(arg10Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg11Declaration = argDeclarations.get(11); assertThat(arg11Declaration.getName()).isEqualTo("arg12"); assertThat(arg11Declaration.getDataType()).isEqualTo(DataType.I2); assertThat(arg11Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg12Declaration = argDeclarations.get(12); assertThat(arg12Declaration.getName()).isEqualTo("arg13"); assertThat(arg12Declaration.getDataType()).isEqualTo(DataType.UI2); assertThat(arg12Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg13Declaration = argDeclarations.get(13); assertThat(arg13Declaration.getName()).isEqualTo("arg14"); assertThat(arg13Declaration.getDataType()).isEqualTo(DataType.UI2); assertThat(arg13Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg14Declaration = argDeclarations.get(14); assertThat(arg14Declaration.getName()).isEqualTo("arg15"); assertThat(arg14Declaration.getDataType()).isEqualTo(DataType.I4); assertThat(arg14Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg15Declaration = argDeclarations.get(15); assertThat(arg15Declaration.getName()).isEqualTo("arg16"); assertThat(arg15Declaration.getDataType()).isEqualTo(DataType.I4); assertThat(arg15Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg16Declaration = argDeclarations.get(16); assertThat(arg16Declaration.getName()).isEqualTo("arg17"); assertThat(arg16Declaration.getDataType()).isEqualTo(DataType.UI4); assertThat(arg16Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg17Declaration = argDeclarations.get(17); assertThat(arg17Declaration.getName()).isEqualTo("arg18"); assertThat(arg17Declaration.getDataType()).isEqualTo(DataType.UI4); assertThat(arg17Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg18Declaration = argDeclarations.get(18); assertThat(arg18Declaration.getName()).isEqualTo("arg19"); assertThat(arg18Declaration.getDataType()).isEqualTo(DataType.W8); assertThat(arg18Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg19Declaration = argDeclarations.get(19); assertThat(arg19Declaration.getName()).isEqualTo("arg20"); assertThat(arg19Declaration.getDataType()).isEqualTo(DataType.W8); assertThat(arg19Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg20Declaration = argDeclarations.get(20); assertThat(arg20Declaration.getName()).isEqualTo("arg21"); assertThat(arg20Declaration.getDataType()).isEqualTo(DataType.UW8); assertThat(arg20Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg21Declaration = argDeclarations.get(21); assertThat(arg21Declaration.getName()).isEqualTo("arg22"); assertThat(arg21Declaration.getDataType()).isEqualTo(DataType.UW8); assertThat(arg21Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg22Declaration = argDeclarations.get(22); assertThat(arg22Declaration.getName()).isEqualTo("arg23"); assertThat(arg22Declaration.getDataType()).isEqualTo(DataType.H); assertThat(arg22Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg23Declaration = argDeclarations.get(23); assertThat(arg23Declaration.getName()).isEqualTo("arg24"); assertThat(arg23Declaration.getDataType()).isEqualTo(DataType.H); assertThat(arg23Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg24Declaration = argDeclarations.get(24); assertThat(arg24Declaration.getName()).isEqualTo("arg25"); assertThat(arg24Declaration.getDataType()).isEqualTo(DataType.GVC); assertThat(arg24Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg25Declaration = argDeclarations.get(25); assertThat(arg25Declaration.getName()).isEqualTo("arg26"); assertThat(arg25Declaration.getDataType()).isEqualTo(DataType.GVC); assertThat(arg25Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg26Declaration = argDeclarations.get(26); assertThat(arg26Declaration.getName()).isEqualTo("arg27"); assertThat(arg26Declaration.getDataType()).isEqualTo(DataType.ZVC); assertThat(arg26Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg27Declaration = argDeclarations.get(27); assertThat(arg27Declaration.getName()).isEqualTo("arg28"); assertThat(arg27Declaration.getDataType()).isEqualTo(DataType.ZVC); assertThat(arg27Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg28Declaration = argDeclarations.get(28); assertThat(arg28Declaration.getName()).isEqualTo("arg29"); assertThat(arg28Declaration.getDataType()).isEqualTo(DataType.ZGVC); assertThat(arg28Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg29Declaration = argDeclarations.get(29); assertThat(arg29Declaration.getName()).isEqualTo("arg30"); assertThat(arg29Declaration.getDataType()).isEqualTo(DataType.ZGVC); assertThat(arg29Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg30Declaration = argDeclarations.get(30); assertThat(arg30Declaration.getName()).isEqualTo("arg31"); assertThat(arg30Declaration.getDataType()).isEqualTo(DataType.DQ8); assertThat(arg30Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg31Declaration = argDeclarations.get(31); assertThat(arg31Declaration.getName()).isEqualTo("arg32"); assertThat(arg31Declaration.getDataType()).isEqualTo(DataType.DQ8); assertThat(arg31Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg32Declaration = argDeclarations.get(32); assertThat(arg32Declaration.getName()).isEqualTo("arg33"); assertThat(arg32Declaration.getDataType()).isEqualTo(DataType.DM12); assertThat(arg32Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg33Declaration = argDeclarations.get(33); assertThat(arg33Declaration.getName()).isEqualTo("arg34"); assertThat(arg33Declaration.getDataType()).isEqualTo(DataType.DM12); assertThat(arg33Declaration.isByRef()).isTrue(); final SubroutineArgumentDeclaration arg34Declaration = argDeclarations.get(34); assertThat(arg34Declaration.getName()).isEqualTo("arg35"); assertThat(arg34Declaration.getDataType()).isEqualTo(DataType.DM14); assertThat(arg34Declaration.isByRef()).isFalse(); final SubroutineArgumentDeclaration arg35Declaration = argDeclarations.get(35); assertThat(arg35Declaration.getName()).isEqualTo("arg36"); assertThat(arg35Declaration.getDataType()).isEqualTo(DataType.DM14); assertThat(arg35Declaration.isByRef()).isTrue(); }
public SubroutineDeclaration parse(final String declaration) { if (declaration == null) { throw new IllegalArgumentException("Subroutine declaration cannot be null."); } final EtmPoint point = PointFactory.getPoint(getClass(), "parse(String)"); String reducedDeclaration = reduceDeclaration(uncommentDeclaration(declaration).trim()); try { return new SubroutineDeclaration(parseName(declaration, reducedDeclaration), parseReturnType(declaration, reducedDeclaration), parseArguments(reducedDeclaration)); } finally { point.collect(); } }
SubroutineDeclarationParser { public SubroutineDeclaration parse(final String declaration) { if (declaration == null) { throw new IllegalArgumentException("Subroutine declaration cannot be null."); } final EtmPoint point = PointFactory.getPoint(getClass(), "parse(String)"); String reducedDeclaration = reduceDeclaration(uncommentDeclaration(declaration).trim()); try { return new SubroutineDeclaration(parseName(declaration, reducedDeclaration), parseReturnType(declaration, reducedDeclaration), parseArguments(reducedDeclaration)); } finally { point.collect(); } } }
SubroutineDeclarationParser { public SubroutineDeclaration parse(final String declaration) { if (declaration == null) { throw new IllegalArgumentException("Subroutine declaration cannot be null."); } final EtmPoint point = PointFactory.getPoint(getClass(), "parse(String)"); String reducedDeclaration = reduceDeclaration(uncommentDeclaration(declaration).trim()); try { return new SubroutineDeclaration(parseName(declaration, reducedDeclaration), parseReturnType(declaration, reducedDeclaration), parseArguments(reducedDeclaration)); } finally { point.collect(); } }  }
SubroutineDeclarationParser { public SubroutineDeclaration parse(final String declaration) { if (declaration == null) { throw new IllegalArgumentException("Subroutine declaration cannot be null."); } final EtmPoint point = PointFactory.getPoint(getClass(), "parse(String)"); String reducedDeclaration = reduceDeclaration(uncommentDeclaration(declaration).trim()); try { return new SubroutineDeclaration(parseName(declaration, reducedDeclaration), parseReturnType(declaration, reducedDeclaration), parseArguments(reducedDeclaration)); } finally { point.collect(); } }  SubroutineDeclaration parse(final String declaration); }
SubroutineDeclarationParser { public SubroutineDeclaration parse(final String declaration) { if (declaration == null) { throw new IllegalArgumentException("Subroutine declaration cannot be null."); } final EtmPoint point = PointFactory.getPoint(getClass(), "parse(String)"); String reducedDeclaration = reduceDeclaration(uncommentDeclaration(declaration).trim()); try { return new SubroutineDeclaration(parseName(declaration, reducedDeclaration), parseReturnType(declaration, reducedDeclaration), parseArguments(reducedDeclaration)); } finally { point.collect(); } }  SubroutineDeclaration parse(final String declaration);  }