@@ -1684,27 +1684,30 @@ class Block:
1684
1684
found on the start line of the block between the square
1685
1685
brackets.
1686
1686
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
1689
1689
clinic.Function objects. At the moment it should
1690
1690
contain at most one of each.
1691
1691
1692
1692
output is either str or None. If str, it's the output
1693
1693
from this block, with embedded '\n' characters.
1694
1694
1695
- indent is either str or None . It's the leading whitespace
1695
+ indent is a str. It's the leading whitespace
1696
1696
that was found on every line of input. (If body_prefix is
1697
1697
not empty, this is the indent *after* removing the
1698
1698
body_prefix.)
1699
1699
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
1701
1703
was found in front of every line of input *before* the
1702
1704
"body_prefix" (see the Language object). If body_prefix
1703
1705
is empty, preindent must always be empty too.
1704
1706
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:
1708
1711
____#/*[python]
1709
1712
____#__for a in range(20):
1710
1713
____#____print(a)
@@ -1717,7 +1720,6 @@ class Block:
1717
1720
signatures : list [Module | Class | Function ] = dc .field (default_factory = list )
1718
1721
output : Any = None # TODO: Very dynamic; probably untypeable in its current form?
1719
1722
indent : str = ''
1720
- preindent : str = ''
1721
1723
1722
1724
def __repr__ (self ) -> str :
1723
1725
dsl_name = self .dsl_name or "text"
@@ -2049,12 +2051,8 @@ def dump(self) -> str:
2049
2051
return self .buffers .dump ()
2050
2052
2051
2053
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.
2055
2055
LangDict = dict [str , Callable [[str ], Language ]]
2056
-
2057
- languages = { 'C' : CLanguage , 'Python' : PythonLanguage }
2058
2056
extensions : LangDict = { name : CLanguage for name in "c cc cpp cxx h hh hpp hxx" .split () }
2059
2057
extensions ['py' ] = PythonLanguage
2060
2058
@@ -4427,7 +4425,6 @@ class DSLParser:
4427
4425
positional_only : bool
4428
4426
group : int
4429
4427
parameter_state : ParamState
4430
- seen_positional_with_default : bool
4431
4428
indent : IndentStack
4432
4429
kind : FunctionKind
4433
4430
coexist : bool
@@ -4458,7 +4455,6 @@ def reset(self) -> None:
4458
4455
self .positional_only = False
4459
4456
self .group = 0
4460
4457
self .parameter_state : ParamState = ParamState .START
4461
- self .seen_positional_with_default = False
4462
4458
self .indent = IndentStack ()
4463
4459
self .kind = CALLABLE
4464
4460
self .coexist = False
0 commit comments