mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
debug warnings are now also possible
This commit is contained in:
3
debug.py
3
debug.py
@@ -7,6 +7,9 @@ def dbg(*args):
|
|||||||
if not (mod.__name__ in ignored_modules):
|
if not (mod.__name__ in ignored_modules):
|
||||||
debug_function(*args)
|
debug_function(*args)
|
||||||
|
|
||||||
|
def warning(*args):
|
||||||
|
if debug_function:
|
||||||
|
debug_function(*args)
|
||||||
|
|
||||||
debug_function = None
|
debug_function = None
|
||||||
ignored_modules = []
|
ignored_modules = []
|
||||||
|
|||||||
12
parsing.py
12
parsing.py
@@ -904,7 +904,7 @@ class PyFuzzyParser(object):
|
|||||||
"""
|
"""
|
||||||
names = []
|
names = []
|
||||||
tok = None
|
tok = None
|
||||||
while tok not in [')', '\n', ':']:
|
while tok not in [')', ':']:
|
||||||
stmt, tok = self._parse_statement(added_breaks=',')
|
stmt, tok = self._parse_statement(added_breaks=',')
|
||||||
if stmt:
|
if stmt:
|
||||||
names.append(stmt)
|
names.append(stmt)
|
||||||
@@ -1124,7 +1124,7 @@ class PyFuzzyParser(object):
|
|||||||
while indent <= self.scope.indent \
|
while indent <= self.scope.indent \
|
||||||
and token_type in [tokenize.NAME] \
|
and token_type in [tokenize.NAME] \
|
||||||
and self.scope != self.top:
|
and self.scope != self.top:
|
||||||
debug.dbg('syntax_err, dedent @%s - %s<=%s', \
|
debug.warning('syntax_err, dedent @%s - %s<=%s', \
|
||||||
(self.line_nr, indent, self.scope.indent))
|
(self.line_nr, indent, self.scope.indent))
|
||||||
self.scope.line_end = self.line_nr
|
self.scope.line_end = self.line_nr
|
||||||
self.scope = self.scope.parent
|
self.scope = self.scope.parent
|
||||||
@@ -1133,7 +1133,8 @@ class PyFuzzyParser(object):
|
|||||||
if tok == 'def':
|
if tok == 'def':
|
||||||
func = self._parsefunction(indent)
|
func = self._parsefunction(indent)
|
||||||
if func is None:
|
if func is None:
|
||||||
print "function: syntax error@%s" % self.line_nr
|
debug.warning("function: syntax error@%s" %
|
||||||
|
self.line_nr)
|
||||||
continue
|
continue
|
||||||
debug.dbg("new scope: function %s" % (func.name))
|
debug.dbg("new scope: function %s" % (func.name))
|
||||||
freshscope = True
|
freshscope = True
|
||||||
@@ -1142,6 +1143,8 @@ class PyFuzzyParser(object):
|
|||||||
elif tok == 'class':
|
elif tok == 'class':
|
||||||
cls = self._parseclass(indent)
|
cls = self._parseclass(indent)
|
||||||
if cls is None:
|
if cls is None:
|
||||||
|
debug.warning("class: syntax error@%s" %
|
||||||
|
self.line_nr)
|
||||||
continue
|
continue
|
||||||
freshscope = True
|
freshscope = True
|
||||||
debug.dbg("new scope: class %s" % (cls.name))
|
debug.dbg("new scope: class %s" % (cls.name))
|
||||||
@@ -1158,7 +1161,8 @@ class PyFuzzyParser(object):
|
|||||||
mod, token_type, tok, start_indent, start_line2 = \
|
mod, token_type, tok, start_indent, start_line2 = \
|
||||||
self._parsedotname()
|
self._parsedotname()
|
||||||
if not mod or tok != "import":
|
if not mod or tok != "import":
|
||||||
print "from: syntax error..."
|
debug.warning("from: syntax error@%s" %
|
||||||
|
self.line_nr)
|
||||||
continue
|
continue
|
||||||
mod = Name(mod, start_indent, start_line2, self.line_nr)
|
mod = Name(mod, start_indent, start_line2, self.line_nr)
|
||||||
names = self._parseimportlist()
|
names = self._parseimportlist()
|
||||||
|
|||||||
Reference in New Issue
Block a user