Home | Trees | Indices | Help |
|
---|
|
object --+ | Token
Part of a command representing a syntactic token.
The top of the token class hierarchy. Subclasses need to implement methods defined here.
Additionally, subclasses may wish to override these class variables:
commencer_ch = None # Character indicating the start of the token dquotable = False # True to permit the token within double quotes.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
commencer_ch = None hash(x) |
|||
dquotable = False
|
|
|||
Inherited from |
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
Return the raw text entered by the user. There is no default implementation of this method.
|
Modify this token by replacing the text between begin and end with the given text. begin defaults to the beginning of the token, end to the end, and txt to the empty string. Returns a 3-tuple:
The default implementation checks the insertion range, raising an exception in case of error, but does not perform the actual modify. |
Return the expanded version of this token. Return value is a list of strings in which any special shell syntax is replaced with its expanded value, appropriate for passing as an arg in a process invocation. Arg tokens will perform glob expansion on the results of this value, so other tokens should protect their response using escape_glob_chars() if appropriate. The default implementation returns an array with one element containing the raw token. |
Return a list of completions for this token from the specified cursor location. If no possible completions exist, [] is returned. If possible completions exist, a list of strings is returned. The first item is the root of the completions, the rest are possible extensions of the root. Most tokens will return None if the cursor is not at the end. The default implementation returns nothing. |
Return the list of directives which are expanded from this token. The HashDirective token will return something here, but most other tokens use the default implementation which returns an empty list. |
Return True if the beginning of the provided text can validly start this token. The default implementation returns True iff txt matches the regexp self.commencer. The default value of self.commencer is \S to match non-whitespace. |
Return a pair of strings if the first character of the provided text would terminate this token. The first string are the characters to be included in the token, the second are the characters which spill over to the next token. Return None if the text would not terminate the token. The token mustn't end in an escape character (\) because that would make the test incorrect. The default implementation matches txt against the regexp self.terminator. On a match it returns match groups 1 and 2, otherwise it returns None. The default value of self.terminator is ()(\s) to terminate on whitespace, but not accept it. |
Return True if this token will not accept any more characters at the end because it has terminated. The default implementation returns False. |
Return a representation of the token tree as a list of strings. The default implementation returns an empty list. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Dec 14 22:46:37 2010 | http://epydoc.sourceforge.net |