1
0
forked from VimPlug/jedi

Move the parsing away from user_context to api.py.

This commit is contained in:
Dave Halter
2016-06-27 08:48:36 +02:00
parent 0445d51d34
commit 969100e471
5 changed files with 20 additions and 25 deletions

View File

@@ -13,7 +13,9 @@ from __future__ import absolute_import
import string
import re
from collections import namedtuple
from io import StringIO
from jedi.parser.token import (tok_name, N_TOKENS, ENDMARKER, STRING, NUMBER, opmap,
NAME, OP, ERRORTOKEN, NEWLINE, INDENT, DEDENT)
from jedi._compatibility import is_py3
@@ -148,6 +150,9 @@ ALWAYS_BREAK_TOKENS = (';', 'import', 'class', 'def', 'try', 'except',
'finally', 'while', 'return')
Token = namedtuple('Token', ['type', 'string', 'start_pos', 'prefix'])
def source_tokens(source, use_exact_op_types=False):
"""Generate tokens from a the source code (string)."""
source = source