diff --git a/README.md b/README.md index 5d293d2..307804f 100644 --- a/README.md +++ b/README.md @@ -75,13 +75,13 @@ $ bin/regexp -h # or --help ``` regexp -Usage: regexp [-h] [-V] [-g regexp [-o FILE]] [[-c] regexp string] +Usage: regexp [-h] [-V] {-g regexp [-o FILE] | [-c] regexp string} Description: Regular expression implementation. Supports . ( ) | * + ?. No escapes. Compiles to NFA and then simulates NFA using Thompson's algorithm. -One can either graph the regexp or match a string. +One can either match a string (default) or graph the regexp. See the following options. Notice that character # can't appear in the regular expression, it's reserved technically as the special character. @@ -90,6 +90,14 @@ Options: -h, --help Shows this help message and exit -V, --version Shows regexp version and exit +Match mode: + Matches the string with the regular expression, + exits with 1 if regexp is ill-formed or it does not match + + -c, --cache Caches NFA states to build DFA on the fly + regexp The regular expression to use on matching + string The string to be matched + Graph mode: Converts the regular expression into a graph, exits with 1 if regexp is ill-formed or the file can't be opened @@ -102,14 +110,6 @@ Graph mode: (default: nfa) regexp The regular expression to be converted -Match mode: - Matches the string with the regular expression, - exits with 1 if regexp is ill-formed or it does not match - - -c, --cache Caches NFA states to build DFA on the fly - regexp The regular expression to use on matching - string The string to be matched - Written by: Lai-YT regexp version: 1.0.2 diff --git a/src/messages.c b/src/messages.c index c82172c..2b66a0e 100644 --- a/src/messages.c +++ b/src/messages.c @@ -30,7 +30,7 @@ void help() { */ void usage() { fprintf(stdout, YELLOW "Usage: " NO_COLOR); - fprintf(stdout, "%s [-h] [-V] [-g regexp [-o FILE]] [[-c] regexp string]\n\n", + fprintf(stdout, "%s [-h] [-V] {-g regexp [-o FILE] | [-c] regexp string}\n\n", PROGRAM_NAME); } @@ -44,7 +44,7 @@ void description() { "Supports . ( ) | * + ?. No escapes.\n" "Compiles to NFA and then simulates NFA using Thompson's algorithm.\n" "\n" - "One can either graph the regexp or match a string.\n" + "One can either match a string (default) or graph the regexp.\n" "See the following options.\n" "Notice that character # can't appear in the regular expression,\n" "it's reserved technically as the special character.\n" @@ -91,8 +91,8 @@ void options() { " -V, --version Shows %s version and exit\n" "\n" NO_COLOR, PROGRAM_NAME); - graph_mode(); match_mode(); + graph_mode(); } /*