mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-04 20:24:40 -07:00
Cosmetic changes: docstring style; remove commented code.
This commit is contained in:
parent
5773449edb
commit
8d1e819771
1 changed files with 6 additions and 15 deletions
|
@ -25,7 +25,9 @@ def ishex(c):
|
||||||
return '0' <= c <= '9' or 'A' <= c <= 'F' or 'a' <= c <= 'f'
|
return '0' <= c <= '9' or 'A' <= c <= 'F' or 'a' <= c <= 'f'
|
||||||
|
|
||||||
def fieldpos(inp, sep, n):
|
def fieldpos(inp, sep, n):
|
||||||
"Return the starting position of field n in a string inp that has zero or more fields separated by sep"
|
"""Return the starting position of field n in a string inp that has zero or
|
||||||
|
more fields separated by sep
|
||||||
|
"""
|
||||||
i = -1
|
i = -1
|
||||||
for n in xrange(n):
|
for n in xrange(n):
|
||||||
i = inp.find(sep, i + 1)
|
i = inp.find(sep, i + 1)
|
||||||
|
@ -222,17 +224,17 @@ class parser(object):
|
||||||
raise EParseTypeMismatch(self)
|
raise EParseTypeMismatch(self)
|
||||||
|
|
||||||
def ueof(self):
|
def ueof(self):
|
||||||
"Check for unexpected EOF"
|
"""Check for unexpected EOF"""
|
||||||
if self.pos >= self.length:
|
if self.pos >= self.length:
|
||||||
raise EParseUEOF(self)
|
raise EParseUEOF(self)
|
||||||
|
|
||||||
def ceof(self):
|
def ceof(self):
|
||||||
"Check for normal EOF"
|
"""Check for normal EOF"""
|
||||||
if self.pos >= self.length:
|
if self.pos >= self.length:
|
||||||
raise EInternal() # force GetToken to return EOF
|
raise EInternal() # force GetToken to return EOF
|
||||||
|
|
||||||
def GetToken(self):
|
def GetToken(self):
|
||||||
"Lexer"
|
"""Lexer"""
|
||||||
|
|
||||||
# Keep track of the current position. If an error occurs, it will happen at the start of this token.
|
# Keep track of the current position. If an error occurs, it will happen at the start of this token.
|
||||||
self.errorpos = self.pos
|
self.errorpos = self.pos
|
||||||
|
@ -1890,17 +1892,6 @@ class parser(object):
|
||||||
# Insert library functions into symbol table
|
# Insert library functions into symbol table
|
||||||
self.symtab[0].update(self.functions)
|
self.symtab[0].update(self.functions)
|
||||||
|
|
||||||
#while self.tok[0] != 'EOF':
|
|
||||||
# print self.tok
|
|
||||||
# self.NextToken()
|
|
||||||
|
|
||||||
#for n in xrange(len(self.symtab)):
|
|
||||||
# print n, '{',
|
|
||||||
# i = self.symtab[n]
|
|
||||||
# for j in sorted(i.items(), key=lambda k: -1 if k[0]==-1 else k[1][0]):
|
|
||||||
# print repr(j[0]) + ':' + repr(j[1]) + ',',
|
|
||||||
# print '}'
|
|
||||||
|
|
||||||
treesymtab = self.tree, self.symtab
|
treesymtab = self.tree, self.symtab
|
||||||
del self.tree
|
del self.tree
|
||||||
del self.symtab
|
del self.symtab
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue