Repository: zalmane/copybook (language: python)

Issue:
Ignore VALUE clause
I'm working with copybooks that specify a VALUE clause to define the default value of a field (in this case a Tab character used as a separator):

       01  WORK-BOOK.
          10  FILLER       PIC X(01) VALUE X'05'.

I don't need to know the default value in my use case, but the presence of the VALUE clause causes:

    pyparsing.exceptions.ParseException: Expected end of text, found '10'  (at char 32), (line:3, col:10)

I'd like copybook to accept the VALUE clause and ignore it.

See [VALUE Clause](https://www.ibm.com/docs/en/cobol-zos/4.2?topic=entry-value-clause) in the IBM Enterprise COBOL for z/OS documentation


Discussion / hints:
I will submit a pull request.

Fix patch:
diff --git a/copybook/parser.py b/copybook/parser.py
index aa50338..199432a 100644
--- a/copybook/parser.py
+++ b/copybook/parser.py
@@ -98,6 +98,10 @@
         + Optional("TIMES")
     )
     + pic_expr
+    + Optional(
+        "VALUE"
+        + SkipTo(".")
+    )
     + "."
     + ZeroOrMore(
         Group(Suppress("88")


Test patch:
diff --git a/tests/test_parse_string.py b/tests/test_parse_string.py
index ef327f5..dec7790 100644
--- a/tests/test_parse_string.py
+++ b/tests/test_parse_string.py
@@ -147,6 +147,16 @@ def test_extended_char_pic():
     assert result[2].datatype=="str"
     assert result[2].get_total_length()==2
 
+def test_ignore_value_clause():
+    test_str = """
+       01  WORK-BOOK.
+         10  FILLER       PIC X(01) VALUE X'05'.
+    """
+    result = copybook.parse_string(test_str).flatten()
+    assert len(result)==2
+    assert result[1].datatype=="str"
+    assert result[1].get_total_length()==1
+
 def test_plus_sign_control_symbol():
     test_str = """
        01  WORK-BOOK.
@@ -165,4 +175,4 @@ def test_minus_sign_control_symbol():
     result = copybook.parse_string(test_str).flatten()
     assert len(result)==2
     assert result[1].datatype=="decimal"
-    assert result[1].get_total_length()==7
\ No newline at end of file
+    assert result[1].get_total_length()==7