From ed4b96335642dd7b6f7c7861f19a0b5c66231f3f Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Wed, 13 Aug 2014 13:34:09 +0200 Subject: [PATCH] Rename _ops to _toks to eliminate ambiguity and facilitate a future merge. --- lslopt/lslparse.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lslopt/lslparse.py b/lslopt/lslparse.py index 6f7686f..dad668f 100644 --- a/lslopt/lslparse.py +++ b/lslopt/lslparse.py @@ -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']