Repository: benjamincorcoran/sasdocs

Issue:
datasteps without a set or merge statement
# Issue

Currently only datasteps with a `set` or `merge` statement are parsed. However this does not account for `datalines` and `cards` statements, as well as `infile` statements

```sas
data a;
    input a;
    datalines;
1
;
run;
```
Should produce `dataStep` object with single output of `dataObject: a`

Discussion:

Patch:
diff --git a/sasdocs/objects.py b/sasdocs/objects.py
index 122120d..8b954ba 100644
--- a/sasdocs/objects.py
+++ b/sasdocs/objects.py
@@ -718,8 +718,8 @@ dataLine = dataObj.sep_by(spc)
 
 datastep = ps.seq(
     outputs = (ps.regex(r'data', flags=re.IGNORECASE) + spc) >> dataLine << col,
-    header = ps.regex(r'.*?(?=set|merge)', flags=reFlags),
-    inputs = (opspc + ps.regex(r'set|merge',flags=re.IGNORECASE) + opspc) >> dataLine << col,
+    header = (ps.regex(r'.*?(?=set|merge)', flags=reFlags)).optional(),
+    inputs = ((opspc + ps.regex(r'set|merge',flags=re.IGNORECASE) + opspc) >> dataLine << col).optional(),
     body = ps.regex(r'.*?(?=run)', flags=reFlags),
     _run = run + opspc + col
 ).combine_dict(dataStep)


Test patch:
diff --git a/tests/test_objects.py b/tests/test_objects.py
index ece6658..8e46ebf 100644
--- a/tests/test_objects.py
+++ b/tests/test_objects.py
@@ -51,7 +51,8 @@ def test_dataLine_parse(case, expected):
     assert dataLine.parse(case) == expected
 
 testcases = [
-    ("data test.test lib2.test(where=(ax=b) rename=(a=b)); format a; set test; a = 1; b = 2; output; run;", dataStep(outputs=[dataObject(library=['test'], dataset=['test'], options=None), dataObject(library=['lib2'], dataset=['test'], options=[dataArg(option=['where'], setting='(ax=b)'), dataArg(option=['rename'], setting='(a=b)')])], header=' format a; ', inputs=[dataObject(library=None, dataset=['test'], options=None)], body=' a = 1; b = 2; output; '))
+    ("data test.test lib2.test(where=(ax=b) rename=(a=b)); format a; set test; a = 1; b = 2; output; run;", dataStep(outputs=[dataObject(library=['test'], dataset=['test'], options=None), dataObject(library=['lib2'], dataset=['test'], options=[dataArg(option=['where'], setting='(ax=b)'), dataArg(option=['rename'], setting='(a=b)')])], header=' format a; ', inputs=[dataObject(library=None, dataset=['test'], options=None)], body=' a = 1; b = 2; output; ')),
+    ("data out; input a; datalines; 1; run;", dataStep(outputs=[dataObject(library=None,dataset=['out'],options=None)],inputs=None,header=None,body=' input a; datalines; 1; '))
 ]
 
 @pytest.mark.parametrize("case,expected", testcases)