@Test public void testComments() { final SubroutineDeclaration declaration = parser.parse( "declare commented_subroutine(name = vc, id = f8) = i2 with protect ;trailing comment"); assertThat(declaration.getName()).isEqualTo("commented_subroutine"); final List<SubroutineArgumentDeclaration> arguments = declaration.getArguments(); assertThat(arguments.get(0).getName()).isEqualTo("name"); assertThat(arguments.get(0).getDataType()).isEqualTo(DataType.VC); assertThat(arguments.get(0).isByRef()).isEqualTo(false); assertThat(arguments.get(1).getName()).isEqualTo("id"); assertThat(arguments.get(1).getDataType()).isEqualTo(DataType.F8); assertThat(arguments.get(1).isByRef()).isEqualTo(false); assertThat(declaration.getReturnType().getDataType()).isEqualTo(DataType.I2); final SubroutineDeclaration inlineDeclaration = parser.parse( "subroutine(commented_subroutine(name = vc, id = f8) = i2 with protect) ;trailing comment"); assertThat(inlineDeclaration.getName()).isEqualTo("commented_subroutine"); final List<SubroutineArgumentDeclaration> inlineArguments = inlineDeclaration.getArguments(); assertThat(inlineArguments.get(0).getName()).isEqualTo("name"); assertThat(inlineArguments.get(0).getDataType()).isEqualTo(DataType.VC); assertThat(inlineArguments.get(0).isByRef()).isEqualTo(false); assertThat(inlineArguments.get(1).getName()).isEqualTo("id"); assertThat(inlineArguments.get(1).getDataType()).isEqualTo(DataType.F8); assertThat(inlineArguments.get(1).isByRef()).isEqualTo(false); assertThat(inlineDeclaration.getReturnType().getDataType()).isEqualTo(DataType.I2); }
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);  }