Franck Pommereau

doc converted

...@@ -41,7 +41,7 @@ class Token (str) : ...@@ -41,7 +41,7 @@ class Token (str) :
41 non-mutable object and this __init__ could not assign a str 41 non-mutable object and this __init__ could not assign a str
42 content. For more information see: 42 content. For more information see:
43 43
44 - http://docs.python.org/reference/datamodel.html#object.__new__ 44 + http://docs.python.org/reference/datamodel.html#object.__new__
45 """ 45 """
46 kind = token[0] 46 kind = token[0]
47 text = token[1] 47 text = token[1]
...@@ -196,10 +196,8 @@ class Tokenizer (object) : ...@@ -196,10 +196,8 @@ class Tokenizer (object) :
196 - skip: a collection of tokens that the tokenizer will 196 - skip: a collection of tokens that the tokenizer will
197 automatically skip (default to [COMMENT, NL]) 197 automatically skip (default to [COMMENT, NL])
198 - additional keywords arguments allow to define new tokens, 198 - additional keywords arguments allow to define new tokens,
199 - for instance, providing 199 + for instance, providing DOLLAR='$' defines a new token
200 - DOLLAR='$' 200 + called 'DOLLAR' (its kind will be automatically computed)
201 - defines a new token called 'DOLLAR' (its kind will be
202 - automatically computed)
203 201
204 An instance of Tokenizer has the following attributes: 202 An instance of Tokenizer has the following attributes:
205 - self.opmap: a dict mapping operators token literals to the 203 - self.opmap: a dict mapping operators token literals to the
......
...@@ -17,13 +17,16 @@ def interleave(inter, f, seq): ...@@ -17,13 +17,16 @@ def interleave(inter, f, seq):
17 f(x) 17 f(x)
18 18
19 class Unparser: 19 class Unparser:
20 - """Methods in this class recursively traverse an AST and 20 + """Methods in this class recursively traverse an AST and output
21 - output source code for the abstract syntax; original formatting 21 + source code for the abstract syntax; original formatting is
22 - is disregarged. """ 22 + disregarged.
23 + """
23 24
24 def __init__(self, tree, file = sys.stdout): 25 def __init__(self, tree, file = sys.stdout):
25 """Unparser(tree, file=sys.stdout) -> None. 26 """Unparser(tree, file=sys.stdout) -> None.
26 - Print the source for tree to file.""" 27 +
28 + Print the source for tree to file.
29 + """
27 self.f = file 30 self.f = file
28 self._indent = 0 31 self._indent = 0
29 self.dispatch(tree) 32 self.dispatch(tree)
...@@ -31,7 +34,9 @@ class Unparser: ...@@ -31,7 +34,9 @@ class Unparser:
31 self.f.flush() 34 self.f.flush()
32 35
33 def fill(self, text = ""): 36 def fill(self, text = ""):
34 - "Indent a piece of text, according to the current indentation level" 37 + """Indent a piece of text, according to the current indentation
38 + level
39 + """
35 self.f.write("\n" + " "*self._indent + text) 40 self.f.write("\n" + " "*self._indent + text)
36 41
37 def write(self, text): 42 def write(self, text):
......
This diff is collapsed. Click to expand it.