Lines Matching refs:line

117         add(" on line " + str(line_number))
171 for line in s.split('\n'):
172 add(line.rstrip())
188 themselves. (This line is the "source line".)
189 * If the substitution text is empty, the source line
191 * If the field is not recognized, the original line
194 * Each line of the substituted text is indented
195 by the indent of the source line.
200 for line in s.split('\n'):
201 indent, curly, trailing = line.partition('{')
203 add(line)
209 add(line)
214 fail("Text found after {" + name + "} block marker! It must be on a line by itself.")
216 fail("Non-whitespace characters found before {" + name + "} block marker! It must be on a line by itself.")
232 If the last line is empty, prefix is not prepended
240 for line in split:
242 final.append(line)
253 If the last line is empty, suffix is not appended
259 for line in split:
260 final.append(line)
392 def parse_line(self, line):
423 line = getattr(self, attr)
425 fcf.format(line)
524 line = lines[0]
525 if line.strip():
536 * dedents so the first nonwhite character on any line is at column "indent"
549 It views a declaration line as looking like this:
551 If called with length=30, it would wrap that line into
562 for line in text.split('\n'):
563 prefix, _, after_l_paren = line.partition('(')
565 lines.append(line)
569 lines.append(line)
572 lines.append(line)
582 line = prefix
586 (len(line) + len(parameters[0]) > length)):
588 line += parameters.pop(0)
591 line = line.rstrip(", ") + ")" + after_r_paren
592 lines.append(line.rstrip())
611 def parse_line(self, line):
612 self.cpp.writeline(line)
629 for line in f.docstring.split('\n'):
631 add(quoted_for_c_string(line))
635 # If we only have a signature, add the blank line that the
1511 found on the start line of the block between the square
1523 that was found on every line of input. (If body_prefix is
1528 was found in front of every line of input *before* the
1611 def is_start_line(self, line):
1612 match = self.start_re.match(line.lstrip())
1617 line = self.input.pop()
1619 self.language.parse_line(line)
1620 return line
1627 line = self._line()
1628 dsl_name = self.is_start_line(line)
1632 add(line)
1642 def is_stop_line(line):
1643 # make sure to recognize stop line even if it
1645 if line.startswith(stop_line):
1646 remainder = line[len(stop_line):]
1648 fail(f"Garbage after stop line: {remainder!r}")
1652 if line.lstrip().startswith(stop_line):
1653 fail(f"Whitespace is not allowed before the stop line: {line!r}")
1658 line = self._line()
1659 if is_stop_line(line) or self.is_start_line(line):
1662 line = line.lstrip()
1663 assert line.startswith(body_prefix)
1664 line = line[len(body_prefix):]
1665 input_add(line)
1667 # consume output and checksum line, if present.
1677 # scan forward for checksum line
1681 line = self._line(lookahead=True)
1682 match = checksum_re.match(line.lstrip())
1686 output_add(line)
1687 if self.is_start_line(line):
1696 fail("Mangled Argument Clinic marker line: {!r}".format(line))
1749 for line in input.split('\n'):
1751 write(line)
1993 for line in self.presets_text.strip().split('\n'):
1994 line = line.strip()
1995 if not line:
1997 name, value, *options = line.split()
2300 * embedded line breaks
3801 line = '{} &&\n '.format(type_check)
3802 template_dict['self_type_check'] = line
3843 line = []
3844 add = line.append
3849 data.declarations.append(''.join(line))
3974 def measure(self, line):
3976 Returns the length of the line's margin.
3978 if '\t' in line:
3980 stripped = line.lstrip()
3982 # we can't tell anything from an empty line
3986 return len(line) - len(stripped)
3988 def infer(self, line):
3990 Infer what is now the current margin based on this line.
3996 indent = self.measure(line)
4027 def indent(self, line):
4029 Indents a line by the currently defined margin.
4031 return self.margin + line
4033 def dedent(self, line):
4035 Dedents a line by the currently defined margin.
4040 if not line.startswith(margin):
4041 fail('Cannot dedent, line does not start with the previous margin:')
4042 return line[indent:]
4206 for line_number, line in enumerate(lines, self.clinic.block_parser.block_start_line_number):
4207 if '\t' in line:
4208 fail('Tab characters are illegal in the Clinic DSL.\n\t' + repr(line), line_number=block_start)
4209 self.state(line)
4222 def ignore_line(line):
4224 if line.lstrip().startswith('#'):
4229 if not line.strip():
4235 def calculate_indent(line):
4236 return len(line) - len(line.strip())
4238 def next(self, state, line=None):
4239 # real_print(self.state.__name__, "->", state.__name__, ", line=", line)
4241 if line is not None:
4242 self.state(line)
4244 def state_dsl_start(self, line):
4246 if self.ignore_line(line):
4250 fields = shlex.split(line)
4260 self.next(self.state_modulename_name, line)
4262 def state_modulename_name(self, line):
4264 # line should be
4276 # this line is permitted to start with whitespace.
4279 if not line.strip():
4282 self.indent.infer(line)
4285 before, equals, existing = line.rpartition('=')
4322 line, _, returns = line.partition('->')
4324 full_name, _, c_basename = line.partition(' as ')
4397 # * The first line must be a parameter declaration.
4398 # * The first line must be indented.
4399 # * This first line establishes the indent for parameters.
4410 # * It's illegal to have a line starting with a number of spaces X
4412 # * A line with < P spaces is the first line of the function
4415 # * The first line of the function docstring must be at the same
4417 # * It's illegal to have any line in the parameters section starting
4448 # [ [ a, b, ] c, ] d, e, f=3, [ g, h, [ i ] ] <- line
4463 def state_parameters_start(self, line):
4464 if self.ignore_line(line):
4467 # if this line is not indented, we have no parameters
4468 if not self.indent.infer(line):
4469 return self.next(self.state_function_docstring, line)
4472 return self.next(self.state_parameter, line)
4484 def state_parameter(self, line):
4486 line = self.parameter_continuation + ' ' + line.lstrip()
4489 if self.ignore_line(line):
4493 indent = self.indent.infer(line)
4496 return self.next(self.state_function_docstring, line)
4500 return self.next(self.state_parameter_docstring_start, line)
4502 line = line.rstrip()
4503 if line.endswith('\\'):
4504 self.parameter_continuation = line[:-1]
4507 line = line.lstrip()
4509 if line in ('*', '/', '[', ']'):
4510 self.parse_special_symbol(line)
4527 name, have_as_token, trailing = line.partition(' as ')
4539 line = ' '.join(fields)
4541 base, equals, default = line.rpartition('=')
4556 ast_input = "def x({}): pass".format(line)
4561 fail("Function " + self.function.name + " has an invalid parameter declaration:\n\t" + line)
4566 fail("Function " + self.function.name + " has an invalid parameter declaration (comma?):\n\t" + line)
4568 fail("Function " + self.function.name + " has an invalid parameter declaration (default value?):\n\t" + line)
4570 fail("Function " + self.function.name + " has an invalid parameter declaration (**kwargs?):\n\t" + line)
4825 def state_parameter_docstring_start(self, line):
4828 return self.next(self.state_parameter_docstring, line)
4830 # every line of the docstring must start with at least F spaces,
4833 def state_parameter_docstring(self, line):
4834 stripped = line.strip()
4838 indent = self.indent.measure(line)
4840 self.indent.infer(line)
4844 return self.next(self.state_parameter, line)
4846 return self.next(self.state_function_docstring, line)
4856 new_docstring += self.indent.dedent(line)
4861 def state_function_docstring(self, line):
4865 stripped = line.strip()
4873 line = self.indent.dedent(line).rstrip()
4875 line = ''
4876 new_docstring += line
4891 ## docstring first line
5082 lines = [line.rstrip() for line in docstring.split('\n')]
5084 # Enforce the summary line!
5085 # The first line of a docstring should be a summary of the function.
5086 # It should fit on one line (80 columns? 79 maybe?) and be a paragraph
5091 # * or it must have a summary line.
5098 fail("Docstring for " + f.full_name + " does not have a summary line!\n" +
5100 "a single line summary followed by an empty line.")
5102 # the docstring is only one line right now--the summary line.
5103 # add an empty line after the summary line so we have space
5112 # insert after summary line
5128 def state_terminal(self, line):
5132 assert not line