Arcades

Class Parser

Argument parser class.

Declare arguments used by ARCADES.

Info:
  • __init ()

    Default constructor

Public Methods

keyboard_arrow_up
  • parse ( arg )

    Actually parse arg

    Parameters:
    • string arg
      Arguments string to parse
    Returns:

Private Methods

keyboard_arrow_up
  • _add_elements ( elements )

    Add elements from a table to the parser.

    There are 3 different element type:

    • text which is just displayed in the usage description;
    • option that is the top level option (it must be preceded by a dash);
    • field if it is a suboption that is contained in a table.

    Text elements are of the form:
    {"text", "my very useful piece of text"}

    Option and field elements are of the form:
    {"option"|"field", "option_name", default value, "Description", "type"}

    Parameters:
    • table elements
      A table representing the element.
  • _format ( description, input )

    Parse a string in depth.

    Given the description of the arguments and the actual parsing result, it will go deeper, casting string to the right type. This function works recursivelly.

    Parameters:
    • table description
      The description of the arguments
    • table input
      Result of the previous parsing
    Returns:
    • table input parsed according to the description