matchcompiler: remove redundant variable 'neg' and do some minor reformatting
This commit is contained in:
parent
a198422f0e
commit
80cb350a6b
|
@ -105,9 +105,7 @@ class MatchCompiler:
|
||||||
elif tok == '%str%':
|
elif tok == '%str%':
|
||||||
return '(tok->tokType()==Token::eString)'
|
return '(tok->tokType()==Token::eString)'
|
||||||
elif tok == '%type%':
|
elif tok == '%type%':
|
||||||
return (
|
return '(tok->isName() && tok->varId()==0U && !tok->isKeyword())'
|
||||||
'(tok->isName() && tok->varId()==0U && !tok->isKeyword())'
|
|
||||||
)
|
|
||||||
elif tok == '%name%':
|
elif tok == '%name%':
|
||||||
return 'tok->isName()'
|
return 'tok->isName()'
|
||||||
elif tok == '%var%':
|
elif tok == '%var%':
|
||||||
|
@ -163,15 +161,12 @@ class MatchCompiler:
|
||||||
elif tok.find('|') > 0:
|
elif tok.find('|') > 0:
|
||||||
tokens2 = tok.split('|')
|
tokens2 = tok.split('|')
|
||||||
logicalOp = None
|
logicalOp = None
|
||||||
neg = None
|
|
||||||
if "" in tokens2:
|
if "" in tokens2:
|
||||||
ret += ' if (tok && ('
|
ret += ' if (tok && ('
|
||||||
logicalOp = ' || '
|
logicalOp = ' || '
|
||||||
neg = ''
|
|
||||||
else:
|
else:
|
||||||
ret += ' if (!tok || !('
|
ret += ' if (!tok || !('
|
||||||
logicalOp = ' || '
|
logicalOp = ' || '
|
||||||
neg = ''
|
|
||||||
first = True
|
first = True
|
||||||
for tok2 in tokens2:
|
for tok2 in tokens2:
|
||||||
if tok2 == '':
|
if tok2 == '':
|
||||||
|
@ -179,7 +174,7 @@ class MatchCompiler:
|
||||||
if not first:
|
if not first:
|
||||||
ret += logicalOp
|
ret += logicalOp
|
||||||
first = False
|
first = False
|
||||||
ret += neg + self._compileCmd(tok2)
|
ret += self._compileCmd(tok2)
|
||||||
|
|
||||||
if "" in tokens2:
|
if "" in tokens2:
|
||||||
ret += '))\n'
|
ret += '))\n'
|
||||||
|
|
Loading…
Reference in New Issue