@Test
public void shouldParseGrammarWithOneRequiredTokenAndLengthAndOptionalScale() {

    pattern = parser.parse(TYPE, "DECIMAL[(M[,D])]");
    assertThat(pattern).isNotNull();
    type = pattern.match(text("DECIMAL"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(-1);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("DECIMAL");
    assertThat(type.expression()).isEqualTo("DECIMAL");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
    type = pattern.match(text("DECIMAL(5)"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(5);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("DECIMAL");
    assertThat(type.expression()).isEqualTo("DECIMAL(5)");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
    type = pattern.match(text("DECIMAL(5,3)"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(5);
    assertThat(type.scale()).isEqualTo(3);
    assertThat(type.name()).isEqualTo("DECIMAL");
    assertThat(type.expression()).isEqualTo("DECIMAL(5,3)");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
}