• Home
  • Raw
  • Download

Lines Matching refs:shlex

1 :mod:`shlex` --- Simple lexical analysis
4 .. module:: shlex
14 **Source code:** :source:`Lib/shlex.py`
19 The :class:`~shlex.shlex` class makes it easy to write lexical analyzers for
26 The :mod:`shlex` module defines the following functions:
33 (setting the :attr:`~shlex.commenters` attribute of the
34 :class:`~shlex.shlex` instance to the empty string). This function operates
45 Since the :func:`split` function instantiates a :class:`~shlex.shlex`
49 The :mod:`shlex` module defines the following class:
52 .. class:: shlex([instream[, infile[, posix]]])
54 A :class:`~shlex.shlex` instance or subclass instance is a lexical analyzer
60 filename string, which sets the initial value of the :attr:`~shlex.infile`
64 not true (default), the :class:`~shlex.shlex` instance will operate in
65 compatibility mode. When operating in POSIX mode, :class:`~shlex.shlex`
77 shlex Objects
80 A :class:`~shlex.shlex` instance has the following methods:
83 .. method:: shlex.get_token()
91 .. method:: shlex.push_token(str)
96 .. method:: shlex.read_token()
103 .. method:: shlex.sourcehook(filename)
105 When :class:`~shlex.shlex` detects a source request (see :attr:`source`
124 corresponding 'close' hook, but a shlex instance will call the
132 .. method:: shlex.push_source(stream[, filename])
141 .. method:: shlex.pop_source()
149 .. method:: shlex.error_leader([file[, line]])
156 This convenience is provided to encourage :mod:`shlex` users to generate error
160 Instances of :class:`~shlex.shlex` subclasses have some public instance
164 .. attribute:: shlex.commenters
171 .. attribute:: shlex.wordchars
177 .. attribute:: shlex.whitespace
183 .. attribute:: shlex.escape
191 .. attribute:: shlex.quotes
198 .. attribute:: shlex.escapedquotes
207 .. attribute:: shlex.whitespace_split
210 example, for parsing command lines with :class:`~shlex.shlex`, getting
216 .. attribute:: shlex.infile
223 .. attribute:: shlex.instream
225 The input stream from which this :class:`~shlex.shlex` instance is reading
229 .. attribute:: shlex.source
241 .. attribute:: shlex.debug
243 If this attribute is numeric and ``1`` or more, a :class:`~shlex.shlex`
248 .. attribute:: shlex.lineno
253 .. attribute:: shlex.token
258 .. attribute:: shlex.eof
271 When operating in non-POSIX mode, :class:`~shlex.shlex` will try to obey to the
285 * If :attr:`~shlex.whitespace_split` is ``False``, any character not
287 a single-character token. If it is ``True``, :class:`~shlex.shlex` will only
294 When operating in POSIX mode, :class:`~shlex.shlex` will try to obey to the
304 :attr:`~shlex.escapedquotes` (e.g. ``"'"``) preserve the literal value
308 :attr:`~shlex.escapedquotes` (e.g. ``'"'``) preserves the literal value
310 mentioned in :attr:`~shlex.escape`. The escape characters retain its