@@ -1684,27 +1684,30 @@ class Block:
16841684 found on the start line of the block between the square
16851685 brackets.
16861686
1687- signatures is either list or None. If it's a list,
1688- it may only contain clinic.Module, clinic.Class, and
1687+ signatures is a list.
1688+ It may only contain clinic.Module, clinic.Class, and
16891689 clinic.Function objects. At the moment it should
16901690 contain at most one of each.
16911691
16921692 output is either str or None. If str, it's the output
16931693 from this block, with embedded '\n' characters.
16941694
1695- indent is either str or None . It's the leading whitespace
1695+ indent is a str. It's the leading whitespace
16961696 that was found on every line of input. (If body_prefix is
16971697 not empty, this is the indent *after* removing the
16981698 body_prefix.)
16991699
1700- preindent is either str or None. It's the whitespace that
1700+ "indent" is different from the concept of "preindent"
1701+ (which is not stored as state on Block objects).
1702+ "preindent" is the whitespace that
17011703 was found in front of every line of input *before* the
17021704 "body_prefix" (see the Language object). If body_prefix
17031705 is empty, preindent must always be empty too.
17041706
1705- To illustrate indent and preindent: Assume that '_'
1706- represents whitespace. If the block processed was in a
1707- Python file, and looked like this:
1707+ To illustrate the difference between "indent" and "preindent":
1708+
1709+ Assume that '_' represents whitespace.
1710+ If the block processed was in a Python file, and looked like this:
17081711 ____#/*[python]
17091712 ____#__for a in range(20):
17101713 ____#____print(a)
@@ -1717,7 +1720,6 @@ class Block:
17171720 signatures : list [Module | Class | Function ] = dc .field (default_factory = list )
17181721 output : Any = None # TODO: Very dynamic; probably untypeable in its current form?
17191722 indent : str = ''
1720- preindent : str = ''
17211723
17221724 def __repr__ (self ) -> str :
17231725 dsl_name = self .dsl_name or "text"
@@ -2049,12 +2051,8 @@ def dump(self) -> str:
20492051 return self .buffers .dump ()
20502052
20512053
2052- # maps strings to Language objects.
2053- # "languages" maps the name of the language ("C", "Python").
2054- # "extensions" maps the file extension ("c", "py").
2054+ # "extensions" maps the file extension ("c", "py") to Language classes.
20552055LangDict = dict [str , Callable [[str ], Language ]]
2056-
2057- languages = { 'C' : CLanguage , 'Python' : PythonLanguage }
20582056extensions : LangDict = { name : CLanguage for name in "c cc cpp cxx h hh hpp hxx" .split () }
20592057extensions ['py' ] = PythonLanguage
20602058
@@ -4427,7 +4425,6 @@ class DSLParser:
44274425 positional_only : bool
44284426 group : int
44294427 parameter_state : ParamState
4430- seen_positional_with_default : bool
44314428 indent : IndentStack
44324429 kind : FunctionKind
44334430 coexist : bool
@@ -4458,7 +4455,6 @@ def reset(self) -> None:
44584455 self .positional_only = False
44594456 self .group = 0
44604457 self .parameter_state : ParamState = ParamState .START
4461- self .seen_positional_with_default = False
44624458 self .indent = IndentStack ()
44634459 self .kind = CALLABLE
44644460 self .coexist = False
0 commit comments