2023-11-18 18:56:26 +00:00
|
|
|
#ifndef L_PAREN
|
|
|
|
# define L_PAREN '['
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef R_PAREN
|
|
|
|
# define R_PAREN ']'
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* psops(1) arguments are flanked by { '[', '\0' } and { ']', '\0' }. Nesting
|
|
|
|
* is allowed to facilitate nesting of psops(1) programs. This checks to make
|
|
|
|
* sure grouping symbols in args are balanced.
|
|
|
|
* args is the argv that was passed to main, incremented (so args[1] is "[").
|
2022-11-21 01:23:39 +00:00
|
|
|
* Returns 0 in the events of a syntax error or there being no arguments.
|
|
|
|
* Otherwise, returns the number of top-level right grouping arguments
|
|
|
|
* (i.e. the number of terms). */
|
2023-11-18 18:56:26 +00:00
|
|
|
int check_arg(char **args);
|
2022-11-21 01:23:39 +00:00
|
|
|
|
|
|
|
/* arg is the location of the argument with the left grouping symbol within
|
2023-11-18 18:56:26 +00:00
|
|
|
* argv.
|
2022-11-21 01:23:39 +00:00
|
|
|
* Returns the location of the argument with the corresponding left grouping
|
|
|
|
* symbol within argv. */
|
2023-11-18 18:56:26 +00:00
|
|
|
char **corresponding_arg(char **arg);
|