mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
closer
This commit is contained in:
parent
e895e686e0
commit
2b061d12bc
1 changed files with 19 additions and 18 deletions
|
@ -240,7 +240,7 @@ class Parser(object):
|
||||||
'none', 'true', 'false', 'ellipsis', 'if', 'del', 'assert',
|
'none', 'true', 'false', 'ellipsis', 'if', 'del', 'assert',
|
||||||
'lparen', 'lbrace', 'lbracket', 'string', 'times', 'plus',
|
'lparen', 'lbrace', 'lbracket', 'string', 'times', 'plus',
|
||||||
'minus', 'divide', 'doublediv', 'mod', 'at', 'lshift', 'rshift',
|
'minus', 'divide', 'doublediv', 'mod', 'at', 'lshift', 'rshift',
|
||||||
'pipe', 'xor', 'ampersand']
|
'pipe', 'xor', 'ampersand', 'elif']
|
||||||
for rule in tok_rules:
|
for rule in tok_rules:
|
||||||
self._tok_rule(rule)
|
self._tok_rule(rule)
|
||||||
|
|
||||||
|
@ -469,8 +469,8 @@ class Parser(object):
|
||||||
p0 = ast.Attribute(value=name,
|
p0 = ast.Attribute(value=name,
|
||||||
attr=p2[0],
|
attr=p2[0],
|
||||||
ctx=ast.Load(),
|
ctx=ast.Load(),
|
||||||
lineno=self.lineno,
|
lineno=p1.lineno,
|
||||||
col_offset=self.col)
|
col_offset=p1.lexpos)
|
||||||
for a in p2[1:]:
|
for a in p2[1:]:
|
||||||
p0 = ast.Attribute(value=p0,
|
p0 = ast.Attribute(value=p0,
|
||||||
attr=a,
|
attr=a,
|
||||||
|
@ -888,16 +888,16 @@ class Parser(object):
|
||||||
p1.extend(targs)
|
p1.extend(targs)
|
||||||
p1 = [ast.Tuple(elts=p1,
|
p1 = [ast.Tuple(elts=p1,
|
||||||
ctx=ast.Store(),
|
ctx=ast.Store(),
|
||||||
#lineno=p1.lineno,
|
lineno=p1[0].lineno,
|
||||||
#col_offset=p1.col_offset)]
|
col_offset=p1[0].col_offset)]
|
||||||
lineno=self.lineno,
|
#lineno=self.lineno,
|
||||||
col_offset=self.col)]
|
#col_offset=self.col)]
|
||||||
p0 = ast.Assign(targets=p1,
|
p0 = ast.Assign(targets=p1,
|
||||||
value=rhs,
|
value=rhs,
|
||||||
#lineno=p1[0].lineno,
|
lineno=p1[0].lineno,
|
||||||
#col_offset=p1[0].col_offset)
|
col_offset=p1[0].col_offset)
|
||||||
lineno=self.lineno,
|
#lineno=self.lineno,
|
||||||
col_offset=self.col)
|
#col_offset=self.col)
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
p[0] = p0
|
p[0] = p0
|
||||||
|
@ -1197,11 +1197,12 @@ class Parser(object):
|
||||||
|
|
||||||
def p_elif_part(self, p):
|
def p_elif_part(self, p):
|
||||||
"""elif_part : ELIF test COLON suite"""
|
"""elif_part : ELIF test COLON suite"""
|
||||||
p[0] = [ast.If(test=p[2],
|
p2 = p[2]
|
||||||
|
p[0] = [ast.If(test=p2,
|
||||||
body=p[4],
|
body=p[4],
|
||||||
orelse=[],
|
orelse=[],
|
||||||
lineno=self.lineno,
|
lineno=p2.lineno,
|
||||||
col_offset=self.col)]
|
col_offset=p2.col_offset)]
|
||||||
|
|
||||||
def p_else_part(self, p):
|
def p_else_part(self, p):
|
||||||
"""else_part : ELSE COLON suite"""
|
"""else_part : ELSE COLON suite"""
|
||||||
|
@ -2164,8 +2165,8 @@ class Parser(object):
|
||||||
p[0] = p0
|
p[0] = p0
|
||||||
|
|
||||||
def p_classdef(self, p):
|
def p_classdef(self, p):
|
||||||
"""classdef : CLASS NAME func_call_opt COLON suite"""
|
"""classdef : class_tok NAME func_call_opt COLON suite"""
|
||||||
p3 = p[3]
|
p1, p3 = p[1], p[3]
|
||||||
b, kw = ([], []) if p3 is None else (p3['args'], p3['keywords'])
|
b, kw = ([], []) if p3 is None else (p3['args'], p3['keywords'])
|
||||||
c = ast.ClassDef(name=p[2],
|
c = ast.ClassDef(name=p[2],
|
||||||
bases=b,
|
bases=b,
|
||||||
|
@ -2174,8 +2175,8 @@ class Parser(object):
|
||||||
kwargs=None,
|
kwargs=None,
|
||||||
body=p[5],
|
body=p[5],
|
||||||
decorator_list=[],
|
decorator_list=[],
|
||||||
lineno=self.lineno,
|
lineno=p1.lineno,
|
||||||
col_offset=self.col)
|
col_offset=p1.lexpos)
|
||||||
p[0] = [c]
|
p[0] = [c]
|
||||||
|
|
||||||
def _set_arg(self, args, arg, ensure_kw=False):
|
def _set_arg(self, args, arg, ensure_kw=False):
|
||||||
|
|
Loading…
Add table
Reference in a new issue