Package hsh :: Module command
[hide private]
[frames] | no frames]

Module command

Classes [hide private]
  ParseException
Raised when there's an error in parsing.
  Token
Part of a command representing a syntactic token.
  AggregateToken
  LeafToken
  CommandToken
  ArgOrProg
  Arg
  Prog
Prog specifies what to run.
  HashDirective
A directive to the shell about how to launch the job, identified by a leading # character.
  ArgSeparator
  RawText
  SingleQuotedToken
  DoubleQuote
A leaf token which contains a single double quote character.
  DoubleQuotedText
The text between the double quotes, may include whitespace characters.
  DoubleQuotedToken
Text enclosed in double quotes.
  BracedToken
Super class for tokens which can be enclosed in braces, after a commencing character like $ or ~.
  EnvVariable
An environment variable reference, starting with a $, with optional braces {}.
  NamedDir
A named directory reference, starting with a ~, with optional braces {}.
  JobReference
A reference to some feature of a job, starting with a % and optionally using braces to surround the value.
Functions [hide private]
 
escape_glob_chars(text)
Given a string, return a version of it with the special glob characters escaped.
 
format_cmd(args)
Given a list of strings format them to be readable when printed.
Variables [hide private]
  glob_match = re.compile(r'(^|[^\\])(\\\\)*([\*\?\[\]])')
  glob_chars = re.compile(r'([\*\?\[\]])')
  glob_chars_slash = re.compile(r'([\*\?\[\]\\])')
  unescaper_nonglobs = re.compile(r'(?x)\\??([^\*\?\[\]\\]|\\[\*...
  unescaper = re.compile(r'\\(.)')
  whitespace = re.compile(r'\s')
  arg_subtoks = [<class 'hsh.command.SingleQuotedToken'>, <class...
  commencers = '\'"$~%'
  arg_subtoks_dq = [<class 'hsh.command.EnvVariable'>, <class 'h...
  commencers_dq = '$~%'
  __package__ = 'hsh'
Function Details [hide private]

escape_glob_chars(text)

 

Given a string, return a version of it with the special glob characters escaped. Backslashes are also escaped to prevent ambiguity.


Variables Details [hide private]

unescaper_nonglobs

Value:
re.compile(r'(?x)\\??([^\*\?\[\]\\]|\\[\*\?\[\]\\]|$)')

arg_subtoks

Value:
[<class 'hsh.command.SingleQuotedToken'>,
 <class 'hsh.command.DoubleQuotedToken'>,
 <class 'hsh.command.EnvVariable'>,
 <class 'hsh.command.NamedDir'>,
 <class 'hsh.command.JobReference'>]

arg_subtoks_dq

Value:
[<class 'hsh.command.EnvVariable'>,
 <class 'hsh.command.NamedDir'>,
 <class 'hsh.command.JobReference'>]