mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Rename _ops to _toks to eliminate ambiguity and facilitate a future merge.
This commit is contained in:
parent
62904dc02c
commit
ed4b963356
1 changed files with 8 additions and 8 deletions
|
@ -121,12 +121,12 @@ class EInternal(Exception):
|
|||
pass
|
||||
|
||||
class parser(object):
|
||||
assignment_ops = frozenset(('=', '+=', '-=', '*=', '/=', '%='))
|
||||
extassignment_ops = frozenset(('|=', '&=', '^=', '<<=', '>>='))
|
||||
assignment_toks = frozenset(('=', '+=', '-=', '*=', '/=', '%='))
|
||||
extassignment_toks = frozenset(('|=', '&=', '^=', '<<=', '>>='))
|
||||
|
||||
double_ops = frozenset(('++', '--', '+=', '-=', '*=', '/=', '%=', '==',
|
||||
double_toks = frozenset(('++', '--', '+=', '-=', '*=', '/=', '%=', '==',
|
||||
'!=', '>=', '<=', '&&', '||', '<<', '>>'))
|
||||
extdouble_ops = frozenset(('|=', '&=', '^='))
|
||||
extdouble_toks = frozenset(('|=', '&=', '^='))
|
||||
|
||||
# These are hardcoded because additions or modifications imply
|
||||
# important changes to the code anyway.
|
||||
|
@ -419,8 +419,8 @@ class parser(object):
|
|||
|
||||
return ('INTEGER_VALUE', number)
|
||||
|
||||
if self.script[self.pos-1:self.pos+1] in self.double_ops \
|
||||
or self.extendedassignment and self.script[self.pos-1:self.pos+1] in self.extdouble_ops:
|
||||
if self.script[self.pos-1:self.pos+1] in self.double_toks \
|
||||
or self.extendedassignment and self.script[self.pos-1:self.pos+1] in self.extdouble_toks:
|
||||
self.pos += 1
|
||||
if self.extendedassignment and self.script[self.pos-2:self.pos+1] in ('<<=', '>>='):
|
||||
self.pos += 1
|
||||
|
@ -676,8 +676,8 @@ class parser(object):
|
|||
if lvalue['t'] not in ('integer', 'float'):
|
||||
raise EParseTypeMismatch(self)
|
||||
return {'nt':'V++' if tok0 == '++' else 'V--', 't':lvalue['t'], 'ch':[lvalue]}
|
||||
if AllowAssignment and (tok0 in self.assignment_ops
|
||||
or self.extendedassignment and tok0 in self.extassignment_ops):
|
||||
if AllowAssignment and (tok0 in self.assignment_toks
|
||||
or self.extendedassignment and tok0 in self.extassignment_toks):
|
||||
self.NextToken()
|
||||
expr = self.Parse_expression()
|
||||
rtyp = expr['t']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue