From 1a83213a40b30852826e002cb55aa465d59eef32 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Sat, 5 Jan 2019 00:45:25 +0100 Subject: [PATCH] Explain the states in the argument parser --- run-tests.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/run-tests.py b/run-tests.py index 872bb60..88785e5 100755 --- a/run-tests.py +++ b/run-tests.py @@ -71,13 +71,20 @@ def parseArgs(s): args = [] # States - Space = 0 - SBackslash = 1 - Normal = 2 - NBackslash = 3 - DQuote = 4 - DQBackslash = 5 - SQuote = 6 + Space = 0 # Space between args. + SBackslash = 1 # Backslash after space. Returns to Space if followed + # by LF, otherwise inserts the character verbatim and + # goes to Normal. + Normal = 2 # Normal argument. + NBackslash = 3 # Backslash in Normal mode. Returns to Normal if + # followed by LF, otherwise inserts the character + # verbatim. + DQuote = 4 # Double quote mode. + DQBackslash = 5 # Backslash in double quote mode. Returns to DQuote if + # followed by LF; inserts the character verbatim if + # followed by '"', '`', '$' or '\' and inserts a '\' + # plus the character verbatim in any other case. + SQuote = 6 # Single quote mode. State = Space p = 0