![]() We should update the fuzz test so those don't count as failures any more. This is looking good! I agree we can ignore most of those failures of the fuzz test (not sure about what we should do for '.' see end). ‘.’ gets converted to Ellipsis when passed to AST.There are two other test cases where failure is declared (again, due to high edit distances), but I think they can be ignored: However, we were unsure about which behavior is more appropriate. Again, this can be easily avoided by checking whether we are currently in a container or not. So many additions leads to a high edit distance between the input and output strings, hence the failure. Here, because of the comma in between, our implementation treats it as two different elements, and when passed to AST, it converts it into a tuple. Now, as I had mentioned earlier, we fail test cases of a specific type in fuzz tests, one example of which is: Adding space to the delimiter set ensures that variable spaces added by the user are taken care of. Our general delimiter set consists of a comma (,), a space (‘ ’) and all possible closing braces (‘)’, ‘}’, ‘]’). Now, we pass this ‘literal’ element to AST, and only when AST identifies it as a string, we add quotes around it (numerals, booleans are thus safe). In that case, we move to the first delimiter that we find after it (this denotes the end of the element). The argument is a literal (or a string with quotes stripped).Our implementation covers both single and triple quoted strings. The argument is a string with quotes intact (different shells strip quotes differently, we found, hence this case.) In this case, we directly continue parsing from the closing quotes.To know whether we are currently inside a dictionary, we use a stack. In the case of dictionaries, we start considering the colon (:) as a delimiter as well. In that case, ignore the braces, and perform the check again. To summarize: We parse the argument by dividing it into one of the three major cases: Here’s a rough flowchart for our implementation: Drive Link ![]() I can send over a flowchart and pseudocode so that you can get a clearer picture of what I’m talking about (we made these as part of our uni project).ĭo let us know what you think of this Thanks for your prompt reply! Our current implementation passes parser_test.py easily, and with the exception of 1 type of case (which needs some discussion), parser_fuzz_test.py as well. This takes care of all special characters, including hyphens, that occur in arguments. When the identified element is further identified as a String (we still rely on AST for this purpose), we put back the stripped quotes around it. What we try to do instead, is perform this identification of individual elements manually, by considering some general delimiters (take for example, when in a list, a comma (,) when not in a string, generally denotes a demarcation between two elements). iter_fields( node):įor index, subchild in enumerate( child):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |