[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Parsing shell-style config files



On 06/29/2012, Will Woods wrote:
> So here's my shellconfig.py, presented for comment / inspiration.
  [snip]
> Apparently, if you have an 'else:' block after 'for:', it gets executed
> if you 'break' out of the loop. Neat!

Yes, that part is useful and cute.

It would be helpful to give a URL which documents the syntax.
Also, please insert a comment with a table of special characters.  Such as:
   '\n'  (newline)  statement terminator
   #     (hash, sharp, pound)  introduces comment (to end of line)
   \     (backslash)  suppress special interpretation of next character
   "     (double quote)  forces interpretation as character string (not as number)
Also, please mention shell syntax which appears to be omitted.  Such as:
   ;     (semicolon)  statement separator [thus only one statement per line]
   $     (dollar)  lookup and expand previous key
   '     (single quote)  start character string which suppresses interpretation of $

It seems to me that there may be some rough edges:
   No error detection, no error or warning messages:
     Unterminated double quote [except by EndOfLine]
     No newline at EndOfFile [often because of emacs editing]
   Continuation lines (backslash newline: yes or no?; line length restrictions?).
   Cannot have '#' in a string (comment takes precedence).
These also deserve comment (for maintenance, to set expectations.)

Python's lack of an equivalent to LISP "(read)" [namely: runtime operator
which converts from character string into language] surely is a handicap.

-- 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]