Skip to content

Commit

Permalink
Add tld to search grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
Mraoul committed Jan 15, 2019
1 parent 068ac0b commit 9ba910e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 26 deletions.
21 changes: 14 additions & 7 deletions pydat/pydat/handlers/advanced_es.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ def __repr__(self):
'details.administrativeContact_fax',
'details.administrativeContact_faxExt',
'details.administrativeContact_telephone',
'details.administrativeContact_telephoneExt'
'details.administrativeContact_telephoneExt',
'tld'
]

toplevel_keywords = [
'domainName',
'tld'
]

date_keywords = {
Expand Down Expand Up @@ -195,7 +201,8 @@ def __repr__(self):
'contactEmail',
'nameServers',
'registrarName',
'whoisServer'
'whoisServer',
'tld'
]

special_keywords = {
Expand Down Expand Up @@ -352,7 +359,7 @@ def create_specific_word_subquery(key, value):
if key in shortcut_keywords:
fields1 = shortcut_keywords[key]
elif key in original_keywords:
if key != 'domainName':
if key not in toplevel_keywords:
key = 'details.' + key
fields1 = [key]
else:
Expand Down Expand Up @@ -425,7 +432,7 @@ def p_specific_fuzzy_quoted(t):
if key in shortcut_keywords:
fields1 = shortcut_keywords[key]
elif key in original_keywords:
if key != 'domainName':
if key not in toplevel_keywords:
key = 'details.' + key
fields1 = [key]
else:
Expand Down Expand Up @@ -467,7 +474,7 @@ def p_specific_quoted(t):
if key in shortcut_keywords:
fields1 = shortcut_keywords[key]
elif key in original_keywords:
if key != 'domainName':
if key not in toplevel_keywords:
key = 'details.' + key
fields1 = [key]
else:
Expand Down Expand Up @@ -520,7 +527,7 @@ def p_field_missing(t):
if key in shortcut_keywords:
fields = shortcut_keywords[key]
elif key in original_keywords:
if key != 'domainName':
if key not in toplevel_keywords:
key = 'details.' + key
fields = [key]
else:
Expand All @@ -545,7 +552,7 @@ def create_wildreg_query(key, value, qtype):
if key in shortcut_keywords:
fields1 = shortcut_keywords[key]
elif key in original_keywords:
if key != 'domainName':
if key not in toplevel_keywords:
key = 'details.' + key
fields1 = [key]
else:
Expand Down
38 changes: 19 additions & 19 deletions pydat/pydat/handlers/parsetab.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@
del _lr_goto_items
_lr_productions = [
("S' -> query","S'",1,None,None,None),
('query -> LPAREN query RPAREN','query',3,'p_query_group','advanced_es.py',289),
('query -> NOT query','query',2,'p_query_not','advanced_es.py',294),
('query -> query query','query',2,'p_query_query','advanced_es.py',317),
('query -> query AND query','query',3,'p_query_and_query','advanced_es.py',322),
('query -> query OR query','query',3,'p_query_or_query','advanced_es.py',327),
('query -> specific','query',1,'p_query_terminals','advanced_es.py',341),
('query -> daterange','query',1,'p_query_terminals','advanced_es.py',342),
('query -> termquery','query',1,'p_query_terminals','advanced_es.py',343),
('specific -> FUZZY WORD COLON WORD','specific',4,'p_specific_fuzzy_word','advanced_es.py',379),
('specific -> WORD COLON WORD','specific',3,'p_specific_word','advanced_es.py',396),
('specific -> FUZZY WORD COLON QUOTED','specific',4,'p_specific_fuzzy_quoted','advanced_es.py',408),
('specific -> WORD COLON QUOTED','specific',3,'p_specific_quoted','advanced_es.py',453),
('specific -> WORD COLON NULL','specific',3,'p_field_missing','advanced_es.py',512),
('specific -> WORD COLON WILDCARD','specific',3,'p_specific_wildcard','advanced_es.py',580),
('specific -> WORD COLON REGEX','specific',3,'p_specific_regex','advanced_es.py',589),
('daterange -> WORD COLON DATE','daterange',3,'p_daterange_single','advanced_es.py',614),
('daterange -> WORD COLON DATE COLON DATE','daterange',5,'p_daterange_range','advanced_es.py',627),
('termquery -> QUOTED','termquery',1,'p_termquery_quoted','advanced_es.py',643),
('termquery -> WORD','termquery',1,'p_termquery_word','advanced_es.py',696),
('query -> LPAREN query RPAREN','query',3,'p_query_group','advanced_es.py',296),
('query -> NOT query','query',2,'p_query_not','advanced_es.py',301),
('query -> query query','query',2,'p_query_query','advanced_es.py',324),
('query -> query AND query','query',3,'p_query_and_query','advanced_es.py',329),
('query -> query OR query','query',3,'p_query_or_query','advanced_es.py',334),
('query -> specific','query',1,'p_query_terminals','advanced_es.py',348),
('query -> daterange','query',1,'p_query_terminals','advanced_es.py',349),
('query -> termquery','query',1,'p_query_terminals','advanced_es.py',350),
('specific -> FUZZY WORD COLON WORD','specific',4,'p_specific_fuzzy_word','advanced_es.py',386),
('specific -> WORD COLON WORD','specific',3,'p_specific_word','advanced_es.py',403),
('specific -> FUZZY WORD COLON QUOTED','specific',4,'p_specific_fuzzy_quoted','advanced_es.py',415),
('specific -> WORD COLON QUOTED','specific',3,'p_specific_quoted','advanced_es.py',460),
('specific -> WORD COLON NULL','specific',3,'p_field_missing','advanced_es.py',519),
('specific -> WORD COLON WILDCARD','specific',3,'p_specific_wildcard','advanced_es.py',587),
('specific -> WORD COLON REGEX','specific',3,'p_specific_regex','advanced_es.py',596),
('daterange -> WORD COLON DATE','daterange',3,'p_daterange_single','advanced_es.py',621),
('daterange -> WORD COLON DATE COLON DATE','daterange',5,'p_daterange_range','advanced_es.py',634),
('termquery -> QUOTED','termquery',1,'p_termquery_quoted','advanced_es.py',650),
('termquery -> WORD','termquery',1,'p_termquery_word','advanced_es.py',703),
]

0 comments on commit 9ba910e

Please sign in to comment.