Support for labels with no statement#562
Conversation
…qual. Add test corroborating equality of ASTs
eliben
left a comment
There was a problem hiding this comment.
This seems to be introducing a large number of new shift/reduce conflicts for the parser, and it's clear why!
| p[0] = c_ast.Default([p[3]], self._token_coord(p, 1)) | ||
|
|
||
| def p_labeled_statement_4(self, p): | ||
| """ labeled_statement : ID COLON SEMI""" |
There was a problem hiding this comment.
I don't think this rule (_4) should be necessary, since a statement can already be empty. Why do you need it?
eliben
left a comment
There was a problem hiding this comment.
For the test, there's no reason to create a separate class just for this test. You can add a test_ function to the existing class.
Also, you're only checking that the code compiles properly without verifying anything about the AST. pycparser could completely ignore the label here and your test would still pass.
You probably want something similar to test_pragmacomp_or_statement but much simpler, that checks the right AST nodes with labels are parsed in a short function body.
|
Thank you for the all the comments. I imitated the test as you suggested. |
This pull request is aimed at fixing the issue described here: #528
The testing I did seems fine, and I implemented it through two rules to ensure that the representation of
label:andlabel:;is the same.