@Test
public void shouldParseGrammarWithOptionalTokens() {

    pattern = parser.parse(TYPE, "[UNSIGNED] INTEGER");
    assertThat(pattern).isNotNull();
    type = pattern.match(text("UNSIGNED INTEGER"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(-1);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("UNSIGNED INTEGER");
    assertThat(type.expression()).isEqualTo("UNSIGNED INTEGER");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
    type = pattern.match(text("unsigned integer"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(-1);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("UNSIGNED INTEGER"); // matches the grammar
    assertThat(type.expression()).isEqualTo("UNSIGNED INTEGER"); // matches the grammar
    assertThat(type.jdbcType()).isEqualTo(TYPE);
    type = pattern.match(text("INTEGER"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(-1);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("INTEGER");
    assertThat(type.expression()).isEqualTo("INTEGER");
    assertThat(type.jdbcType()).isEqualTo(TYPE);
    type = pattern.match(text("integer"));
    assertThat(type.arrayDimensions()).isNull();
    assertThat(type.length()).isEqualTo(-1);
    assertThat(type.scale()).isEqualTo(-1);
    assertThat(type.name()).isEqualTo("INTEGER"); // matches the grammar
    assertThat(type.expression()).isEqualTo("INTEGER"); // matches the grammar
    assertThat(type.jdbcType()).isEqualTo(TYPE);
}