mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
Generalize the last change to check for other markup spacing errors.
This commit is contained in:
parent
b9c07af46c
commit
c60577ea59
1 changed files with 4 additions and 4 deletions
|
@ -99,7 +99,7 @@ def checkit(source, opts, morecmds=[]):
|
||||||
delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])')
|
delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])')
|
||||||
braces = re.compile(r'({)|(})')
|
braces = re.compile(r'({)|(})')
|
||||||
doubledwords = re.compile(r'(\b[A-za-z]+\b) \b\1\b')
|
doubledwords = re.compile(r'(\b[A-za-z]+\b) \b\1\b')
|
||||||
nullmarkup = re.compile(r'\NULL(?!\{\})')
|
spacingmarkup = re.compile(r'\\(ABC|ASCII|C|Cpp|EOF|infinity|NULL|plusminus|POSIX|UNIX)\s')
|
||||||
|
|
||||||
openers = [] # Stack of pending open delimiters
|
openers = [] # Stack of pending open delimiters
|
||||||
bracestack = [] # Stack of pending open braces
|
bracestack = [] # Stack of pending open braces
|
||||||
|
@ -152,9 +152,9 @@ def checkit(source, opts, morecmds=[]):
|
||||||
if '\\' + cmd in validcmds:
|
if '\\' + cmd in validcmds:
|
||||||
print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd)
|
print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd)
|
||||||
|
|
||||||
# Check for bad markup
|
# Check for markup requiring {} for correct spacing
|
||||||
if nullmarkup.search(line):
|
for cmd in spacingmarkup.findall(line):
|
||||||
print r'Warning, \NULL should be written as \NULL{} on line %d' % (lineno,)
|
print r'Warning, \%s should be written as \%s{} on line %d' % (cmd, cmd, lineno)
|
||||||
|
|
||||||
# Validate commands
|
# Validate commands
|
||||||
nc = line.find(r'\newcommand')
|
nc = line.find(r'\newcommand')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue