only test start/stop timestamps if they are strings (2.0)
parent
04af273d71
commit
53dfe40c30
|
@ -219,11 +219,14 @@ class STIXPatternVisitorForSTIX2():
|
||||||
# Visit a parse tree produced by STIXPatternParser#startStopQualifier.
|
# Visit a parse tree produced by STIXPatternParser#startStopQualifier.
|
||||||
def visitStartStopQualifier(self, ctx):
|
def visitStartStopQualifier(self, ctx):
|
||||||
children = self.visitChildren(ctx)
|
children = self.visitChildren(ctx)
|
||||||
# parser will accept any string, need to make sure it is a full STIX timestamp
|
# 2.0 parser will accept any string, need to make sure it is a full STIX timestamp
|
||||||
t1 = check_for_valid_timetamp_syntax(children[1].value)
|
if isinstance(children[1], StringConstant):
|
||||||
t2 = check_for_valid_timetamp_syntax(children[3].value)
|
if not check_for_valid_timetamp_syntax(children[1].value):
|
||||||
if not t1 or not t2:
|
raise (ValueError("Start time is not a legal timestamp"))
|
||||||
raise(ValueError("Not a legal timestamp"))
|
if isinstance(children[3], StringConstant):
|
||||||
|
if not check_for_valid_timetamp_syntax(children[3].value):
|
||||||
|
raise (ValueError("Stop time is not a legal timestamp"))
|
||||||
|
|
||||||
return StartStopQualifier(children[1], children[3])
|
return StartStopQualifier(children[1], children[3])
|
||||||
|
|
||||||
# Visit a parse tree produced by STIXPatternParser#withinQualifier.
|
# Visit a parse tree produced by STIXPatternParser#withinQualifier.
|
||||||
|
|
Loading…
Reference in New Issue