def _string_to_ast(self, input_string):
<EOL>comp_word = Regex("<STR_LIT>")<EOL>word = Regex("<STR_LIT>").setResultsName('<STR_LIT>')<EOL>comp_number = Word(nums)<EOL>number = Word(nums).setResultsName('<STR_LIT>')<EOL>ipv4_oct = Regex("<STR_LIT>")<EOL>comp_ipv4_address = Combine(ipv4_oct + ('<STR_LIT:.>' + ipv4_oct*<NUM_LIT:3>))<EOL>ipv4_address = Combine(ipv4_oct + ('<STR_LIT:.>' + ipv4_oct*<NUM_LIT:3>)).setResultsName('<STR_LIT>')<EOL>ipv6_address = Regex("<STR_LIT>").setResultsName('<STR_LIT>')<EOL>ipv6_prefix = Combine(ipv6_address + Regex("<STR_LIT>")).setResultsName('<STR_LIT>')<EOL>vrf_rt = Combine((comp_ipv4_address | comp_number) + Literal('<STR_LIT::>') + comp_number).setResultsName('<STR_LIT>')<EOL>tags = Combine( Literal('<STR_LIT:#>') + comp_word).setResultsName('<STR_LIT>')<EOL>match_op = oneOf('<STR_LIT:U+0020>'.join(self.match_operators)).setResultsName('<STR_LIT>')<EOL>boolean_op = oneOf('<STR_LIT:U+0020>'.join(self.boolean_operators)).setResultsName('<STR_LIT>')<EOL>d_quoted_string = QuotedString('<STR_LIT:">', unquoteResults=True, escChar='<STR_LIT:\\>')<EOL>s_quoted_string = QuotedString('<STR_LIT>', unquoteResults=True, escChar='<STR_LIT:\\>')<EOL>quoted_string = (s_quoted_string | d_quoted_string).setResultsName('<STR_LIT>')<EOL>expression = Group(word + match_op + (quoted_string | vrf_rt | word | number)).setResultsName('<STR_LIT>')<EOL>atom = Group(ipv6_prefix | ipv6_address | quoted_string | expression | tags | vrf_rt | boolean_op | word)<EOL>enclosed = Forward()<EOL>parens = nestedExpr('<STR_LIT:(>', '<STR_LIT:)>', content=enclosed)<EOL>enclosed << (<EOL>parens | atom<EOL>).setResultsName('<STR_LIT>')<EOL>content = Forward()<EOL>content << (<EOL>ZeroOrMore(enclosed)<EOL>)<EOL>res = content.parseString(input_string)<EOL>return res<EOL>
Parse a smart search string and return it in an AST like form