-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed start/stop qualifier constant issue #400
Conversation
Codecov Report
@@ Coverage Diff @@
## master #400 +/- ##
==========================================
- Coverage 98.44% 98.43% -0.01%
==========================================
Files 127 127
Lines 14634 14650 +16
==========================================
+ Hits 14406 14421 +15
- Misses 228 229 +1
Continue to review full report at Codecov.
|
Well I guess the obvious question is: how do we feel about putting TimestampConstant's in an AST for a STIX 2.0 pattern which doesn't have timestamp constants? I suppose it could act to smooth over 2.0/2.1 differences, but... is that what the AST should do? |
The rest of the tests in v20/test-pattern-expressions assume that the AST will contain a TimestampConstant. The pattern-visitor is version agnostic - so I think this is appropriate. As you implied, the 2.0 grammar doesn't accept t-prefixed timestamps. Did you have something else in mind? |
It was unexpected, for me (I had expected StringLiteral AST nodes). But I also wasn't totally convinced it was wrong. I thought I should bring it up and see if anyone else had opinions. AST's aren't supposed to exactly mirror the grammar. The names of the classes though, are at least partly derived from STIX spec terminology, and there is no timestamp constant in STIX 2.0. That's probably why it feels weird. But as I said, it could even be helpful if people want to write spec-version-neutral pattern processing code. On the other hand, if stringifying an AST derived from a STIX 2.0 pattern is supposed to recover the same pattern, it wouldn't work: you'd get 2.1 timestamp literals in your 2.0 pattern. For example:
The stix2 cti-python-stix2/stix2/test/v20/test_pattern_expressions.py Lines 463 to 467 in 7e41825
In principle I am okay with a more abstract spec-agnostic AST, but the round-trip changeover from 2.0 to 2.1 syntax is again unexpected and doesn't seem like the right behavior. @clenk what do you think? |
I think the 2.0 tests should be testing 2.0 syntax; they shouldn't have the |
ok - I guess this implies dropping TimestampConstant in the 2.0 tests. Hopefully, it won't blow up :-( |
@rpiazza the Travis build is failing, can you look into it? |
@clenk - should be good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me, thanks @rpiazza!
No description provided.