aawadall / PyProjMan

Command-line Based Project Management Application written in Python
https://aawadall.github.io/PyProjMan/
MIT License
3 stars 1 forks source link

Parser for the Text UI #28

Open aawadall opened 6 years ago

aawadall commented 6 years ago

A new module is required to parse user input as text and map it into into API calls

burhania2 commented 6 years ago
 # TODO:
        if ':' in inp:
            sentence = inp.split(':')
        elif ';' in inp:
            sentence = inp.split(';')
        else:
            sentence = inp.split(' ')
        verb = sentence[0]
        noun = sentence[1::]
        # 1: split string into a verb and rest of string

would this work?

burhania2 commented 6 years ago

nvm you already have that section built

burhania2 commented 6 years ago

        # 3: slice input string into tokens; keywords and literals
        # literals identified by double quotes, single quotes or square brackets surrounding them
        if '"' in op_code:
            literal = op_code.split('"',2)
        elif "'" in op_code:
            literal = op_code.split("'",2)
        elif "[]" in op_code:
            literal = op_code.split('[').split(']')
aawadall commented 6 years ago

Yes, this portion is covered already what is pending is defining the syntax rules, and hopefully offloading it into the configuration file, such that a syntax rule is defined as a REGEX, followed by a pointer to the method/api call to invoke