parent
b2f95d6241
commit
81014cc0c2
1 changed files with 22 additions and 21 deletions
|
@ -2394,38 +2394,39 @@ to be called on their own".format(filename, num))
|
|||
# this here rather than hack_syntax so the character can be
|
||||
# recognized.
|
||||
if macname == 'LOYAL_UNIT':
|
||||
(args, optional_args, brack, paren) = parse_macroref(0, leadmac.string)
|
||||
if len(args) == 7:
|
||||
(args, optional_args, is_unfinished) = parse_macroref(0, leadmac.string)
|
||||
if len(args) == 6:
|
||||
lines[i] = lines[i].replace('{LOYAL_UNIT', '{NAMED_LOYAL_UNIT', 1)
|
||||
# Auto-recognize the people in the {NAMED_*UNIT} macros.
|
||||
if re.match(r'NAMED_[A-Z_]*UNIT$', macname):
|
||||
(args, optional_args, brack, paren) = parse_macroref(0, leadmac.string)
|
||||
if len(args) >= 7 and \
|
||||
re.match(r'([0-9]+|[^\s]*\$[^\s]*side[^\s]*|{[^\s]*SIDE[^\s]*})$', args[1]) and \
|
||||
re.match(r'([0-9]+|[^\s]*\$[^\s]*x[^\s]*|{[^\s]*X[^\s]*})$', args[3]) and \
|
||||
re.match(r'([0-9]+|[^\s]*\$[^\s]*y[^\s]*|{[^\s]*Y[^\s]*})$', args[4]) and \
|
||||
len(args[5]) > 0:
|
||||
present.append(args[5])
|
||||
(args, optional_args, is_unfinished) = parse_macroref(0, leadmac.string)
|
||||
if len(args) >= 6 and \
|
||||
re.match(r'([0-9]+|[^\s]*\$[^\s]*side[^\s]*|{[^\s]*SIDE[^\s]*})$', args[0]) and \
|
||||
re.match(r'([0-9]+|[^\s]*\$[^\s]*x[^\s]*|{[^\s]*X[^\s]*})$', args[2]) and \
|
||||
re.match(r'([0-9]+|[^\s]*\$[^\s]*y[^\s]*|{[^\s]*Y[^\s]*})$', args[3]) and \
|
||||
len(args[4]) > 0:
|
||||
present.append(args[4])
|
||||
elif macname == 'RECALL':
|
||||
(args, optional_args, brack, paren) = parse_macroref(0, leadmac.string)
|
||||
if len(args) == 2 and brack == 0:
|
||||
present.append(args[1])
|
||||
(args, optional_args, is_unfinished) = parse_macroref(0, leadmac.string)
|
||||
if len(args) == 1 and not is_unfinished:
|
||||
present.append(args[0])
|
||||
elif macname == 'RECALL_XY':
|
||||
(args, optional_args, brack, paren) = parse_macroref(0, leadmac.string)
|
||||
if len(args) == 4:
|
||||
present.append(args[1])
|
||||
(args, optional_args, is_unfinished) = parse_macroref(0, leadmac.string)
|
||||
if len(args) == 3:
|
||||
present.append(args[0])
|
||||
elif macname == 'CLEAR_VARIABLE':
|
||||
(args, optional_args, brack, paren) = parse_macroref(0, leadmac.string)
|
||||
(args, optional_args, is_unfinished) = parse_macroref(0, leadmac.string)
|
||||
# having CLEAR_VARIABLE on a line and its arguments in the following lines
|
||||
# leads to an args list with length 1
|
||||
# leads to an args list with length 0
|
||||
# skip the check and avoid a crash if that's the case
|
||||
if len(args) > 1:
|
||||
for arg in [x.lstrip() for x in args[1].split(',')]:
|
||||
if len(args) > 0:
|
||||
for arg in [x.lstrip() for x in args[0].split(',')]:
|
||||
if arg in storedids:
|
||||
del storedids[arg]
|
||||
elif macname in whomacros:
|
||||
(args, optional_args, brack, paren) = parse_macroref(0, leadmac.string)
|
||||
present.append(args[whomacros[macname]])
|
||||
(args, optional_args, is_unfinished) = parse_macroref(0, leadmac.string)
|
||||
if len(args) >= whomacros[macname]:
|
||||
present.append(args[whomacros[macname] - 1])
|
||||
m = re.search("# *wmllint: recognize +(.*)", lines[i])
|
||||
if m:
|
||||
present.append(string_strip(m.group(1)).strip())
|
||||
|
|
Loading…
Add table
Reference in a new issue