mirror of
https://github.com/kristoferssolo/solorice.git
synced 2025-10-21 20:10:34 +00:00
14624 lines
1.1 MiB
14624 lines
1.1 MiB
// !!! autogenerated; do not edit !!!
|
|
|
|
|
|
|
|
describe("Grammar Tests", function() {
|
|
var grammar = null;
|
|
beforeEach(function() {
|
|
waitsForPromise(function() {
|
|
return atom.packages.activatePackage("MagicPython")
|
|
});
|
|
runs(function() {
|
|
grammar = atom.grammars.grammarForScopeName("source.python")
|
|
});
|
|
});
|
|
|
|
|
|
it("test/builtins/builtins1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("AttributeError ConnectionAbortedError\nPendingDeprecationWarning\nModuleNotFoundError\nSystemExit\nNotImplemented True None False Ellipsis\nWarning\nException BaseException\nsum oct abs type object print exec")
|
|
expect(tokens[0][0].value).toBe("AttributeError");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("ConnectionAbortedError");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[1][0].value).toBe("PendingDeprecationWarning");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[2][0].value).toBe("ModuleNotFoundError");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[3][0].value).toBe("SystemExit");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[4][0].value).toBe("NotImplemented");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("True");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("None");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[4][5].value).toBe(" ");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][6].value).toBe("False");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[4][7].value).toBe(" ");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][8].value).toBe("Ellipsis");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[5][0].value).toBe("Warning");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[6][0].value).toBe("Exception");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][2].value).toBe("BaseException");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[7][0].value).toBe("sum");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[7][1].value).toBe(" ");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][2].value).toBe("oct");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[7][3].value).toBe(" ");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][4].value).toBe("abs");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[7][5].value).toBe(" ");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][6].value).toBe("type");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","support.type.python"]);
|
|
expect(tokens[7][7].value).toBe(" ");
|
|
expect(tokens[7][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][8].value).toBe("object");
|
|
expect(tokens[7][8].scopes).toEqual(["source.python","support.type.python"]);
|
|
expect(tokens[7][9].value).toBe(" ");
|
|
expect(tokens[7][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][10].value).toBe("print");
|
|
expect(tokens[7][10].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[7][11].value).toBe(" ");
|
|
expect(tokens[7][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][12].value).toBe("exec");
|
|
expect(tokens[7][12].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
});
|
|
|
|
it("test/builtins/builtins2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("Error\nfile reduce intern raw_input unicode cmp basestring execfile long xrange apply")
|
|
expect(tokens[0][0].value).toBe("Error");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("file");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("reduce");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("intern");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("raw_input");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][8].value).toBe("unicode");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][9].value).toBe(" ");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][10].value).toBe("cmp");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][11].value).toBe(" ");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][12].value).toBe("basestring");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][13].value).toBe(" ");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][14].value).toBe("execfile");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][15].value).toBe(" ");
|
|
expect(tokens[1][15].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][16].value).toBe("long");
|
|
expect(tokens[1][16].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][17].value).toBe(" ");
|
|
expect(tokens[1][17].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][18].value).toBe("xrange");
|
|
expect(tokens[1][18].scopes).toEqual(["source.python","variable.legacy.builtin.python"]);
|
|
expect(tokens[1][19].value).toBe(" ");
|
|
expect(tokens[1][19].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][20].value).toBe("apply");
|
|
expect(tokens[1][20].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/builtins/builtins3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("__all__ = ['bar', 'baz']\nsome.__bases__\nsome.__class__\nassert __debug__\n__builtins__\n__builtins__.len\nprint(__builtins__)\nsome.__dict__\nsome.__doc__\nsome.__file__\nsome.__members__\nsome.__metaclass__\nsome.__methods__\nsome.__module__\nsome.__mro__\nsome.__name__\nsome.__slots__\nsome.__subclasses__\nsome.__version__\nsome.__weakref__\nsome.__qualname__\nsome.__code__\nsome.__wrapped__\nsome.__signature__\nsome.__defaults__\nsome.__func__\nsome.__self__\nsome.__kwdefaults__\nsome.__matmul__\nsome.__imatmul__\nsome.__rmatmul__\nsome.__annotations__\nsome.__init_subclass__\nsome.__set_name__\nsome.__fspath__\nsome.__classcell__\nsome.__bytes__\nsome.__spec__\nsome.__path__\nsome.__prepare__\nsome.__package__\nsome.__traceback__\nsome.__notspecial__")
|
|
expect(tokens[0][0].value).toBe("__all__");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("[");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("bar");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][8].value).toBe(",");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe("'");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][11].value).toBe("baz");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][12].value).toBe("'");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][13].value).toBe("]");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[1][0].value).toBe("some");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("__bases__");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[2][0].value).toBe("some");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(".");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][2].value).toBe("__class__");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[3][0].value).toBe("assert");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("__debug__");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[4][0].value).toBe("__builtins__");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[5][0].value).toBe("__builtins__");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[5][1].value).toBe(".");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[5][2].value).toBe("len");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("print");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[6][1].value).toBe("(");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[6][2].value).toBe("__builtins__");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","support.variable.magic.python"]);
|
|
expect(tokens[6][3].value).toBe(")");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[7][0].value).toBe("some");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe(".");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[7][2].value).toBe("__dict__");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[8][0].value).toBe("some");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe(".");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[8][2].value).toBe("__doc__");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[9][0].value).toBe("some");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][1].value).toBe(".");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[9][2].value).toBe("__file__");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[10][0].value).toBe("some");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe(".");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[10][2].value).toBe("__members__");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[11][0].value).toBe("some");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[11][1].value).toBe(".");
|
|
expect(tokens[11][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[11][2].value).toBe("__metaclass__");
|
|
expect(tokens[11][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[12][0].value).toBe("some");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][1].value).toBe(".");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[12][2].value).toBe("__methods__");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[13][0].value).toBe("some");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe(".");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[13][2].value).toBe("__module__");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[14][0].value).toBe("some");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[14][1].value).toBe(".");
|
|
expect(tokens[14][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[14][2].value).toBe("__mro__");
|
|
expect(tokens[14][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[15][0].value).toBe("some");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[15][1].value).toBe(".");
|
|
expect(tokens[15][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[15][2].value).toBe("__name__");
|
|
expect(tokens[15][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[16][0].value).toBe("some");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe(".");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[16][2].value).toBe("__slots__");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[17][0].value).toBe("some");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[17][1].value).toBe(".");
|
|
expect(tokens[17][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[17][2].value).toBe("__subclasses__");
|
|
expect(tokens[17][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[18][0].value).toBe("some");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[18][1].value).toBe(".");
|
|
expect(tokens[18][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[18][2].value).toBe("__version__");
|
|
expect(tokens[18][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[19][0].value).toBe("some");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[19][1].value).toBe(".");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[19][2].value).toBe("__weakref__");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[20][0].value).toBe("some");
|
|
expect(tokens[20][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[20][1].value).toBe(".");
|
|
expect(tokens[20][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[20][2].value).toBe("__qualname__");
|
|
expect(tokens[20][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[21][0].value).toBe("some");
|
|
expect(tokens[21][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[21][1].value).toBe(".");
|
|
expect(tokens[21][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[21][2].value).toBe("__code__");
|
|
expect(tokens[21][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[22][0].value).toBe("some");
|
|
expect(tokens[22][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[22][1].value).toBe(".");
|
|
expect(tokens[22][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[22][2].value).toBe("__wrapped__");
|
|
expect(tokens[22][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[23][0].value).toBe("some");
|
|
expect(tokens[23][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[23][1].value).toBe(".");
|
|
expect(tokens[23][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[23][2].value).toBe("__signature__");
|
|
expect(tokens[23][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[24][0].value).toBe("some");
|
|
expect(tokens[24][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[24][1].value).toBe(".");
|
|
expect(tokens[24][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[24][2].value).toBe("__defaults__");
|
|
expect(tokens[24][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[25][0].value).toBe("some");
|
|
expect(tokens[25][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[25][1].value).toBe(".");
|
|
expect(tokens[25][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[25][2].value).toBe("__func__");
|
|
expect(tokens[25][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[26][0].value).toBe("some");
|
|
expect(tokens[26][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[26][1].value).toBe(".");
|
|
expect(tokens[26][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[26][2].value).toBe("__self__");
|
|
expect(tokens[26][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[27][0].value).toBe("some");
|
|
expect(tokens[27][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[27][1].value).toBe(".");
|
|
expect(tokens[27][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[27][2].value).toBe("__kwdefaults__");
|
|
expect(tokens[27][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[28][0].value).toBe("some");
|
|
expect(tokens[28][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[28][1].value).toBe(".");
|
|
expect(tokens[28][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[28][2].value).toBe("__matmul__");
|
|
expect(tokens[28][2].scopes).toEqual(["source.python","support.function.magic.python"]);
|
|
expect(tokens[29][0].value).toBe("some");
|
|
expect(tokens[29][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[29][1].value).toBe(".");
|
|
expect(tokens[29][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[29][2].value).toBe("__imatmul__");
|
|
expect(tokens[29][2].scopes).toEqual(["source.python","support.function.magic.python"]);
|
|
expect(tokens[30][0].value).toBe("some");
|
|
expect(tokens[30][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[30][1].value).toBe(".");
|
|
expect(tokens[30][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[30][2].value).toBe("__rmatmul__");
|
|
expect(tokens[30][2].scopes).toEqual(["source.python","support.function.magic.python"]);
|
|
expect(tokens[31][0].value).toBe("some");
|
|
expect(tokens[31][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[31][1].value).toBe(".");
|
|
expect(tokens[31][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[31][2].value).toBe("__annotations__");
|
|
expect(tokens[31][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[32][0].value).toBe("some");
|
|
expect(tokens[32][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[32][1].value).toBe(".");
|
|
expect(tokens[32][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[32][2].value).toBe("__init_subclass__");
|
|
expect(tokens[32][2].scopes).toEqual(["source.python","support.function.magic.python"]);
|
|
expect(tokens[33][0].value).toBe("some");
|
|
expect(tokens[33][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[33][1].value).toBe(".");
|
|
expect(tokens[33][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[33][2].value).toBe("__set_name__");
|
|
expect(tokens[33][2].scopes).toEqual(["source.python","support.function.magic.python"]);
|
|
expect(tokens[34][0].value).toBe("some");
|
|
expect(tokens[34][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[34][1].value).toBe(".");
|
|
expect(tokens[34][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[34][2].value).toBe("__fspath__");
|
|
expect(tokens[34][2].scopes).toEqual(["source.python","support.function.magic.python"]);
|
|
expect(tokens[35][0].value).toBe("some");
|
|
expect(tokens[35][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[35][1].value).toBe(".");
|
|
expect(tokens[35][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[35][2].value).toBe("__classcell__");
|
|
expect(tokens[35][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[36][0].value).toBe("some");
|
|
expect(tokens[36][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[36][1].value).toBe(".");
|
|
expect(tokens[36][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[36][2].value).toBe("__bytes__");
|
|
expect(tokens[36][2].scopes).toEqual(["source.python","support.function.magic.python"]);
|
|
expect(tokens[37][0].value).toBe("some");
|
|
expect(tokens[37][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[37][1].value).toBe(".");
|
|
expect(tokens[37][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[37][2].value).toBe("__spec__");
|
|
expect(tokens[37][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[38][0].value).toBe("some");
|
|
expect(tokens[38][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[38][1].value).toBe(".");
|
|
expect(tokens[38][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[38][2].value).toBe("__path__");
|
|
expect(tokens[38][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[39][0].value).toBe("some");
|
|
expect(tokens[39][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[39][1].value).toBe(".");
|
|
expect(tokens[39][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[39][2].value).toBe("__prepare__");
|
|
expect(tokens[39][2].scopes).toEqual(["source.python","support.function.magic.python"]);
|
|
expect(tokens[40][0].value).toBe("some");
|
|
expect(tokens[40][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[40][1].value).toBe(".");
|
|
expect(tokens[40][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[40][2].value).toBe("__package__");
|
|
expect(tokens[40][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[41][0].value).toBe("some");
|
|
expect(tokens[41][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[41][1].value).toBe(".");
|
|
expect(tokens[41][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[41][2].value).toBe("__traceback__");
|
|
expect(tokens[41][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[42][0].value).toBe("some");
|
|
expect(tokens[42][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[42][1].value).toBe(".");
|
|
expect(tokens[42][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[42][2].value).toBe("__notspecial__");
|
|
expect(tokens[42][2].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/builtins/builtins4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("some.int\nsome.sum\nsome.super\nsome.unicode\nsome.foo\nsome.Exception")
|
|
expect(tokens[0][0].value).toBe("some");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("int");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("some");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("sum");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("some");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(".");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][2].value).toBe("super");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("some");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(".");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][2].value).toBe("unicode");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("some");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(".");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[4][2].value).toBe("foo");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("some");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(".");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[5][2].value).toBe("Exception");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/builtins/builtins5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("some. True\nsome. \\\n True\nTrue\nsome.\n True")
|
|
expect(tokens[0][0].value).toBe("some");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe(" ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe("True");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
|
|
expect(tokens[1][0].value).toBe("some");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe("\\");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][4].value).toBe("");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("True");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
|
|
expect(tokens[3][0].value).toBe("True");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[4][0].value).toBe("some");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(".");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[4][2].value).toBe("");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe("True");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
|
|
});
|
|
|
|
it("test/builtins/builtins6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("exec()\nexec(code_obj)")
|
|
expect(tokens[0][0].value).toBe("exec");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe(")");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][0].value).toBe("exec");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[1][1].value).toBe("(");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("code_obj");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][3].value).toBe(")");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/builtins/builtins7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("breakpoint()")
|
|
expect(tokens[0][0].value).toBe("breakpoint");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe(")");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/calls/call1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("some_call(A, b, c[1], *args, FOO=lambda:{'q': 42}, **kwargs)")
|
|
expect(tokens[0][0].value).toBe("some_call");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("A");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][3].value).toBe(",");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][5].value).toBe("b");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][8].value).toBe("c");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.item-access.python"]);
|
|
expect(tokens[0][9].value).toBe("[");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][10].value).toBe("1");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][11].value).toBe("]");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][12].value).toBe(",");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][14].value).toBe("*");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[0][15].value).toBe("args");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][16].value).toBe(",");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[0][17].value).toBe(" ");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][18].value).toBe("FOO");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][19].value).toBe("=");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][20].value).toBe("lambda");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][21].value).toBe(":");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[0][22].value).toBe("{");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[0][23].value).toBe("'");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][24].value).toBe("q");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[0][25].value).toBe("'");
|
|
expect(tokens[0][25].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][26].value).toBe(":");
|
|
expect(tokens[0][26].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[0][27].value).toBe(" ");
|
|
expect(tokens[0][27].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][28].value).toBe("42");
|
|
expect(tokens[0][28].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][29].value).toBe("}");
|
|
expect(tokens[0][29].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[0][30].value).toBe(",");
|
|
expect(tokens[0][30].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[0][31].value).toBe(" ");
|
|
expect(tokens[0][31].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][32].value).toBe("**");
|
|
expect(tokens[0][32].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[0][33].value).toBe("kwargs");
|
|
expect(tokens[0][33].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][34].value).toBe(")");
|
|
expect(tokens[0][34].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/calls/call10.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("x = foo(True,\n 3 * 4,\n *a,\n **bar)")
|
|
expect(tokens[0][0].value).toBe("x");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("foo");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][5].value).toBe("(");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("True");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.language.python"]);
|
|
expect(tokens[0][7].value).toBe(",");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][1].value).toBe("3");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][3].value).toBe("*");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][5].value).toBe("4");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][6].value).toBe(",");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[2][1].value).toBe("*");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[2][2].value).toBe("a");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[2][3].value).toBe(",");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[3][1].value).toBe("**");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[3][2].value).toBe("bar");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[3][3].value).toBe(")");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/calls/call2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("foo(from=1)")
|
|
expect(tokens[0][0].value).toBe("foo");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("from");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][3].value).toBe("=");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][4].value).toBe("1");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][5].value).toBe(")");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/calls/call3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("foo.class(a)\nfoo.and()\nfoo.if")
|
|
expect(tokens[0][0].value).toBe("foo");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("class");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("a");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][5].value).toBe(")");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][0].value).toBe("foo");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("and");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[2][0].value).toBe("foo");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(".");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][2].value).toBe("if");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/calls/call4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("foo.1\nfoo(bar=baz)(ham=sam)\nfoo.None and foo.None.baz")
|
|
expect(tokens[0][0].value).toBe("foo");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("1");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("foo");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[1][1].value).toBe("(");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("bar");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[1][3].value).toBe("=");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][4].value).toBe("baz");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][5].value).toBe(")");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][6].value).toBe("(");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][7].value).toBe("ham");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[1][8].value).toBe("=");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][9].value).toBe("sam");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][10].value).toBe(")");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[2][0].value).toBe("foo");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(".");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][2].value).toBe("None");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("and");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("foo");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][7].value).toBe(".");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][8].value).toBe("None");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
|
|
expect(tokens[2][9].value).toBe(".");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][10].value).toBe("baz");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/calls/call5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f(*a)\nf(**a)")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("*");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[0][3].value).toBe("a");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][0].value).toBe("f");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[1][1].value).toBe("(");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("**");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[1][3].value).toBe("a");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/calls/call6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f( *a , *())\nf( **a , **{})")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe(" ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][3].value).toBe("*");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[0][4].value).toBe("a");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][8].value).toBe("*");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[0][9].value).toBe("(");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[0][10].value).toBe(")");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[0][11].value).toBe(")");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][0].value).toBe("f");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[1][1].value).toBe("(");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][3].value).toBe("**");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[1][4].value).toBe("a");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][6].value).toBe(",");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][8].value).toBe("**");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[1][9].value).toBe("{");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[1][10].value).toBe("}");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[1][11].value).toBe(")");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/calls/call7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("foo.__class__ (foo=bar)\nfoo.__class__(foo=bar)\nfoo.__add__ (foo=bar)\nfoo.__add__(foo=bar)\n\nfoo.__class__ 1")
|
|
expect(tokens[0][0].value).toBe("foo");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("__class__");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","support.variable.magic.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python"]);
|
|
expect(tokens[0][4].value).toBe("(");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("foo");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][6].value).toBe("=");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][7].value).toBe("bar");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][8].value).toBe(")");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][0].value).toBe("foo");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("__class__");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","support.variable.magic.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][4].value).toBe("foo");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[1][5].value).toBe("=");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][6].value).toBe("bar");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][7].value).toBe(")");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[2][0].value).toBe("foo");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(".");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][2].value).toBe("__add__");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.python"]);
|
|
expect(tokens[2][4].value).toBe("(");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("foo");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[2][6].value).toBe("=");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][7].value).toBe("bar");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[2][8].value).toBe(")");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][0].value).toBe("foo");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(".");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][2].value).toBe("__add__");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[3][3].value).toBe("(");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][4].value).toBe("foo");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[3][5].value).toBe("=");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][6].value).toBe("bar");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[3][7].value).toBe(")");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("foo");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(".");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[5][2].value).toBe("__class__");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("1");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/calls/call8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("foo. __class__(foo=bar)\nfoo. __class__ (foo=bar)\nfoo. __add__ (foo=bar)\nfoo. __add__(foo=bar)")
|
|
expect(tokens[0][0].value).toBe("foo");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe(" ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe("__class__");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","support.variable.magic.python"]);
|
|
expect(tokens[0][4].value).toBe("(");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("foo");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][6].value).toBe("=");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][7].value).toBe("bar");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][8].value).toBe(")");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][0].value).toBe("foo");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe("__class__");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","support.variable.magic.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python"]);
|
|
expect(tokens[1][5].value).toBe("(");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("foo");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[1][7].value).toBe("=");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][8].value).toBe("bar");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][9].value).toBe(")");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[2][0].value).toBe("foo");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(".");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][3].value).toBe("__add__");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[2][4].value).toBe(" ");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function-call.python"]);
|
|
expect(tokens[2][5].value).toBe("(");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("foo");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[2][7].value).toBe("=");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][8].value).toBe("bar");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[2][9].value).toBe(")");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][0].value).toBe("foo");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(".");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][3].value).toBe("__add__");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[3][4].value).toBe("(");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][5].value).toBe("foo");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[3][6].value).toBe("=");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][7].value).toBe("bar");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[3][8].value).toBe(")");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/calls/call9.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("foo(type=1)")
|
|
expect(tokens[0][0].value).toBe("foo");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("type");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][3].value).toBe("=");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][4].value).toBe("1");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][5].value).toBe(")");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/calls/print1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("print \"is\", 2*2\nprint(\"is\", 2*2)\nprint x,\nprint(x, end=\" \")\nprint\nprint()\nprint >>sys.stderr, \"er\"\nprint(\"er\", file=sys.stderr)\nprint (x, y)\nprint((x, y))")
|
|
expect(tokens[0][0].value).toBe("print");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("\"");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][3].value).toBe("is");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][4].value).toBe("\"");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][5].value).toBe(",");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("2");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][8].value).toBe("*");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][9].value).toBe("2");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][0].value).toBe("print");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[1][1].value).toBe("(");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("\"");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][3].value).toBe("is");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[1][4].value).toBe("\"");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][5].value).toBe(",");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][7].value).toBe("2");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][8].value).toBe("*");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[1][9].value).toBe("2");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][10].value).toBe(")");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[2][0].value).toBe("print");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("x");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][3].value).toBe(",");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[3][0].value).toBe("print");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[3][1].value).toBe("(");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][2].value).toBe("x");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[3][3].value).toBe(",");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[3][5].value).toBe("end");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[3][6].value).toBe("=");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][7].value).toBe("\"");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][8].value).toBe(" ");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[3][9].value).toBe("\"");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][10].value).toBe(")");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][0].value).toBe("print");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[5][0].value).toBe("print");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[5][1].value).toBe("(");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[5][2].value).toBe(")");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[6][0].value).toBe("print");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][2].value).toBe(">>");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","keyword.operator.bitwise.python"]);
|
|
expect(tokens[6][3].value).toBe("sys");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][4].value).toBe(".");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[6][5].value).toBe("stderr");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][6].value).toBe(",");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[6][7].value).toBe(" ");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][8].value).toBe("\"");
|
|
expect(tokens[6][8].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][9].value).toBe("er");
|
|
expect(tokens[6][9].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[6][10].value).toBe("\"");
|
|
expect(tokens[6][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][0].value).toBe("print");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[7][1].value).toBe("(");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[7][2].value).toBe("\"");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("er");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[7][4].value).toBe("\"");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][5].value).toBe(",");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[7][6].value).toBe(" ");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[7][7].value).toBe("file");
|
|
expect(tokens[7][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[7][8].value).toBe("=");
|
|
expect(tokens[7][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[7][9].value).toBe("sys");
|
|
expect(tokens[7][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[7][10].value).toBe(".");
|
|
expect(tokens[7][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.period.python"]);
|
|
expect(tokens[7][11].value).toBe("stderr");
|
|
expect(tokens[7][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[7][12].value).toBe(")");
|
|
expect(tokens[7][12].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[8][0].value).toBe("print");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[8][1].value).toBe(" ");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","meta.function-call.python"]);
|
|
expect(tokens[8][2].value).toBe("(");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[8][3].value).toBe("x");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[8][4].value).toBe(",");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[8][5].value).toBe(" ");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[8][6].value).toBe("y");
|
|
expect(tokens[8][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[8][7].value).toBe(")");
|
|
expect(tokens[8][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[9][0].value).toBe("print");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[9][1].value).toBe("(");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[9][2].value).toBe("(");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[9][3].value).toBe("x");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[9][4].value).toBe(",");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.element.python"]);
|
|
expect(tokens[9][5].value).toBe(" ");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[9][6].value).toBe("y");
|
|
expect(tokens[9][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[9][7].value).toBe(")");
|
|
expect(tokens[9][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[9][8].value).toBe(")");
|
|
expect(tokens[9][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/classes/class1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo -> None: pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("->");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","invalid.illegal.annotation.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("None");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[0][7].value).toBe(":");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("pass");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class10.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo(Bar(q=1) (w=2) (e=3)): pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("Bar");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][5].value).toBe("(");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("q");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][7].value).toBe("=");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][8].value).toBe("1");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][9].value).toBe(")");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][11].value).toBe("(");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][12].value).toBe("w");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][13].value).toBe("=");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][14].value).toBe("2");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][15].value).toBe(")");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][16].value).toBe(" ");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][17].value).toBe("(");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][18].value).toBe("e");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][19].value).toBe("=");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][20].value).toBe("3");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][21].value).toBe(")");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][22].value).toBe(")");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][23].value).toBe(":");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[0][24].value).toBe(" ");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][25].value).toBe("pass");
|
|
expect(tokens[0][25].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class11.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class F:\n def __init__(self, a, b=1):\n self.a = a\n self.b = b\n print(self)\n self()\n a.self = 1\n a.self.bar = 2\n self[123]")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("F");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][1].value).toBe("def");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][3].value).toBe("__init__");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","support.function.magic.python"]);
|
|
expect(tokens[1][4].value).toBe("(");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("self");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[1][6].value).toBe(",");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][8].value).toBe("a");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][9].value).toBe(",");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[1][10].value).toBe(" ");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][11].value).toBe("b");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][12].value).toBe("=");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[1][13].value).toBe("1");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][14].value).toBe(")");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][15].value).toBe(":");
|
|
expect(tokens[1][15].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("self");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","variable.language.special.self.python"]);
|
|
expect(tokens[2][2].value).toBe(".");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][3].value).toBe("a");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe(" ");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][5].value).toBe("=");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][6].value).toBe(" ");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][7].value).toBe("a");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("self");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","variable.language.special.self.python"]);
|
|
expect(tokens[3][2].value).toBe(".");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][3].value).toBe("b");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][5].value).toBe("=");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][6].value).toBe(" ");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][7].value).toBe("b");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("print");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[4][2].value).toBe("(");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("self");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.language.special.self.python"]);
|
|
expect(tokens[4][4].value).toBe(")");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe("self");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function-call.python","variable.language.special.self.python"]);
|
|
expect(tokens[5][2].value).toBe("(");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[5][3].value).toBe(")");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe("a");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][2].value).toBe(".");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[6][3].value).toBe("self");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][4].value).toBe(" ");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][5].value).toBe("=");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[6][6].value).toBe(" ");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][7].value).toBe("1");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("a");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][2].value).toBe(".");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[7][3].value).toBe("self");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][4].value).toBe(".");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[7][5].value).toBe("bar");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][6].value).toBe(" ");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][7].value).toBe("=");
|
|
expect(tokens[7][7].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[7][8].value).toBe(" ");
|
|
expect(tokens[7][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][9].value).toBe("2");
|
|
expect(tokens[7][9].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe("self");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","meta.item-access.python","variable.language.special.self.python"]);
|
|
expect(tokens[8][2].value).toBe("[");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[8][3].value).toBe("123");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[8][4].value).toBe("]");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/classes/class12.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class F:\n @classmethod\n def meth(cls, a, b=1):\n cls.a = a\n cls.b = b\n print(cls)\n cls()\n cls + 1\n a.cls = 1\n a.cls.__name__\n cls[123]")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("F");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[1][1].value).toBe("@");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[1][2].value).toBe("classmethod");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","support.type.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][1].value).toBe("def");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][3].value).toBe("meth");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][4].value).toBe("(");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("cls");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.cls.python"]);
|
|
expect(tokens[2][6].value).toBe(",");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[2][7].value).toBe(" ");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[2][8].value).toBe("a");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][9].value).toBe(",");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[2][10].value).toBe(" ");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[2][11].value).toBe("b");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][12].value).toBe("=");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[2][13].value).toBe("1");
|
|
expect(tokens[2][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][14].value).toBe(")");
|
|
expect(tokens[2][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][15].value).toBe(":");
|
|
expect(tokens[2][15].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("cls");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","variable.language.special.cls.python"]);
|
|
expect(tokens[3][2].value).toBe(".");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][3].value).toBe("a");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][5].value).toBe("=");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][6].value).toBe(" ");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][7].value).toBe("a");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("cls");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","variable.language.special.cls.python"]);
|
|
expect(tokens[4][2].value).toBe(".");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[4][3].value).toBe("b");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe(" ");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][5].value).toBe("=");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][6].value).toBe(" ");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][7].value).toBe("b");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe("print");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[5][2].value).toBe("(");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[5][3].value).toBe("cls");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.language.special.cls.python"]);
|
|
expect(tokens[5][4].value).toBe(")");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe("cls");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function-call.python","variable.language.special.cls.python"]);
|
|
expect(tokens[6][2].value).toBe("(");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[6][3].value).toBe(")");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("cls");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","variable.language.special.cls.python"]);
|
|
expect(tokens[7][2].value).toBe(" ");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][3].value).toBe("+");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[7][4].value).toBe(" ");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][5].value).toBe("1");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe("a");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][2].value).toBe(".");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[8][3].value).toBe("cls");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][4].value).toBe(" ");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][5].value).toBe("=");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[8][6].value).toBe(" ");
|
|
expect(tokens[8][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][7].value).toBe("1");
|
|
expect(tokens[8][7].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][1].value).toBe("a");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][2].value).toBe(".");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[9][3].value).toBe("cls");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][4].value).toBe(".");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[9][5].value).toBe("__name__");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("cls");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","meta.item-access.python","variable.language.special.cls.python"]);
|
|
expect(tokens[10][2].value).toBe("[");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[10][3].value).toBe("123");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[10][4].value).toBe("]");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/classes/class13.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class A(*a, **b): pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("A");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("*");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[0][5].value).toBe("a");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][8].value).toBe("**");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[0][9].value).toBe("b");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][10].value).toBe(")");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][11].value).toBe(":");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][13].value).toBe("pass");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class14.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class F(f.Exception, f.type, Exception, Exception.a, b=Exception):\n pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("F");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][5].value).toBe(".");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][6].value).toBe("Exception");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][7].value).toBe(",");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][9].value).toBe("f");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][10].value).toBe(".");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][11].value).toBe("type");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][12].value).toBe(",");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][14].value).toBe("Exception");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.exception.python"]);
|
|
expect(tokens[0][15].value).toBe(",");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][16].value).toBe(" ");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][17].value).toBe("Exception");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.exception.python"]);
|
|
expect(tokens[0][18].value).toBe(".");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][19].value).toBe("a");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][20].value).toBe(",");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][21].value).toBe(" ");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][22].value).toBe("b");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","variable.parameter.class.python entity.other.inherited-class.python"]);
|
|
expect(tokens[0][23].value).toBe("=");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][24].value).toBe("Exception");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.exception.python"]);
|
|
expect(tokens[0][25].value).toBe(")");
|
|
expect(tokens[0][25].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][26].value).toBe(":");
|
|
expect(tokens[0][26].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("pass");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class15.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Spam(Foo, from==12):\n pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Spam");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("Foo");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][5].value).toBe(",");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][7].value).toBe("from");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][8].value).toBe("==");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[0][9].value).toBe("12");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][10].value).toBe(")");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][11].value).toBe(":");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("pass");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class16.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo(Bar, str, type=12, metaclass=FooMeta): pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("Bar");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][5].value).toBe(",");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][7].value).toBe("str");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.python"]);
|
|
expect(tokens[0][8].value).toBe(",");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][10].value).toBe("type");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","variable.parameter.class.python entity.other.inherited-class.python"]);
|
|
expect(tokens[0][11].value).toBe("=");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][12].value).toBe("12");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][13].value).toBe(",");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][14].value).toBe(" ");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][15].value).toBe("metaclass");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.metaclass.python"]);
|
|
expect(tokens[0][16].value).toBe("=");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][17].value).toBe("FooMeta");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][18].value).toBe(")");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][19].value).toBe(":");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[0][20].value).toBe(" ");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][21].value).toBe("pass");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@dec\n# Bar.name=... is not legal, but the test is for highlighter not breaking badly\nclass Spam(Foo.Bar, Bar.name={'very': 'odd'}):\n pass")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe("dec");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[1][0].value).toBe("#");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][1].value).toBe(" Bar.name=... is not legal, but the test is for highlighter not breaking badly");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[2][0].value).toBe("class");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[2][2].value).toBe("Spam");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[2][4].value).toBe("Foo");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[2][5].value).toBe(".");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][6].value).toBe("Bar");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[2][7].value).toBe(",");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[2][8].value).toBe(" ");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[2][9].value).toBe("Bar");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[2][10].value).toBe(".");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][11].value).toBe("name");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[2][12].value).toBe("=");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][13].value).toBe("{");
|
|
expect(tokens[2][13].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[2][14].value).toBe("'");
|
|
expect(tokens[2][14].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][15].value).toBe("very");
|
|
expect(tokens[2][15].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","string.quoted.single.python"]);
|
|
expect(tokens[2][16].value).toBe("'");
|
|
expect(tokens[2][16].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][17].value).toBe(":");
|
|
expect(tokens[2][17].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[2][18].value).toBe(" ");
|
|
expect(tokens[2][18].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[2][19].value).toBe("'");
|
|
expect(tokens[2][19].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][20].value).toBe("odd");
|
|
expect(tokens[2][20].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","string.quoted.single.python"]);
|
|
expect(tokens[2][21].value).toBe("'");
|
|
expect(tokens[2][21].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][22].value).toBe("}");
|
|
expect(tokens[2][22].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[2][23].value).toBe(")");
|
|
expect(tokens[2][23].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[2][24].value).toBe(":");
|
|
expect(tokens[2][24].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("pass");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Spam(Foo, from=12):\n pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Spam");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("Foo");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][5].value).toBe(",");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][7].value).toBe("from");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][8].value).toBe("=");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][9].value).toBe("12");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][10].value).toBe(")");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][11].value).toBe(":");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("pass");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Exception: pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Exception");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","support.type.exception.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("pass");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo(Exception, MyObj): pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("Exception");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.exception.python"]);
|
|
expect(tokens[0][5].value).toBe(",");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.separator.inheritance.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python"]);
|
|
expect(tokens[0][7].value).toBe("MyObj");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][8].value).toBe(")");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][9].value).toBe(":");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("pass");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo(metaclass=FooMeta): pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("metaclass");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.metaclass.python"]);
|
|
expect(tokens[0][5].value).toBe("=");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][6].value).toBe("FooMeta");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][7].value).toBe(")");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][8].value).toBe(":");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe("pass");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class class:\n pass\n# doesn't break")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("class");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("pass");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("#");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][1].value).toBe(" doesn't break");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/classes/class8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class None: pass\nclass True(False): pass\nclass False(object): pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("None");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","keyword.illegal.name.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("pass");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][0].value).toBe("class");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[1][2].value).toBe("True");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.class.python","keyword.illegal.name.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[1][4].value).toBe("False");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","constant.language.python"]);
|
|
expect(tokens[1][5].value).toBe(")");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[1][6].value).toBe(":");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][8].value).toBe("pass");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("class");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[2][2].value).toBe("False");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.class.python","keyword.illegal.name.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[2][4].value).toBe("object");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","support.type.python"]);
|
|
expect(tokens[2][5].value).toBe(")");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[2][6].value).toBe(":");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[2][7].value).toBe(" ");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][8].value).toBe("pass");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/classes/class9.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo:\n __slots__ = ()")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("__slots__");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe("=");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][5].value).toBe("(");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(")");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
});
|
|
|
|
it("test/classes/super1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo:\n def __init__(self):\n super().__init__(foo=1)\n super(). __init__(foo=1)\n super(). \\\n__init__(foo=1)\n __init__(foo=1)\n\n foo.__init__(bar=1)\n __init__(bar=1)\n if:\n __init__(bar=1)")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][1].value).toBe("def");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][3].value).toBe("__init__");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","support.function.magic.python"]);
|
|
expect(tokens[1][4].value).toBe("(");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("self");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[1][6].value).toBe(")");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][7].value).toBe(":");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("super");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function-call.python","support.type.python"]);
|
|
expect(tokens[2][2].value).toBe("(");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][3].value).toBe(")");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[2][4].value).toBe(".");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][5].value).toBe("__init__");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[2][6].value).toBe("(");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][7].value).toBe("foo");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[2][8].value).toBe("=");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][9].value).toBe("1");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][10].value).toBe(")");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("super");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function-call.python","support.type.python"]);
|
|
expect(tokens[3][2].value).toBe("(");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][3].value).toBe(")");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][4].value).toBe(".");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][5].value).toBe(" ");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][6].value).toBe("__init__");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[3][7].value).toBe("(");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][8].value).toBe("foo");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[3][9].value).toBe("=");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][10].value).toBe("1");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][11].value).toBe(")");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("super");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function-call.python","support.type.python"]);
|
|
expect(tokens[4][2].value).toBe("(");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[4][3].value).toBe(")");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][4].value).toBe(".");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[4][5].value).toBe(" ");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][6].value).toBe("\\");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[4][7].value).toBe("");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("__init__");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[5][1].value).toBe("(");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[5][2].value).toBe("foo");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[5][3].value).toBe("=");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[5][4].value).toBe("1");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[5][5].value).toBe(")");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe("__init__");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[6][2].value).toBe("(");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[6][3].value).toBe("foo");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[6][4].value).toBe("=");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[6][5].value).toBe("1");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[6][6].value).toBe(")");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[7][0].value).toBe("");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe("foo");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][2].value).toBe(".");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[8][3].value).toBe("__init__");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[8][4].value).toBe("(");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[8][5].value).toBe("bar");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[8][6].value).toBe("=");
|
|
expect(tokens[8][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[8][7].value).toBe("1");
|
|
expect(tokens[8][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[8][8].value).toBe(")");
|
|
expect(tokens[8][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][1].value).toBe("__init__");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[9][2].value).toBe("(");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[9][3].value).toBe("bar");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[9][4].value).toBe("=");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[9][5].value).toBe("1");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[9][6].value).toBe(")");
|
|
expect(tokens[9][6].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("if");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[10][2].value).toBe(":");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[11][0].value).toBe(" ");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[11][1].value).toBe("__init__");
|
|
expect(tokens[11][1].scopes).toEqual(["source.python","meta.function-call.python","support.function.magic.python"]);
|
|
expect(tokens[11][2].value).toBe("(");
|
|
expect(tokens[11][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[11][3].value).toBe("bar");
|
|
expect(tokens[11][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[11][4].value).toBe("=");
|
|
expect(tokens[11][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[11][5].value).toBe("1");
|
|
expect(tokens[11][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[11][6].value).toBe(")");
|
|
expect(tokens[11][6].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/comments/comment1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# XXX foo\n# FIXME: bug\n# NB: XXXx xXXX but XXX!\n# ALSO HACK and NOTE and TODO highlight XXX and FIXME.")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[0][2].value).toBe("XXX");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[0][3].value).toBe(" foo");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("#");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][2].value).toBe("FIXME");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[1][3].value).toBe(": bug");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[2][0].value).toBe("#");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][1].value).toBe(" NB: XXXx xXXX but ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[2][2].value).toBe("XXX");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[2][3].value).toBe("!");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][0].value).toBe("#");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][1].value).toBe(" ALSO ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][2].value).toBe("HACK");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[3][3].value).toBe(" and ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][4].value).toBe("NOTE");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[3][5].value).toBe(" and ");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][6].value).toBe("TODO");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[3][7].value).toBe(" highlight ");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][8].value).toBe("XXX");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[3][9].value).toBe(" and ");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][10].value).toBe("FIXME");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[3][11].value).toBe(".");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/comments/typing1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# type: ignore # test\n# type: ignore\n# type:ignore\n#type:ignore\n# type: ignore 1\n# type: 1 ignore\n# type : ignore\n##type: ignore\n#.type: ignore")
|
|
expect(tokens[0][0].value).toBe("# ");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][1].value).toBe("type:");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[0][2].value).toBe(" ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][3].value).toBe("ignore");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.ignore.notation.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][5].value).toBe("#");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][6].value).toBe(" test");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("# ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[1][1].value).toBe("type:");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[1][3].value).toBe("ignore");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.ignore.notation.python"]);
|
|
expect(tokens[2][0].value).toBe("# ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[2][1].value).toBe("type:");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[2][2].value).toBe("ignore");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.ignore.notation.python"]);
|
|
expect(tokens[3][0].value).toBe("#");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[3][1].value).toBe("type:");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[3][2].value).toBe("ignore");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.ignore.notation.python"]);
|
|
expect(tokens[4][0].value).toBe("# ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[4][1].value).toBe("type:");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[4][2].value).toBe(" ");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[4][3].value).toBe("ignore");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.variable.notation.python"]);
|
|
expect(tokens[4][4].value).toBe(" 1");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[5][0].value).toBe("# ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[5][1].value).toBe("type:");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[5][2].value).toBe(" ");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[5][3].value).toBe("1 ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[5][4].value).toBe("ignore");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.variable.notation.python"]);
|
|
expect(tokens[6][0].value).toBe("#");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[6][1].value).toBe(" type : ignore");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[7][0].value).toBe("#");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[7][1].value).toBe("#type: ignore");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[8][0].value).toBe("#");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[8][1].value).toBe(".type: ignore");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/comments/typing2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = 1 # type:\na = 1 # type: # 123")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("1");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("#");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][7].value).toBe(" type:");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("1");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("#");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][7].value).toBe(" type: # 123");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/comments/typing3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# abc type: def")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" abc type: def");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/comments/typing4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("x = None # type: List[str, a]\ny = None # type: Dict[int, Any] # int")
|
|
expect(tokens[0][0].value).toBe("x");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("None");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("# ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][7].value).toBe("type:");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][9].value).toBe("List");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.type.notation.python"]);
|
|
expect(tokens[0][10].value).toBe("[");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.punctuation.notation.python"]);
|
|
expect(tokens[0][11].value).toBe("str");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.type.notation.python"]);
|
|
expect(tokens[0][12].value).toBe(",");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.punctuation.notation.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][14].value).toBe("a");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.variable.notation.python"]);
|
|
expect(tokens[0][15].value).toBe("]");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.punctuation.notation.python"]);
|
|
expect(tokens[1][0].value).toBe("y");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("None");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("# ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[1][7].value).toBe("type:");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[1][8].value).toBe(" ");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[1][9].value).toBe("Dict");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.type.notation.python"]);
|
|
expect(tokens[1][10].value).toBe("[");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.punctuation.notation.python"]);
|
|
expect(tokens[1][11].value).toBe("int");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.type.notation.python"]);
|
|
expect(tokens[1][12].value).toBe(",");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.punctuation.notation.python"]);
|
|
expect(tokens[1][13].value).toBe(" ");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[1][14].value).toBe("Any");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.type.notation.python"]);
|
|
expect(tokens[1][15].value).toBe("]");
|
|
expect(tokens[1][15].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.punctuation.notation.python"]);
|
|
expect(tokens[1][16].value).toBe(" ");
|
|
expect(tokens[1][16].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[1][17].value).toBe("#");
|
|
expect(tokens[1][17].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][18].value).toBe(" int");
|
|
expect(tokens[1][18].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/comments/typing5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("if isinstance(t1, TypeVar): # type: ignore\n continue")
|
|
expect(tokens[0][0].value).toBe("if");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("isinstance");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("t1");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][5].value).toBe(",");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][7].value).toBe("TypeVar");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][8].value).toBe(")");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][9].value).toBe(":");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("# ");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][12].value).toBe("type:");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][14].value).toBe("ignore");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.ignore.notation.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("continue");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/comments/typing6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a=1#type:int\na=1#type:int#int")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe("=");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][2].value).toBe("1");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][3].value).toBe("#");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[0][4].value).toBe("type:");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[0][5].value).toBe("int");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.type.notation.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("=");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][2].value).toBe("1");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][3].value).toBe("#");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python"]);
|
|
expect(tokens[1][4].value).toBe("type:");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.directive.notation.python"]);
|
|
expect(tokens[1][5].value).toBe("int");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","comment.line.number-sign.python","meta.typehint.comment.python","comment.typehint.type.notation.python"]);
|
|
expect(tokens[1][6].value).toBe("#");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][7].value).toBe("int");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/docstrings/class1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo:\n '''TEST'''\n\nclass Foo:\n r'''TEST'''\n\nclass Foo:\n R'''TEST'''\n\nclass Foo:\n u'''TEST'''\n\nclass Foo:\n U'''TEST'''\n\nclass Foo:\n b'''TEST'''\n\nclass Foo:\n B'''TEST'''")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("'''");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TEST");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[1][3].value).toBe("'''");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("class");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[3][2].value).toBe("Foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[3][3].value).toBe(":");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("r");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][2].value).toBe("'''");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("TEST");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][4].value).toBe("'''");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("class");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[6][2].value).toBe("Foo");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[6][3].value).toBe(":");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("R");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[7][2].value).toBe("'''");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("TEST");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][4].value).toBe("'''");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][0].value).toBe("class");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[9][1].value).toBe(" ");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[9][2].value).toBe("Foo");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[9][3].value).toBe(":");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("u");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[10][2].value).toBe("'''");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][3].value).toBe("TEST");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[10][4].value).toBe("'''");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][0].value).toBe("");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][0].value).toBe("class");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[12][1].value).toBe(" ");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[12][2].value).toBe("Foo");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[12][3].value).toBe(":");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe("U");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[13][2].value).toBe("'''");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[13][3].value).toBe("TEST");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[13][4].value).toBe("'''");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[14][0].value).toBe("");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[15][0].value).toBe("class");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[15][1].value).toBe(" ");
|
|
expect(tokens[15][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[15][2].value).toBe("Foo");
|
|
expect(tokens[15][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[15][3].value).toBe(":");
|
|
expect(tokens[15][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[16][0].value).toBe(" ");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe("b");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[16][2].value).toBe("'''");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[16][3].value).toBe("TEST");
|
|
expect(tokens[16][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[16][4].value).toBe("'''");
|
|
expect(tokens[16][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[17][0].value).toBe("");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[18][0].value).toBe("class");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[18][1].value).toBe(" ");
|
|
expect(tokens[18][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[18][2].value).toBe("Foo");
|
|
expect(tokens[18][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[18][3].value).toBe(":");
|
|
expect(tokens[18][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[19][0].value).toBe(" ");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[19][1].value).toBe("B");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[19][2].value).toBe("'''");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[19][3].value).toBe("TEST");
|
|
expect(tokens[19][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[19][4].value).toBe("'''");
|
|
expect(tokens[19][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/class2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Foo:\n \"\"\"TEST\"\"\"\n\nclass Foo:\n r\"\"\"TEST\"\"\"\n\nclass Foo:\n R\"\"\"TEST\"\"\"\n\nclass Foo:\n u\"\"\"TEST\"\"\"\n\nclass Foo:\n U\"\"\"TEST\"\"\"\n\nclass Foo:\n b\"\"\"TEST\"\"\"\n\nclass Foo:\n B\"\"\"TEST\"\"\"")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("\"\"\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TEST");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[1][3].value).toBe("\"\"\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("class");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[3][2].value).toBe("Foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[3][3].value).toBe(":");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("r");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][2].value).toBe("\"\"\"");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("TEST");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][4].value).toBe("\"\"\"");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("class");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[6][2].value).toBe("Foo");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[6][3].value).toBe(":");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("R");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[7][2].value).toBe("\"\"\"");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("TEST");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][4].value).toBe("\"\"\"");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][0].value).toBe("class");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[9][1].value).toBe(" ");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[9][2].value).toBe("Foo");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[9][3].value).toBe(":");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("u");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[10][2].value).toBe("\"\"\"");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][3].value).toBe("TEST");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[10][4].value).toBe("\"\"\"");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][0].value).toBe("");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][0].value).toBe("class");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[12][1].value).toBe(" ");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[12][2].value).toBe("Foo");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[12][3].value).toBe(":");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe("U");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[13][2].value).toBe("\"\"\"");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[13][3].value).toBe("TEST");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[13][4].value).toBe("\"\"\"");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[14][0].value).toBe("");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[15][0].value).toBe("class");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[15][1].value).toBe(" ");
|
|
expect(tokens[15][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[15][2].value).toBe("Foo");
|
|
expect(tokens[15][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[15][3].value).toBe(":");
|
|
expect(tokens[15][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[16][0].value).toBe(" ");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe("b");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[16][2].value).toBe("\"\"\"");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[16][3].value).toBe("TEST");
|
|
expect(tokens[16][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[16][4].value).toBe("\"\"\"");
|
|
expect(tokens[16][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[17][0].value).toBe("");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[18][0].value).toBe("class");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[18][1].value).toBe(" ");
|
|
expect(tokens[18][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[18][2].value).toBe("Foo");
|
|
expect(tokens[18][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[18][3].value).toBe(":");
|
|
expect(tokens[18][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[19][0].value).toBe(" ");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[19][1].value).toBe("B");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[19][2].value).toBe("\"\"\"");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[19][3].value).toBe("TEST");
|
|
expect(tokens[19][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[19][4].value).toBe("\"\"\"");
|
|
expect(tokens[19][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/codetag1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("''' foo bar XXX baz '''\n\ndef foo():\n ''' foo FIXME baz '''")
|
|
expect(tokens[0][0].value).toBe("'''");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe(" foo bar ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[0][2].value).toBe("XXX");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[0][3].value).toBe(" baz ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[0][4].value).toBe("'''");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][5].value).toBe(":");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("'''");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe(" foo ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][3].value).toBe("FIXME");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[3][4].value).toBe(" baz ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][5].value).toBe("'''");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/codetag2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("' foo bar XXX baz '\n\ndef foo():\n ' foo FIXME baz '")
|
|
expect(tokens[0][0].value).toBe("'");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe(" foo bar ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][2].value).toBe("XXX");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[0][3].value).toBe(" baz ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][5].value).toBe(":");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("'");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe(" foo ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[3][3].value).toBe("FIXME");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[3][4].value).toBe(" baz ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[3][5].value).toBe("'");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/continuation1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# not a docstring\na = \\\nr'''\n>>> print(42)\na[wer]\n'''\n\nb = \\\n# docstring\nr'''\n>>> print()\na[wer]\n'''")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" not a docstring");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("\\");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][5].value).toBe("");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("r");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("'''");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(">>> print");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("(");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[3][2].value).toBe("42");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][3].value).toBe(")");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.parenthesis.end.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[4][1].value).toBe("[");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[4][2].value).toBe("w");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[4][3].value).toBe("e");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[4][4].value).toBe("r");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[4][5].value).toBe("]");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[5][0].value).toBe("'''");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][0].value).toBe("b");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe(" ");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][2].value).toBe("=");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[7][3].value).toBe(" ");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][4].value).toBe("\\");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[7][5].value).toBe("");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][0].value).toBe("#");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[8][1].value).toBe(" docstring");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[9][0].value).toBe("r");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[9][1].value).toBe("'''");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][0].value).toBe(">>> ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[10][1].value).toBe("print()");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[11][0].value).toBe("a[wer]");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[12][0].value).toBe("'''");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/continuation2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'\n'\n# comment")
|
|
expect(tokens[0][0].value).toBe("'");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[1][0].value).toBe("'");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][1].value).toBe("");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[2][0].value).toBe("#");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][1].value).toBe(" comment");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/docstrings/continuation3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# not a docstring\na = \\\nr'>>> print(42)a[wer]'\n\nb = \\\n# docstring\nr'>>> print()a[wer]'")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" not a docstring");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("\\");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][5].value).toBe("");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("r");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("'");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe(">>> print");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[2][4].value).toBe("42");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[2][5].value).toBe(")");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.parenthesis.end.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[2][6].value).toBe("a");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[2][7].value).toBe("[");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[2][8].value).toBe("w");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][9].value).toBe("e");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][10].value).toBe("r");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][11].value).toBe("]");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[2][12].value).toBe("'");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("b");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("\\");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[4][5].value).toBe("");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("#");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[5][1].value).toBe(" docstring");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[6][0].value).toBe("r");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[6][1].value).toBe("'");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][2].value).toBe(">>> print()a[wer]");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[6][3].value).toBe("'");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/continuation4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines(" # not a docstring\n a = \\\n r'''\n >>> print(42)\n a[wer]\n '''\n\n b = \\\n # docstring\n r'''\n >>> print()\n a[wer]\n '''")
|
|
expect(tokens[0][0].value).toBe(" ");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe("#");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][2].value).toBe(" not a docstring");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("a");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe("=");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][5].value).toBe("\\");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][6].value).toBe("");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("r");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[2][2].value).toBe("'''");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" >>> print");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("(");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[3][2].value).toBe("42");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][3].value).toBe(")");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.parenthesis.end.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[4][0].value).toBe(" a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[4][1].value).toBe("[");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[4][2].value).toBe("w");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[4][3].value).toBe("e");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[4][4].value).toBe("r");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[4][5].value).toBe("]");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("'''");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("b");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][2].value).toBe(" ");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][3].value).toBe("=");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[7][4].value).toBe(" ");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][5].value).toBe("\\");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[7][6].value).toBe("");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe("#");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[8][2].value).toBe(" docstring");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][1].value).toBe("r");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[9][2].value).toBe("'''");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[10][1].value).toBe(">>> ");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[10][2].value).toBe("print()");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[11][0].value).toBe(" a[wer]");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[12][0].value).toBe(" ");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[12][1].value).toBe("'''");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/continuation5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'implicit ' \"concatenation\"\n\n'''implicit\n''' 'concatenation'\n\n'''implicit\n''' \"\"\"\nconcatenation\n\"\"\"\n\n'implicit' '''\nconcatenation\n'''")
|
|
expect(tokens[0][0].value).toBe("'");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("implicit ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][2].value).toBe("'");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("\"");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("concatenation");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][6].value).toBe("\"");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("'''");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][1].value).toBe("implicit");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][0].value).toBe("'''");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("'");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][3].value).toBe("concatenation");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[3][4].value).toBe("'");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("'''");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][1].value).toBe("implicit");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[6][0].value).toBe("'''");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][2].value).toBe("\"\"\"");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][0].value).toBe("concatenation");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[8][0].value).toBe("\"\"\"");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[9][0].value).toBe("");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][0].value).toBe("'");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][1].value).toBe("implicit");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[10][2].value).toBe("'");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[10][3].value).toBe(" ");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][4].value).toBe("'''");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[11][0].value).toBe("concatenation");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[12][0].value).toBe("'''");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/def1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo():\n '''TE\\'''ST'''\n\ndef foo():\n r'''TE\\'''ST'''\n\ndef foo():\n R'''TE\\'''ST'''\n\ndef foo():\n u'''TEST'''\n\ndef foo():\n U'''TEST'''\n\ndef foo():\n b'''TEST'''\n\ndef foo():\n B'''TEST'''")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("'''");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TE");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[1][3].value).toBe("\\'");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[1][4].value).toBe("''ST");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[1][5].value).toBe("'''");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("def");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[3][2].value).toBe("foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[3][3].value).toBe("(");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[3][4].value).toBe(")");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[3][5].value).toBe(":");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("r");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][2].value).toBe("'''");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("TE");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][4].value).toBe("\\'");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][5].value).toBe("''ST");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][6].value).toBe("'''");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("def");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][2].value).toBe("foo");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[6][3].value).toBe("(");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[6][4].value).toBe(")");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[6][5].value).toBe(":");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("R");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[7][2].value).toBe("'''");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("TE");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][4].value).toBe("\\'");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][5].value).toBe("''ST");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][6].value).toBe("'''");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][0].value).toBe("def");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[9][1].value).toBe(" ");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[9][2].value).toBe("foo");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[9][3].value).toBe("(");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[9][4].value).toBe(")");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[9][5].value).toBe(":");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("u");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[10][2].value).toBe("'''");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][3].value).toBe("TEST");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[10][4].value).toBe("'''");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][0].value).toBe("");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][0].value).toBe("def");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[12][1].value).toBe(" ");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[12][2].value).toBe("foo");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[12][3].value).toBe("(");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[12][4].value).toBe(")");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[12][5].value).toBe(":");
|
|
expect(tokens[12][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe("U");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[13][2].value).toBe("'''");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[13][3].value).toBe("TEST");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[13][4].value).toBe("'''");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[14][0].value).toBe("");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[15][0].value).toBe("def");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[15][1].value).toBe(" ");
|
|
expect(tokens[15][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[15][2].value).toBe("foo");
|
|
expect(tokens[15][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[15][3].value).toBe("(");
|
|
expect(tokens[15][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[15][4].value).toBe(")");
|
|
expect(tokens[15][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[15][5].value).toBe(":");
|
|
expect(tokens[15][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[16][0].value).toBe(" ");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe("b");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[16][2].value).toBe("'''");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[16][3].value).toBe("TEST");
|
|
expect(tokens[16][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[16][4].value).toBe("'''");
|
|
expect(tokens[16][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[17][0].value).toBe("");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[18][0].value).toBe("def");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[18][1].value).toBe(" ");
|
|
expect(tokens[18][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[18][2].value).toBe("foo");
|
|
expect(tokens[18][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[18][3].value).toBe("(");
|
|
expect(tokens[18][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[18][4].value).toBe(")");
|
|
expect(tokens[18][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[18][5].value).toBe(":");
|
|
expect(tokens[18][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[19][0].value).toBe(" ");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[19][1].value).toBe("B");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[19][2].value).toBe("'''");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[19][3].value).toBe("TEST");
|
|
expect(tokens[19][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[19][4].value).toBe("'''");
|
|
expect(tokens[19][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/def2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo():\n \"\"\"TE\\\"\"\"ST\"\"\"\n\ndef foo():\n r\"\"\"TE\\\"\"\"ST\"\"\"\n\ndef foo():\n R\"\"\"TE\\\"\"\"ST\"\"\"\n\ndef foo():\n u\"\"\"TEST\"\"\"\n\ndef foo():\n U\"\"\"TEST\"\"\"\n\ndef foo():\n b\"\"\"TEST\"\"\"\n\ndef foo():\n B\"\"\"TEST\"\"\"")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("\"\"\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TE");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[1][3].value).toBe("\\\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[1][4].value).toBe("\"\"ST");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[1][5].value).toBe("\"\"\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("def");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[3][2].value).toBe("foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[3][3].value).toBe("(");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[3][4].value).toBe(")");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[3][5].value).toBe(":");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("r");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][2].value).toBe("\"\"\"");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("TE");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][4].value).toBe("\\\"");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][5].value).toBe("\"\"ST");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][6].value).toBe("\"\"\"");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("def");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][2].value).toBe("foo");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[6][3].value).toBe("(");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[6][4].value).toBe(")");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[6][5].value).toBe(":");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("R");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[7][2].value).toBe("\"\"\"");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("TE");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][4].value).toBe("\\\"");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][5].value).toBe("\"\"ST");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][6].value).toBe("\"\"\"");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][0].value).toBe("def");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[9][1].value).toBe(" ");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[9][2].value).toBe("foo");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[9][3].value).toBe("(");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[9][4].value).toBe(")");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[9][5].value).toBe(":");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("u");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[10][2].value).toBe("\"\"\"");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][3].value).toBe("TEST");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[10][4].value).toBe("\"\"\"");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][0].value).toBe("");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][0].value).toBe("def");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[12][1].value).toBe(" ");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[12][2].value).toBe("foo");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[12][3].value).toBe("(");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[12][4].value).toBe(")");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[12][5].value).toBe(":");
|
|
expect(tokens[12][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe("U");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[13][2].value).toBe("\"\"\"");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[13][3].value).toBe("TEST");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[13][4].value).toBe("\"\"\"");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[14][0].value).toBe("");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[15][0].value).toBe("def");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[15][1].value).toBe(" ");
|
|
expect(tokens[15][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[15][2].value).toBe("foo");
|
|
expect(tokens[15][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[15][3].value).toBe("(");
|
|
expect(tokens[15][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[15][4].value).toBe(")");
|
|
expect(tokens[15][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[15][5].value).toBe(":");
|
|
expect(tokens[15][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[16][0].value).toBe(" ");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe("b");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[16][2].value).toBe("\"\"\"");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[16][3].value).toBe("TEST");
|
|
expect(tokens[16][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[16][4].value).toBe("\"\"\"");
|
|
expect(tokens[16][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[17][0].value).toBe("");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[18][0].value).toBe("def");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[18][1].value).toBe(" ");
|
|
expect(tokens[18][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[18][2].value).toBe("foo");
|
|
expect(tokens[18][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[18][3].value).toBe("(");
|
|
expect(tokens[18][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[18][4].value).toBe(")");
|
|
expect(tokens[18][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[18][5].value).toBe(":");
|
|
expect(tokens[18][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[19][0].value).toBe(" ");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[19][1].value).toBe("B");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[19][2].value).toBe("\"\"\"");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[19][3].value).toBe("TEST");
|
|
expect(tokens[19][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[19][4].value).toBe("\"\"\"");
|
|
expect(tokens[19][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/def3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo():\n 'TE\\'ST'\n\ndef foo():\n r'TE\\'ST'\n\ndef foo():\n R'TE\\'ST'\n\ndef foo():\n u'TEST'\n\ndef foo():\n U'TEST'\n\ndef foo():\n b'TEST'\n\ndef foo():\n B'TEST'")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("'");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TE");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[1][3].value).toBe("\\'");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][4].value).toBe("ST");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("def");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[3][2].value).toBe("foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[3][3].value).toBe("(");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[3][4].value).toBe(")");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[3][5].value).toBe(":");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("r");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][2].value).toBe("'");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("TE");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[4][4].value).toBe("\\'");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[4][5].value).toBe("ST");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[4][6].value).toBe("'");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("def");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][2].value).toBe("foo");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[6][3].value).toBe("(");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[6][4].value).toBe(")");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[6][5].value).toBe(":");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("R");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[7][2].value).toBe("'");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("TE");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[7][4].value).toBe("\\'");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[7][5].value).toBe("ST");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[7][6].value).toBe("'");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][0].value).toBe("def");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[9][1].value).toBe(" ");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[9][2].value).toBe("foo");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[9][3].value).toBe("(");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[9][4].value).toBe(")");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[9][5].value).toBe(":");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("u");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[10][2].value).toBe("'");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][3].value).toBe("TEST");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[10][4].value).toBe("'");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][0].value).toBe("");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][0].value).toBe("def");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[12][1].value).toBe(" ");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[12][2].value).toBe("foo");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[12][3].value).toBe("(");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[12][4].value).toBe(")");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[12][5].value).toBe(":");
|
|
expect(tokens[12][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe("U");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[13][2].value).toBe("'");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[13][3].value).toBe("TEST");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[13][4].value).toBe("'");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[14][0].value).toBe("");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[15][0].value).toBe("def");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[15][1].value).toBe(" ");
|
|
expect(tokens[15][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[15][2].value).toBe("foo");
|
|
expect(tokens[15][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[15][3].value).toBe("(");
|
|
expect(tokens[15][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[15][4].value).toBe(")");
|
|
expect(tokens[15][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[15][5].value).toBe(":");
|
|
expect(tokens[15][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[16][0].value).toBe(" ");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe("b");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[16][2].value).toBe("'");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[16][3].value).toBe("TEST");
|
|
expect(tokens[16][3].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[16][4].value).toBe("'");
|
|
expect(tokens[16][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[17][0].value).toBe("");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[18][0].value).toBe("def");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[18][1].value).toBe(" ");
|
|
expect(tokens[18][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[18][2].value).toBe("foo");
|
|
expect(tokens[18][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[18][3].value).toBe("(");
|
|
expect(tokens[18][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[18][4].value).toBe(")");
|
|
expect(tokens[18][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[18][5].value).toBe(":");
|
|
expect(tokens[18][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[19][0].value).toBe(" ");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[19][1].value).toBe("B");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[19][2].value).toBe("'");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[19][3].value).toBe("TEST");
|
|
expect(tokens[19][3].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[19][4].value).toBe("'");
|
|
expect(tokens[19][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/def4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo():\n \"TE\\\"ST\"\n\ndef foo():\n r\"TE\\\"ST\"\n\ndef foo():\n R\"TE\\\"ST\"\n\ndef foo():\n u\"TEST\"\n\ndef foo():\n U\"TEST\"\n\ndef foo():\n b\"TEST\"\n\ndef foo():\n B\"TEST\"")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TE");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[1][3].value).toBe("\\\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][4].value).toBe("ST");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[1][5].value).toBe("\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("def");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[3][2].value).toBe("foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[3][3].value).toBe("(");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[3][4].value).toBe(")");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[3][5].value).toBe(":");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("r");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][2].value).toBe("\"");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("TE");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[4][4].value).toBe("\\\"");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[4][5].value).toBe("ST");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[4][6].value).toBe("\"");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("def");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][2].value).toBe("foo");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[6][3].value).toBe("(");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[6][4].value).toBe(")");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[6][5].value).toBe(":");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("R");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[7][2].value).toBe("\"");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("TE");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[7][4].value).toBe("\\\"");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[7][5].value).toBe("ST");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[7][6].value).toBe("\"");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][0].value).toBe("def");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[9][1].value).toBe(" ");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[9][2].value).toBe("foo");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[9][3].value).toBe("(");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[9][4].value).toBe(")");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[9][5].value).toBe(":");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("u");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[10][2].value).toBe("\"");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][3].value).toBe("TEST");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[10][4].value).toBe("\"");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][0].value).toBe("");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][0].value).toBe("def");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[12][1].value).toBe(" ");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[12][2].value).toBe("foo");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[12][3].value).toBe("(");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[12][4].value).toBe(")");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[12][5].value).toBe(":");
|
|
expect(tokens[12][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe("U");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[13][2].value).toBe("\"");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[13][3].value).toBe("TEST");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[13][4].value).toBe("\"");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[14][0].value).toBe("");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[15][0].value).toBe("def");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[15][1].value).toBe(" ");
|
|
expect(tokens[15][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[15][2].value).toBe("foo");
|
|
expect(tokens[15][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[15][3].value).toBe("(");
|
|
expect(tokens[15][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[15][4].value).toBe(")");
|
|
expect(tokens[15][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[15][5].value).toBe(":");
|
|
expect(tokens[15][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[16][0].value).toBe(" ");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe("b");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[16][2].value).toBe("\"");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[16][3].value).toBe("TEST");
|
|
expect(tokens[16][3].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[16][4].value).toBe("\"");
|
|
expect(tokens[16][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[17][0].value).toBe("");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[18][0].value).toBe("def");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[18][1].value).toBe(" ");
|
|
expect(tokens[18][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[18][2].value).toBe("foo");
|
|
expect(tokens[18][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[18][3].value).toBe("(");
|
|
expect(tokens[18][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[18][4].value).toBe(")");
|
|
expect(tokens[18][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[18][5].value).toBe(":");
|
|
expect(tokens[18][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[19][0].value).toBe(" ");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[19][1].value).toBe("B");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[19][2].value).toBe("\"");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[19][3].value).toBe("TEST");
|
|
expect(tokens[19][3].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[19][4].value).toBe("\"");
|
|
expect(tokens[19][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/escaping1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'''Module docstring\n\n {{ %d simple \\\\ string \\\n foo \\' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\n\n multiline \"unicode\" string \\\n \\xf1 \\u1234aaaa \\U1234aaaa\n \\N{BLACK SPADE SUIT}\n'''")
|
|
expect(tokens[0][0].value).toBe("'''");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("Module docstring");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" {{ %d simple ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[2][1].value).toBe("\\\\");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[2][2].value).toBe(" string ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[2][3].value).toBe("\\");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.language.python"]);
|
|
expect(tokens[3][0].value).toBe(" foo ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("\\'");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][3].value).toBe("\\\"");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][5].value).toBe("\\a");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][6].value).toBe(" ");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][7].value).toBe("\\b");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][8].value).toBe(" \\c ");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][9].value).toBe("\\f");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][10].value).toBe(" ");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][11].value).toBe("\\n");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][12].value).toBe(" ");
|
|
expect(tokens[3][12].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][13].value).toBe("\\r");
|
|
expect(tokens[3][13].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][14].value).toBe(" ");
|
|
expect(tokens[3][14].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][15].value).toBe("\\t");
|
|
expect(tokens[3][15].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][16].value).toBe(" ");
|
|
expect(tokens[3][16].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][17].value).toBe("\\v");
|
|
expect(tokens[3][17].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][18].value).toBe(" ");
|
|
expect(tokens[3][18].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][19].value).toBe("\\5");
|
|
expect(tokens[3][19].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][20].value).toBe(" ");
|
|
expect(tokens[3][20].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][21].value).toBe("\\55");
|
|
expect(tokens[3][21].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][22].value).toBe(" ");
|
|
expect(tokens[3][22].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][23].value).toBe("\\555");
|
|
expect(tokens[3][23].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][24].value).toBe(" ");
|
|
expect(tokens[3][24].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][25].value).toBe("\\05");
|
|
expect(tokens[3][25].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][26].value).toBe(" ");
|
|
expect(tokens[3][26].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][27].value).toBe("\\005");
|
|
expect(tokens[3][27].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[5][0].value).toBe(" multiline \"unicode\" string ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("\\");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.language.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[6][1].value).toBe("\\xf1");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[6][2].value).toBe(" ");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[6][3].value).toBe("\\u1234");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[6][4].value).toBe("aaaa ");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[6][5].value).toBe("\\U1234aaaa");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[7][1].value).toBe("\\N{BLACK SPADE SUIT}");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[8][0].value).toBe("'''");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/escaping2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("r'''Module docstring\n\n {{ %d simple \\\\ string \\\n foo \\' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\n\n multiline \"unicode\" string \\\n \\xf1 \\u1234aaaa \\U1234aaaa\n \\N{BLACK SPADE SUIT}\n >>> aaa\n'''\n\nR'''Module docstring\n\n {{ %d simple \\\\ string \\\n foo \\' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\n\n multiline \"unicode\" string \\\n \\xf1 \\u1234aaaa \\U1234aaaa\n \\N{BLACK SPADE SUIT}\n >>> aaa\n'''")
|
|
expect(tokens[0][0].value).toBe("r");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][1].value).toBe("'''");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("Module docstring");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" {{ %d simple ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][1].value).toBe("\\\\");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][2].value).toBe(" string ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][3].value).toBe("\\");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" foo ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("\\'");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][3].value).toBe("\\\"");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][4].value).toBe(" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[5][0].value).toBe(" multiline \"unicode\" string ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("\\");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[6][0].value).toBe(" \\xf1 \\u1234aaaa \\U1234aaaa");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][0].value).toBe(" \\N{BLACK SPADE SUIT}");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[8][1].value).toBe(">>> ");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[8][2].value).toBe("aaa");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[9][0].value).toBe("'''");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[10][0].value).toBe("");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[11][0].value).toBe("R");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[11][1].value).toBe("'''");
|
|
expect(tokens[11][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[11][2].value).toBe("Module docstring");
|
|
expect(tokens[11][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[12][0].value).toBe("");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[13][0].value).toBe(" {{ %d simple ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[13][1].value).toBe("\\\\");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[13][2].value).toBe(" string ");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[13][3].value).toBe("\\");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[14][0].value).toBe(" foo ");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[14][1].value).toBe("\\'");
|
|
expect(tokens[14][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[14][2].value).toBe(" ");
|
|
expect(tokens[14][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[14][3].value).toBe("\\\"");
|
|
expect(tokens[14][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[14][4].value).toBe(" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005");
|
|
expect(tokens[14][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[15][0].value).toBe("");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[16][0].value).toBe(" multiline \"unicode\" string ");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[16][1].value).toBe("\\");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[17][0].value).toBe(" \\xf1 \\u1234aaaa \\U1234aaaa");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[18][0].value).toBe(" \\N{BLACK SPADE SUIT}");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[19][0].value).toBe(" ");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[19][1].value).toBe(">>> ");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[19][2].value).toBe("aaa");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[20][0].value).toBe("'''");
|
|
expect(tokens[20][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/escaping3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("r'''Module docstring\n\n (?x) # not a regexp\n foo[20]{42} # not a comment\n'''")
|
|
expect(tokens[0][0].value).toBe("r");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][1].value).toBe("'''");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("Module docstring");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" (?x) # not a regexp");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" foo[20]{42} # not a comment");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("'''");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/format1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("r'''Module docstring\n\n %(language)s has %(number)03d quote types.\n'''")
|
|
expect(tokens[0][0].value).toBe("r");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][1].value).toBe("'''");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("Module docstring");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" %(language)s has %(number)03d quote types.");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][0].value).toBe("'''");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/format2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'''{foo}'''")
|
|
expect(tokens[0][0].value).toBe("'''");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("{foo}");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[0][2].value).toBe("'''");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/mix1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'''TEST'''\n\nclass Foo:\n # comment\n R'''TEST'''\n\n def foo(self, a:'''TEST''') -> '''TEST''': #ok\n r'''TEST'''\n with bar:\n pass\n\n def bar(self, a:'''TEST''') -> '''TEST''': pass\n '''TEST''' # additional docstring\n with bar:\n pass")
|
|
expect(tokens[0][0].value).toBe("'''");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("TEST");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[0][2].value).toBe("'''");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("class");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[2][2].value).toBe("Foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[2][3].value).toBe(":");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("#");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][2].value).toBe(" comment");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("R");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][2].value).toBe("'''");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("TEST");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][4].value).toBe("'''");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][1].value).toBe("def");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[6][2].value).toBe(" ");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][3].value).toBe("foo");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[6][4].value).toBe("(");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[6][5].value).toBe("self");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[6][6].value).toBe(",");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[6][7].value).toBe(" ");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[6][8].value).toBe("a");
|
|
expect(tokens[6][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[6][9].value).toBe(":");
|
|
expect(tokens[6][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[6][10].value).toBe("'''");
|
|
expect(tokens[6][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][11].value).toBe("TEST");
|
|
expect(tokens[6][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.multi.python"]);
|
|
expect(tokens[6][12].value).toBe("'''");
|
|
expect(tokens[6][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][13].value).toBe(")");
|
|
expect(tokens[6][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[6][14].value).toBe(" ");
|
|
expect(tokens[6][14].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][15].value).toBe("->");
|
|
expect(tokens[6][15].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.annotation.result.python"]);
|
|
expect(tokens[6][16].value).toBe(" ");
|
|
expect(tokens[6][16].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][17].value).toBe("'''");
|
|
expect(tokens[6][17].scopes).toEqual(["source.python","meta.function.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][18].value).toBe("TEST");
|
|
expect(tokens[6][18].scopes).toEqual(["source.python","meta.function.python","string.quoted.multi.python"]);
|
|
expect(tokens[6][19].value).toBe("'''");
|
|
expect(tokens[6][19].scopes).toEqual(["source.python","meta.function.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][20].value).toBe(":");
|
|
expect(tokens[6][20].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[6][21].value).toBe(" ");
|
|
expect(tokens[6][21].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][22].value).toBe("#");
|
|
expect(tokens[6][22].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[6][23].value).toBe("ok");
|
|
expect(tokens[6][23].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("r");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[7][2].value).toBe("'''");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("TEST");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][4].value).toBe("'''");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe("with");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[8][2].value).toBe(" ");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][3].value).toBe("bar");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][4].value).toBe(":");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][1].value).toBe("pass");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[10][0].value).toBe("");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[11][0].value).toBe(" ");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[11][1].value).toBe("def");
|
|
expect(tokens[11][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[11][2].value).toBe(" ");
|
|
expect(tokens[11][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[11][3].value).toBe("bar");
|
|
expect(tokens[11][3].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[11][4].value).toBe("(");
|
|
expect(tokens[11][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[11][5].value).toBe("self");
|
|
expect(tokens[11][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[11][6].value).toBe(",");
|
|
expect(tokens[11][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[11][7].value).toBe(" ");
|
|
expect(tokens[11][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[11][8].value).toBe("a");
|
|
expect(tokens[11][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[11][9].value).toBe(":");
|
|
expect(tokens[11][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[11][10].value).toBe("'''");
|
|
expect(tokens[11][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[11][11].value).toBe("TEST");
|
|
expect(tokens[11][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.multi.python"]);
|
|
expect(tokens[11][12].value).toBe("'''");
|
|
expect(tokens[11][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][13].value).toBe(")");
|
|
expect(tokens[11][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[11][14].value).toBe(" ");
|
|
expect(tokens[11][14].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[11][15].value).toBe("->");
|
|
expect(tokens[11][15].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.annotation.result.python"]);
|
|
expect(tokens[11][16].value).toBe(" ");
|
|
expect(tokens[11][16].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[11][17].value).toBe("'''");
|
|
expect(tokens[11][17].scopes).toEqual(["source.python","meta.function.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[11][18].value).toBe("TEST");
|
|
expect(tokens[11][18].scopes).toEqual(["source.python","meta.function.python","string.quoted.multi.python"]);
|
|
expect(tokens[11][19].value).toBe("'''");
|
|
expect(tokens[11][19].scopes).toEqual(["source.python","meta.function.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][20].value).toBe(":");
|
|
expect(tokens[11][20].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[11][21].value).toBe(" ");
|
|
expect(tokens[11][21].scopes).toEqual(["source.python"]);
|
|
expect(tokens[11][22].value).toBe("pass");
|
|
expect(tokens[11][22].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[12][0].value).toBe(" ");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][1].value).toBe("'''");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[12][2].value).toBe("TEST");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[12][3].value).toBe("'''");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[12][4].value).toBe(" ");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][5].value).toBe("#");
|
|
expect(tokens[12][5].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[12][6].value).toBe(" additional docstring");
|
|
expect(tokens[12][6].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe("with");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[13][2].value).toBe(" ");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][3].value).toBe("bar");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][4].value).toBe(":");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[14][0].value).toBe(" ");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[14][1].value).toBe("pass");
|
|
expect(tokens[14][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/docstrings/mix2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'TEST'\n\nclass Foo:\n # comment\n R'TEST'\n\n def foo(self, a:'TEST') -> 'TEST': #ok\n r'TEST'\n with bar:\n pass\n\n def bar(self, a:'TEST') -> 'TEST': pass\n 'TEST' # additional docstring\n with bar:\n pass")
|
|
expect(tokens[0][0].value).toBe("'");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("TEST");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][2].value).toBe("'");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("class");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[2][2].value).toBe("Foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[2][3].value).toBe(":");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("#");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][2].value).toBe(" comment");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("R");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][2].value).toBe("'");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("TEST");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[4][4].value).toBe("'");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][1].value).toBe("def");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[6][2].value).toBe(" ");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][3].value).toBe("foo");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[6][4].value).toBe("(");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[6][5].value).toBe("self");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[6][6].value).toBe(",");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[6][7].value).toBe(" ");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[6][8].value).toBe("a");
|
|
expect(tokens[6][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[6][9].value).toBe(":");
|
|
expect(tokens[6][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[6][10].value).toBe("'");
|
|
expect(tokens[6][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][11].value).toBe("TEST");
|
|
expect(tokens[6][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[6][12].value).toBe("'");
|
|
expect(tokens[6][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][13].value).toBe(")");
|
|
expect(tokens[6][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[6][14].value).toBe(" ");
|
|
expect(tokens[6][14].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][15].value).toBe("->");
|
|
expect(tokens[6][15].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.annotation.result.python"]);
|
|
expect(tokens[6][16].value).toBe(" ");
|
|
expect(tokens[6][16].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][17].value).toBe("'");
|
|
expect(tokens[6][17].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][18].value).toBe("TEST");
|
|
expect(tokens[6][18].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python"]);
|
|
expect(tokens[6][19].value).toBe("'");
|
|
expect(tokens[6][19].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][20].value).toBe(":");
|
|
expect(tokens[6][20].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[6][21].value).toBe(" ");
|
|
expect(tokens[6][21].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][22].value).toBe("#");
|
|
expect(tokens[6][22].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[6][23].value).toBe("ok");
|
|
expect(tokens[6][23].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("r");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[7][2].value).toBe("'");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("TEST");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[7][4].value).toBe("'");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe("with");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[8][2].value).toBe(" ");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][3].value).toBe("bar");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][4].value).toBe(":");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][1].value).toBe("pass");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[10][0].value).toBe("");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[11][0].value).toBe(" ");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[11][1].value).toBe("def");
|
|
expect(tokens[11][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[11][2].value).toBe(" ");
|
|
expect(tokens[11][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[11][3].value).toBe("bar");
|
|
expect(tokens[11][3].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[11][4].value).toBe("(");
|
|
expect(tokens[11][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[11][5].value).toBe("self");
|
|
expect(tokens[11][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[11][6].value).toBe(",");
|
|
expect(tokens[11][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[11][7].value).toBe(" ");
|
|
expect(tokens[11][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[11][8].value).toBe("a");
|
|
expect(tokens[11][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[11][9].value).toBe(":");
|
|
expect(tokens[11][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[11][10].value).toBe("'");
|
|
expect(tokens[11][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[11][11].value).toBe("TEST");
|
|
expect(tokens[11][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[11][12].value).toBe("'");
|
|
expect(tokens[11][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][13].value).toBe(")");
|
|
expect(tokens[11][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[11][14].value).toBe(" ");
|
|
expect(tokens[11][14].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[11][15].value).toBe("->");
|
|
expect(tokens[11][15].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.annotation.result.python"]);
|
|
expect(tokens[11][16].value).toBe(" ");
|
|
expect(tokens[11][16].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[11][17].value).toBe("'");
|
|
expect(tokens[11][17].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[11][18].value).toBe("TEST");
|
|
expect(tokens[11][18].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python"]);
|
|
expect(tokens[11][19].value).toBe("'");
|
|
expect(tokens[11][19].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[11][20].value).toBe(":");
|
|
expect(tokens[11][20].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[11][21].value).toBe(" ");
|
|
expect(tokens[11][21].scopes).toEqual(["source.python"]);
|
|
expect(tokens[11][22].value).toBe("pass");
|
|
expect(tokens[11][22].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[12][0].value).toBe(" ");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][1].value).toBe("'");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[12][2].value).toBe("TEST");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[12][3].value).toBe("'");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[12][4].value).toBe(" ");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][5].value).toBe("#");
|
|
expect(tokens[12][5].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[12][6].value).toBe(" additional docstring");
|
|
expect(tokens[12][6].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][1].value).toBe("with");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[13][2].value).toBe(" ");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][3].value).toBe("bar");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[13][4].value).toBe(":");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[14][0].value).toBe(" ");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[14][1].value).toBe("pass");
|
|
expect(tokens[14][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/docstrings/module1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'''TEST'''\nr'''TEST'''\nR'''TEST'''\n\nu'''TEST'''\nU'''TEST'''\nb'''TEST'''\nB'''TEST'''")
|
|
expect(tokens[0][0].value).toBe("'''");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("TEST");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[0][2].value).toBe("'''");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("r");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[1][1].value).toBe("'''");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TEST");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[1][3].value).toBe("'''");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("R");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("'''");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("TEST");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][3].value).toBe("'''");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("u");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][1].value).toBe("'''");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][2].value).toBe("TEST");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[4][3].value).toBe("'''");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("U");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[5][1].value).toBe("'''");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][2].value).toBe("TEST");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[5][3].value).toBe("'''");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("b");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[6][1].value).toBe("'''");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][2].value).toBe("TEST");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[6][3].value).toBe("'''");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][0].value).toBe("B");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[7][1].value).toBe("'''");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][2].value).toBe("TEST");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[7][3].value).toBe("'''");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/module2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("\"\"\"TEST\"\"\"\nr\"\"\"TEST\"\"\"\nR\"\"\"TEST\"\"\"\n\nu\"\"\"TEST\"\"\"\nU\"\"\"TEST\"\"\"\nb\"\"\"TEST\"\"\"\nB\"\"\"TEST\"\"\"")
|
|
expect(tokens[0][0].value).toBe("\"\"\"");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("TEST");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[0][2].value).toBe("\"\"\"");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("r");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[1][1].value).toBe("\"\"\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TEST");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[1][3].value).toBe("\"\"\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("R");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("\"\"\"");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("TEST");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][3].value).toBe("\"\"\"");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("u");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][1].value).toBe("\"\"\"");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][2].value).toBe("TEST");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[4][3].value).toBe("\"\"\"");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("U");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[5][1].value).toBe("\"\"\"");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][2].value).toBe("TEST");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[5][3].value).toBe("\"\"\"");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("b");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[6][1].value).toBe("\"\"\"");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][2].value).toBe("TEST");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[6][3].value).toBe("\"\"\"");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][0].value).toBe("B");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[7][1].value).toBe("\"\"\"");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][2].value).toBe("TEST");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[7][3].value).toBe("\"\"\"");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/module3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'TE\\'ST'\nr'TE\\'ST'\nR'TE\\'ST'\n\nu'TEST'\nU'TEST'\nb'TEST'\nB'TEST'")
|
|
expect(tokens[0][0].value).toBe("'");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("TE");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][2].value).toBe("\\'");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python","constant.character.escape.python"]);
|
|
expect(tokens[0][3].value).toBe("ST");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("r");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][1].value).toBe("'");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TE");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[1][3].value).toBe("\\'");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[1][4].value).toBe("ST");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("R");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("'");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("TE");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[2][3].value).toBe("\\'");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[2][4].value).toBe("ST");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("u");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][1].value).toBe("'");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][2].value).toBe("TEST");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[4][3].value).toBe("'");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("U");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[5][1].value).toBe("'");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][2].value).toBe("TEST");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[5][3].value).toBe("'");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("b");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[6][1].value).toBe("'");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][2].value).toBe("TEST");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[6][3].value).toBe("'");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][0].value).toBe("B");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[7][1].value).toBe("'");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][2].value).toBe("TEST");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[7][3].value).toBe("'");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/module4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("\"TE\\\"ST\"\nr\"TE\\\"ST\"\nR\"TE\\\"ST\"\n\nu\"TEST\"\nU\"TEST\"\nb\"TEST\"\nB\"TEST\"")
|
|
expect(tokens[0][0].value).toBe("\"");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("TE");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][2].value).toBe("\\\"");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python","constant.character.escape.python"]);
|
|
expect(tokens[0][3].value).toBe("ST");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[0][4].value).toBe("\"");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("r");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][1].value).toBe("\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("TE");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[1][3].value).toBe("\\\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[1][4].value).toBe("ST");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[1][5].value).toBe("\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("R");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("\"");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("TE");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[2][3].value).toBe("\\\"");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[2][4].value).toBe("ST");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python"]);
|
|
expect(tokens[2][5].value).toBe("\"");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.docstring.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("u");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][1].value).toBe("\"");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][2].value).toBe("TEST");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[4][3].value).toBe("\"");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("U");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[5][1].value).toBe("\"");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][2].value).toBe("TEST");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[5][3].value).toBe("\"");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("b");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[6][1].value).toBe("\"");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][2].value).toBe("TEST");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[6][3].value).toBe("\"");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][0].value).toBe("B");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[7][1].value).toBe("\"");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][2].value).toBe("TEST");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[7][3].value).toBe("\"");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/oneline1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'''>>> print(\"\"\"docstring\"\"\")'''\nasync\n\"\"\">>> print('''docstring''')\"\"\"\nawait\n\"\"\"\\n>>> print('''docstring''')\"\"\"\nawait\n\"\"\" >>> print('''docstring''')\"\"\"\nawait\n\"\"\" 1 >>> print('''docstring''')\"\"\"\nawait")
|
|
expect(tokens[0][0].value).toBe("'''");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe(">>> ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][2].value).toBe("print(\"\"\"docstring\"\"\")");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[0][3].value).toBe("'''");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("async");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("\"\"\"");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][1].value).toBe(">>> ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][2].value).toBe("print('''docstring''')");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[2][3].value).toBe("\"\"\"");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("await");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][0].value).toBe("\"\"\"");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][1].value).toBe("\\n");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[4][2].value).toBe(">>> print('''docstring''')");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[4][3].value).toBe("\"\"\"");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("await");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[6][0].value).toBe("\"\"\"");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[6][2].value).toBe(">>> ");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[6][3].value).toBe("print('''docstring''')");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[6][4].value).toBe("\"\"\"");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][0].value).toBe("await");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[8][0].value).toBe("\"\"\"");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[8][1].value).toBe(" 1 >>> print('''docstring''')");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[8][2].value).toBe("\"\"\"");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[9][0].value).toBe("await");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/docstrings/oneline2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo():\n '''>>> print(\"\"\"docstring\"\"\")'''\ndef foo():\n \"\"\">>> print('''docstring''')\"\"\"")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("'''");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe(">>> ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][3].value).toBe("print(\"\"\"docstring\"\"\")");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[1][4].value).toBe("'''");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][5].value).toBe(":");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("\"\"\"");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe(">>> ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[3][3].value).toBe("print('''docstring''')");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][4].value).toBe("\"\"\"");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/oneline3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo():\n '>>> print(\"docstring\")'\ndef foo():\n \">>> print('docstring')\"")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("'");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe(">>> print(\"docstring\")");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[1][3].value).toBe("'");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][5].value).toBe(":");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("\"");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe(">>> print('docstring')");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[3][3].value).toBe("\"");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/prompt1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("r'''Module docstring\n\n Some text followed by code sample:\n >>> for a in foo(2, b=1,\n ... c=3):\n ... print(a)\n 0\n 1\n'''")
|
|
expect(tokens[0][0].value).toBe("r");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][1].value).toBe("'''");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("Module docstring");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" Some text followed by code sample:");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[3][1].value).toBe(">>> ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[3][2].value).toBe("for a in foo(2, b=1,");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[4][1].value).toBe("... ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][2].value).toBe(" c=3):");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("... ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","keyword.control.flow.python"]);
|
|
expect(tokens[5][2].value).toBe(" print(a)");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[6][0].value).toBe(" 0");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[7][0].value).toBe(" 1");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python"]);
|
|
expect(tokens[8][0].value).toBe("'''");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","string.quoted.docstring.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/prompt2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("\"\"\"\n def foo():\n ...\n >>>\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("\"\"\"");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" def foo():");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" ...");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" >>>");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("\"\"\"");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/docstrings/prompt3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("'''...'''\n...")
|
|
expect(tokens[0][0].value).toBe("'''");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("...");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[0][2].value).toBe("'''");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("...");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.other.ellipsis.python"]);
|
|
});
|
|
|
|
it("test/docstrings/regr1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("#:\n @asd\n def foo():\n pass")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(":");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[1][1].value).toBe("@");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[1][2].value).toBe("asd");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][1].value).toBe("def");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][3].value).toBe("foo");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][4].value).toBe("(");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][5].value).toBe(")");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][6].value).toBe(":");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("pass");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/expressions/const1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("QQQQ QQQQ_123 QQQQ123 PROTOCOL_v2 QQQ.bar baz.AA_a _AAA foo._AAA\nQQQq QQQq123 self.FOOO() _ _1 __1 _1A __1A _a __a __ ___ ___a ___1 __aA ___Aa")
|
|
expect(tokens[0][0].value).toBe("QQQQ");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("QQQQ_123");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("QQQQ123");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("PROTOCOL_v2");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("QQQ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][9].value).toBe(".");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][10].value).toBe("bar");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe(" ");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][12].value).toBe("baz");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][13].value).toBe(".");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][14].value).toBe("AA_a");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][15].value).toBe(" ");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][16].value).toBe("_AAA");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][17].value).toBe(" ");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][18].value).toBe("foo");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][19].value).toBe(".");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][20].value).toBe("_AAA");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[1][0].value).toBe("QQQq");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("QQQq123");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("self");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","variable.language.special.self.python"]);
|
|
expect(tokens[1][5].value).toBe(".");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][6].value).toBe("FOOO");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[1][7].value).toBe("(");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][8].value).toBe(")");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][9].value).toBe(" ");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][10].value).toBe("_");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][11].value).toBe(" ");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][12].value).toBe("_1");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][13].value).toBe(" ");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][14].value).toBe("__1");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][15].value).toBe(" ");
|
|
expect(tokens[1][15].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][16].value).toBe("_1A");
|
|
expect(tokens[1][16].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][17].value).toBe(" ");
|
|
expect(tokens[1][17].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][18].value).toBe("__1A");
|
|
expect(tokens[1][18].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][19].value).toBe(" ");
|
|
expect(tokens[1][19].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][20].value).toBe("_a");
|
|
expect(tokens[1][20].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][21].value).toBe(" ");
|
|
expect(tokens[1][21].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][22].value).toBe("__a");
|
|
expect(tokens[1][22].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][23].value).toBe(" ");
|
|
expect(tokens[1][23].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][24].value).toBe("__");
|
|
expect(tokens[1][24].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][25].value).toBe(" ");
|
|
expect(tokens[1][25].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][26].value).toBe("___");
|
|
expect(tokens[1][26].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][27].value).toBe(" ");
|
|
expect(tokens[1][27].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][28].value).toBe("___a");
|
|
expect(tokens[1][28].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][29].value).toBe(" ");
|
|
expect(tokens[1][29].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][30].value).toBe("___1");
|
|
expect(tokens[1][30].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][31].value).toBe(" ");
|
|
expect(tokens[1][31].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][32].value).toBe("__aA");
|
|
expect(tokens[1][32].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][33].value).toBe(" ");
|
|
expect(tokens[1][33].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][34].value).toBe("___Aa");
|
|
expect(tokens[1][34].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/const2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("_AA __AB ___AA\n_A __A ___A A1 A_1 _A_1 A_foo")
|
|
expect(tokens[0][0].value).toBe("_AA");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("__AB");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("___AA");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[1][0].value).toBe("_A");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("__A");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("___A");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("A1");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][8].value).toBe("A_1");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][9].value).toBe(" ");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][10].value).toBe("_A_1");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][11].value).toBe(" ");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][12].value).toBe("A_foo");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/const3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("T61STRING = 20\nT61_STRING\nT_STRING\n_T_S_T_R_I_N_G_\nA_CLASS\n\n# not enough upper-case letters in the beginning\n_T_s_TRING\nA_Class")
|
|
expect(tokens[0][0].value).toBe("T61STRING");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("20");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][0].value).toBe("T61_STRING");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[2][0].value).toBe("T_STRING");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[3][0].value).toBe("_T_S_T_R_I_N_G_");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[4][0].value).toBe("A_CLASS");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("#");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[6][1].value).toBe(" not enough upper-case letters in the beginning");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[7][0].value).toBe("_T_s_TRING");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][0].value).toBe("A_Class");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("~a + b @ c ^ d // e % f & e and not g or h")
|
|
expect(tokens[0][0].value).toBe("~");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.operator.bitwise.python"]);
|
|
expect(tokens[0][1].value).toBe("a");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe(" ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe("+");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("b");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("@");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("c");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("^");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","keyword.operator.bitwise.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][13].value).toBe("d");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][14].value).toBe(" ");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][15].value).toBe("//");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][16].value).toBe(" ");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][17].value).toBe("e");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][18].value).toBe(" ");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][19].value).toBe("%");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][20].value).toBe(" ");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][21].value).toBe("f");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][22].value).toBe(" ");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][23].value).toBe("&");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","keyword.operator.bitwise.python"]);
|
|
expect(tokens[0][24].value).toBe(" ");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][25].value).toBe("e");
|
|
expect(tokens[0][25].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][26].value).toBe(" ");
|
|
expect(tokens[0][26].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][27].value).toBe("and");
|
|
expect(tokens[0][27].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[0][28].value).toBe(" ");
|
|
expect(tokens[0][28].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][29].value).toBe("not");
|
|
expect(tokens[0][29].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[0][30].value).toBe(" ");
|
|
expect(tokens[0][30].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][31].value).toBe("g");
|
|
expect(tokens[0][31].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][32].value).toBe(" ");
|
|
expect(tokens[0][32].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][33].value).toBe("or");
|
|
expect(tokens[0][33].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[0][34].value).toBe(" ");
|
|
expect(tokens[0][34].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][35].value).toBe("h");
|
|
expect(tokens[0][35].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr10.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = ...\na(..., c=...)\na = ((...), ...)\n....__class__")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("...");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","constant.other.ellipsis.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[1][1].value).toBe("(");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("...");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.other.ellipsis.python"]);
|
|
expect(tokens[1][3].value).toBe(",");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[1][5].value).toBe("c");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[1][6].value).toBe("=");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][7].value).toBe("...");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.other.ellipsis.python"]);
|
|
expect(tokens[1][8].value).toBe(")");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("(");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("(");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("...");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","constant.other.ellipsis.python"]);
|
|
expect(tokens[2][7].value).toBe(")");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[2][8].value).toBe(",");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][10].value).toBe("...");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","constant.other.ellipsis.python"]);
|
|
expect(tokens[2][11].value).toBe(")");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[3][0].value).toBe("...");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.other.ellipsis.python"]);
|
|
expect(tokens[3][1].value).toBe(".");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][2].value).toBe("__class__");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr11.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = self.some_list[1:2]")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("self");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","variable.language.special.self.python"]);
|
|
expect(tokens[0][5].value).toBe(".");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][6].value).toBe("some_list");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.item-access.python"]);
|
|
expect(tokens[0][7].value).toBe("[");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][8].value).toBe("1");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][9].value).toBe(":");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","punctuation.separator.slice.python"]);
|
|
expect(tokens[0][10].value).toBe("2");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][11].value).toBe("]");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr12.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("print []\nprint {}\nprint 1")
|
|
expect(tokens[0][0].value).toBe("print");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.item-access.python","support.function.builtin.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.item-access.python"]);
|
|
expect(tokens[0][2].value).toBe("[");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][3].value).toBe("]");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][0].value).toBe("print");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("{");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[1][3].value).toBe("}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[2][0].value).toBe("print");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("1");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr13.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("super()")
|
|
expect(tokens[0][0].value).toBe("super");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","support.type.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe(")");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr14.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a <> b")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("<");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[0][3].value).toBe(">");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("b");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr15.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("foofrom.something")
|
|
expect(tokens[0][0].value).toBe("foofrom");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("something");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr16.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("foo(djsgfjs==123)")
|
|
expect(tokens[0][0].value).toBe("foo");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("djsgfjs");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][3].value).toBe("==");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[0][4].value).toBe("123");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][5].value).toBe(")");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr17.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a++\nb--\n++a\n--b\na++c\nc--b\na(--a)")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe("++");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[1][0].value).toBe("b");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("--");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[2][0].value).toBe("++");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[2][1].value).toBe("a");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("--");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[3][1].value).toBe("b");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("++");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[4][2].value).toBe("c");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("c");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe("--");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[5][2].value).toBe("b");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("a");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[6][1].value).toBe("(");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[6][2].value).toBe("--");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[6][3].value).toBe("a");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[6][4].value).toBe(")");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr18.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a.Exception\nException.a")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("Exception");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("Exception");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("a");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr19.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a. #foo\na.\n#foo\na. \\\n#foo\na. 'bar'\na.\n'bar'\na. \\\n'bar'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe(" ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe("#");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][4].value).toBe("foo");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("#");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][1].value).toBe("foo");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(".");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][3].value).toBe("\\");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[3][4].value).toBe("");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("#");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[4][1].value).toBe("foo");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[5][0].value).toBe("a");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(".");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[5][2].value).toBe(" ");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][3].value).toBe("'");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][4].value).toBe("bar");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[5][5].value).toBe("'");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("a");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe(".");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[6][2].value).toBe("");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][0].value).toBe("'");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][1].value).toBe("bar");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[7][2].value).toBe("'");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("a");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe(".");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[8][2].value).toBe(" ");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][3].value).toBe("\\");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[8][4].value).toBe("");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][0].value).toBe("'");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[9][1].value).toBe("bar");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[9][2].value).toBe("'");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a @= b\na -= c\na ^= d")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("@=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("b");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("-=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("c");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("^=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("d");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr20.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a == b\na != b\na < b\na <= b\na > b\na >= b")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("==");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("b");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("!=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("b");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("<");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("b");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("<=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("b");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe(">");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("b");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("a");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][2].value).toBe(">=");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("b");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("(a, *rest, b) = range(5)")
|
|
expect(tokens[0][0].value).toBe("(");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[0][1].value).toBe("a");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe(",");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("*");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][5].value).toBe("rest");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("b");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe(")");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("=");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][13].value).toBe("range");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[0][14].value).toBe("(");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][15].value).toBe("5");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][16].value).toBe(")");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("arr2 = [i for i in range(7) if i != 3]")
|
|
expect(tokens[0][0].value).toBe("arr2");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("[");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("i");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("for");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("i");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("in");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][13].value).toBe("range");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[0][14].value).toBe("(");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][15].value).toBe("7");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][16].value).toBe(")");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][17].value).toBe(" ");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][18].value).toBe("if");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][19].value).toBe(" ");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][20].value).toBe("i");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][21].value).toBe(" ");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][22].value).toBe("!=");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[0][23].value).toBe(" ");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][24].value).toBe("3");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][25].value).toBe("]");
|
|
expect(tokens[0][25].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = (from, a)\nb = [from, b]\nc = {from: {import: a}}")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("(");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("from");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("a");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe(")");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[1][0].value).toBe("b");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("[");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("from");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][6].value).toBe(",");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][8].value).toBe("b");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][9].value).toBe("]");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[2][0].value).toBe("c");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("{");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("from");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][6].value).toBe(":");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[2][7].value).toBe(" ");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][8].value).toBe("{");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[2][9].value).toBe("import");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[2][10].value).toBe(":");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[2][11].value).toBe(" ");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][12].value).toBe("a");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][13].value).toBe("}");
|
|
expect(tokens[2][13].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[2][14].value).toBe("}");
|
|
expect(tokens[2][14].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = (a, b(a=1), {c: d(b=1), e: [a, b(z=1)]})")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("(");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("a");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("b");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][9].value).toBe("(");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][10].value).toBe("a");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][11].value).toBe("=");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][12].value).toBe("1");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][13].value).toBe(")");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][14].value).toBe(",");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][15].value).toBe(" ");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][16].value).toBe("{");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[0][17].value).toBe("c");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][18].value).toBe(":");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[0][19].value).toBe(" ");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][20].value).toBe("d");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][21].value).toBe("(");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][22].value).toBe("b");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][23].value).toBe("=");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][24].value).toBe("1");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][25].value).toBe(")");
|
|
expect(tokens[0][25].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][26].value).toBe(",");
|
|
expect(tokens[0][26].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][27].value).toBe(" ");
|
|
expect(tokens[0][27].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][28].value).toBe("e");
|
|
expect(tokens[0][28].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][29].value).toBe(":");
|
|
expect(tokens[0][29].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[0][30].value).toBe(" ");
|
|
expect(tokens[0][30].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][31].value).toBe("[");
|
|
expect(tokens[0][31].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[0][32].value).toBe("a");
|
|
expect(tokens[0][32].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][33].value).toBe(",");
|
|
expect(tokens[0][33].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][34].value).toBe(" ");
|
|
expect(tokens[0][34].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][35].value).toBe("b");
|
|
expect(tokens[0][35].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][36].value).toBe("(");
|
|
expect(tokens[0][36].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][37].value).toBe("z");
|
|
expect(tokens[0][37].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][38].value).toBe("=");
|
|
expect(tokens[0][38].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][39].value).toBe("1");
|
|
expect(tokens[0][39].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][40].value).toBe(")");
|
|
expect(tokens[0][40].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][41].value).toBe("]");
|
|
expect(tokens[0][41].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[0][42].value).toBe("}");
|
|
expect(tokens[0][42].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[0][43].value).toBe(")");
|
|
expect(tokens[0][43].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a.True = b.False = d.None")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("True");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("=");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("b");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe(".");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][8].value).toBe("False");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe("=");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][11].value).toBe(" ");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][12].value).toBe("d");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][13].value).toBe(".");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][14].value).toBe("None");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","keyword.illegal.name.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("assert a or b, 'aaa'")
|
|
expect(tokens[0][0].value).toBe("assert");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("a");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("or");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("b");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe(",");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("'");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][10].value).toBe("aaa");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][11].value).toBe("'");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/expressions/expr9.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("yield from a\nyield a")
|
|
expect(tokens[0][0].value).toBe("yield from");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("a");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("yield");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("a");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/keywords.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("as async await continue del assert break finally for\nfrom elif else if import except pass raise\nreturn try while with\n\nnonlocal global class def")
|
|
expect(tokens[0][0].value).toBe("as");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("async");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("await");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("continue");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("del");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe("assert");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][11].value).toBe(" ");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][12].value).toBe("break");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][14].value).toBe("finally");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][15].value).toBe(" ");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][16].value).toBe("for");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][0].value).toBe("from");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("elif");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("else");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("if");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][8].value).toBe("import");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][9].value).toBe(" ");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][10].value).toBe("except");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][11].value).toBe(" ");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][12].value).toBe("pass");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][13].value).toBe(" ");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][14].value).toBe("raise");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("return");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("try");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("while");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("with");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[3][0].value).toBe("");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("nonlocal");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","storage.modifier.declaration.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("global");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","storage.modifier.declaration.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("class");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","storage.type.class.python"]);
|
|
expect(tokens[4][5].value).toBe(" def");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","storage.type.function.python"]);
|
|
});
|
|
|
|
it("test/expressions/special1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("__version__ __doc__ __file__\n__author__")
|
|
expect(tokens[0][0].value).toBe("__version__");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("__doc__");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("__file__");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[1][0].value).toBe("__author__");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/expressions/special2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("__post_init__\ndef __class_getitem__(): pass\n__mro_entries__")
|
|
expect(tokens[0][0].value).toBe("__post_init__");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("__class_getitem__");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","support.variable.magic.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("__mro_entries__");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
});
|
|
|
|
it("test/fstrings/comment1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'prefix{10 # comment, making the string technically illegal\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("prefix");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][4].value).toBe("10");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][5].value).toBe(" # ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][6].value).toBe("comment");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][7].value).toBe(",");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][9].value).toBe("making");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][11].value).toBe("the");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][13].value).toBe("string");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][14].value).toBe(" ");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][15].value).toBe("technically");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][16].value).toBe(" ");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][17].value).toBe("illegal");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][18].value).toBe("");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/fstrings/comment2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'''\n prefix{10\n + 32} suffix'''")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'''");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][0].value).toBe(" prefix");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("{");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][2].value).toBe("10");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][1].value).toBe("+");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][3].value).toBe("32");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][4].value).toBe("}");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][5].value).toBe(" suffix");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][6].value).toBe("'''");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/comment3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'''\n prefix{10 # comment is still illegal here\n } suffix'''")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'''");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][0].value).toBe(" prefix");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("{");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][2].value).toBe("10");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][3].value).toBe(" # ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][4].value).toBe("comment");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][6].value).toBe("is");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.logical.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][8].value).toBe("still");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][9].value).toBe(" ");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][10].value).toBe("illegal");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][11].value).toBe(" ");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][12].value).toBe("here");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][1].value).toBe("}");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][2].value).toBe(" suffix");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][3].value).toBe("'''");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/comment4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("self.assertEqual(f'{10:#{3 != {4:5} and width}x}', ' 0xa')")
|
|
expect(tokens[0][0].value).toBe("self");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","variable.language.special.self.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("assertEqual");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("{");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("10");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][8].value).toBe(":");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][9].value).toBe("#");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][10].value).toBe("{");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][11].value).toBe("3");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]);
|
|
expect(tokens[0][13].value).toBe("!=");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[0][14].value).toBe(" ");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]);
|
|
expect(tokens[0][15].value).toBe("{");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[0][16].value).toBe("4");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][17].value).toBe(":");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[0][18].value).toBe("5");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][19].value).toBe("}");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[0][20].value).toBe(" ");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]);
|
|
expect(tokens[0][21].value).toBe("and");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","keyword.operator.logical.python"]);
|
|
expect(tokens[0][22].value).toBe(" ");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]);
|
|
expect(tokens[0][23].value).toBe("width");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]);
|
|
expect(tokens[0][24].value).toBe("}");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][25].value).toBe("x");
|
|
expect(tokens[0][25].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][26].value).toBe("}");
|
|
expect(tokens[0][26].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][27].value).toBe("'");
|
|
expect(tokens[0][27].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][28].value).toBe(",");
|
|
expect(tokens[0][28].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[0][29].value).toBe(" ");
|
|
expect(tokens[0][29].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][30].value).toBe("'");
|
|
expect(tokens[0][30].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][31].value).toBe(" 0xa");
|
|
expect(tokens[0][31].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[0][32].value).toBe("'");
|
|
expect(tokens[0][32].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][33].value).toBe(")");
|
|
expect(tokens[0][33].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/empty1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f\"{} { }\"\nf\"\"\"{}\n{ }\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("\"");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("{");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][3].value).toBe("}");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("{");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]);
|
|
expect(tokens[0][7].value).toBe("}");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][8].value).toBe("\"");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("f");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("\"\"\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("{");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][3].value).toBe("}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][4].value).toBe("");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][0].value).toBe("{");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]);
|
|
expect(tokens[2][2].value).toBe("}");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][3].value).toBe("");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][0].value).toBe("\"\"\"");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/empty2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("rf\"{} { }\"\nrf\"\"\"{}\n{ }\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("rf");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[0][1].value).toBe("\"");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("{");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][3].value).toBe("}");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("{");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","invalid.illegal.brace.python"]);
|
|
expect(tokens[0][7].value).toBe("}");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][8].value).toBe("\"");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("rf");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[1][1].value).toBe("\"\"\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("{");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][3].value).toBe("}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][0].value).toBe("{");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","invalid.illegal.brace.python"]);
|
|
expect(tokens[2][2].value).toBe("}");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][0].value).toBe("\"\"\"");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/nested1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'''\n prefix {\n foo(f\"\"\"\n inner prefix\n { bar[\"q\"] + f'insane{42 + 9000}stuff{def aaa(): pass}111'}\n inner suffix\n \"\"\")\n } suffix\n'''")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'''");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][0].value).toBe(" prefix ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("{");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][1].value).toBe("foo");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[2][2].value).toBe("(");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][3].value).toBe("f");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][4].value).toBe("\"\"\"");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][0].value).toBe(" inner prefix");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[4][1].value).toBe("{");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[4][2].value).toBe(" ");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]);
|
|
expect(tokens[4][3].value).toBe("bar");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python"]);
|
|
expect(tokens[4][4].value).toBe("[");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[4][5].value).toBe("\"");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python","meta.item-access.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][6].value).toBe("q");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python","meta.item-access.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[4][7].value).toBe("\"");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python","meta.item-access.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][8].value).toBe("]");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][9].value).toBe(" ");
|
|
expect(tokens[4][9].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]);
|
|
expect(tokens[4][10].value).toBe("+");
|
|
expect(tokens[4][10].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[4][11].value).toBe(" ");
|
|
expect(tokens[4][11].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python"]);
|
|
expect(tokens[4][12].value).toBe("f");
|
|
expect(tokens[4][12].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[4][13].value).toBe("'");
|
|
expect(tokens[4][13].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][14].value).toBe("insane");
|
|
expect(tokens[4][14].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[4][15].value).toBe("{");
|
|
expect(tokens[4][15].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[4][16].value).toBe("42");
|
|
expect(tokens[4][16].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[4][17].value).toBe(" ");
|
|
expect(tokens[4][17].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python"]);
|
|
expect(tokens[4][18].value).toBe("+");
|
|
expect(tokens[4][18].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[4][19].value).toBe(" ");
|
|
expect(tokens[4][19].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python"]);
|
|
expect(tokens[4][20].value).toBe("9000");
|
|
expect(tokens[4][20].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[4][21].value).toBe("}");
|
|
expect(tokens[4][21].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[4][22].value).toBe("stuff");
|
|
expect(tokens[4][22].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[4][23].value).toBe("{");
|
|
expect(tokens[4][23].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[4][24].value).toBe("def");
|
|
expect(tokens[4][24].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][25].value).toBe(" ");
|
|
expect(tokens[4][25].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python"]);
|
|
expect(tokens[4][26].value).toBe("aaa");
|
|
expect(tokens[4][26].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[4][27].value).toBe("(");
|
|
expect(tokens[4][27].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[4][28].value).toBe(")");
|
|
expect(tokens[4][28].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][29].value).toBe(":");
|
|
expect(tokens[4][29].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[4][30].value).toBe(" ");
|
|
expect(tokens[4][30].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python"]);
|
|
expect(tokens[4][31].value).toBe("pass");
|
|
expect(tokens[4][31].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][32].value).toBe("}");
|
|
expect(tokens[4][32].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[4][33].value).toBe("111");
|
|
expect(tokens[4][33].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[4][34].value).toBe("'");
|
|
expect(tokens[4][34].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][35].value).toBe("}");
|
|
expect(tokens[4][35].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[4][36].value).toBe("");
|
|
expect(tokens[4][36].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[5][0].value).toBe(" inner suffix");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[6][1].value).toBe("\"\"\"");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][2].value).toBe(")");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[7][1].value).toBe("}");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[7][2].value).toBe(" suffix");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[8][0].value).toBe("'''");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/nested2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f\"result: {value:{60}.{16!s:2}{'qwerty'[2]}}\"")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("\"");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("result: ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][4].value).toBe("value");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][6].value).toBe("{");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("60");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][8].value).toBe("}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][9].value).toBe(".");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][10].value).toBe("{");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][11].value).toBe("16");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][12].value).toBe("!s");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][13].value).toBe(":2");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][14].value).toBe("}");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][15].value).toBe("{");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][16].value).toBe("'");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][17].value).toBe("qwerty");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python"]);
|
|
expect(tokens[0][18].value).toBe("'");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][19].value).toBe("[");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[0][20].value).toBe("2");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][21].value).toBe("]");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[0][22].value).toBe("}");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][23].value).toBe("}");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][24].value).toBe("\"");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/nested3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f\"result: {value:{60}.{16!s:2}{'qwerty'\n[2]}}\"\n# comment")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("\"");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("result: ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][4].value).toBe("value");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][6].value).toBe("{");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("60");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][8].value).toBe("}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][9].value).toBe(".");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][10].value).toBe("{");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][11].value).toBe("16");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][12].value).toBe("!s");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][13].value).toBe(":2");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][14].value).toBe("}");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][15].value).toBe("{");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][16].value).toBe("'");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][17].value).toBe("qwerty");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python"]);
|
|
expect(tokens[0][18].value).toBe("'");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][19].value).toBe("");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[1][0].value).toBe("[");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[1][1].value).toBe("2");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][2].value).toBe("]");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[1][3].value).toBe("}}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("\"");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[2][0].value).toBe("#");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][1].value).toBe(" comment");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/fstrings/nested4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f\"\"\"result: {value:{60}.{16!s:2}{'qwerty'\n[2]}}\"\"\"\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("\"\"\"");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("result: ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][4].value).toBe("value");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][6].value).toBe("{");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("60");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][8].value).toBe("}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][9].value).toBe(".");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][10].value).toBe("{");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][11].value).toBe("16");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][12].value).toBe("!s");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][13].value).toBe(":2");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][14].value).toBe("}");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][15].value).toBe("{");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][16].value).toBe("'");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][17].value).toBe("qwerty");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python"]);
|
|
expect(tokens[0][18].value).toBe("'");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("[");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[1][1].value).toBe("2");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][2].value).toBe("]");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[1][3].value).toBe("}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][4].value).toBe("}");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][5].value).toBe("\"\"\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][5].value).toBe(":");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[2][6].value).toBe(" ");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][7].value).toBe("pass");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/fstrings/prefixes1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = f's t r'\na = f\"s t r\"\na = F's t r'\na = F\"s t r\"\na = f'''s t r'''\na = F\"\"\"s t r\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("s t r");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("f");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][5].value).toBe("\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("s t r");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][7].value).toBe("\"");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("F");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("s t r");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][7].value).toBe("'");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("F");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[3][5].value).toBe("\"");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][6].value).toBe("s t r");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[3][7].value).toBe("\"");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("f");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[4][5].value).toBe("'''");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][6].value).toBe("s t r");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[4][7].value).toBe("'''");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("a");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][2].value).toBe("=");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("F");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[5][5].value).toBe("\"\"\"");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][6].value).toBe("s t r");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[5][7].value).toBe("\"\"\"");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/prefixes2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'some {obj}'\nF'some {obj}'\nrf'some {obj}'\nrF'some {obj}'\nRf'some {obj}'\nRF'some {obj}'")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("some ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][4].value).toBe("obj");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][5].value).toBe("}");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][6].value).toBe("'");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("F");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("'");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("some ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][3].value).toBe("{");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][4].value).toBe("obj");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][5].value).toBe("}");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][6].value).toBe("'");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("rf");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("'");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("some ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][3].value).toBe("{obj}");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][4].value).toBe("'");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("rF");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[3][1].value).toBe("'");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe("some ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[3][3].value).toBe("{obj}");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[3][4].value).toBe("'");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("Rf");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]);
|
|
expect(tokens[4][1].value).toBe("'");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][2].value).toBe("some ");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]);
|
|
expect(tokens[4][3].value).toBe("{");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[4][4].value).toBe("obj");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[4][5].value).toBe("}");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[4][6].value).toBe("'");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("RF");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]);
|
|
expect(tokens[5][1].value).toBe("'");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][2].value).toBe("some ");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]);
|
|
expect(tokens[5][3].value).toBe("{");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[5][4].value).toBe("obj");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[5][5].value).toBe("}");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[5][6].value).toBe("'");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/prefixes3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("fr'some {obj}'\nFr'some {obj}'\nfR'some {obj}'\nFR'some {obj}'")
|
|
expect(tokens[0][0].value).toBe("fr");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("some ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{obj}");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("Fr");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[1][1].value).toBe("'");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("some ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][3].value).toBe("{obj}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][4].value).toBe("'");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("fR");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]);
|
|
expect(tokens[2][1].value).toBe("'");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("some ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]);
|
|
expect(tokens[2][3].value).toBe("{");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][4].value).toBe("obj");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][5].value).toBe("}");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][6].value).toBe("'");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("FR");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]);
|
|
expect(tokens[3][1].value).toBe("'");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe("some ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]);
|
|
expect(tokens[3][3].value).toBe("{");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][4].value).toBe("obj");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[3][5].value).toBe("}");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][6].value).toBe("'");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/prefixes4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("fu'some {obj}'\nFu'some {obj}'\nfU'some {obj}'\nFU'some {obj}'\n\nuf'some {obj}'\nuF'some {obj}'\nUf'some {obj}'\nUF'some {obj}'")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("u");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[0][2].value).toBe("'");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][3].value).toBe("some ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][4].value).toBe("{");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][5].value).toBe("obj");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][6].value).toBe("}");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("F");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("u");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[1][2].value).toBe("'");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][3].value).toBe("some ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][4].value).toBe("{");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][5].value).toBe("obj");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][6].value).toBe("}");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][7].value).toBe("'");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("f");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][1].value).toBe("U");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[2][2].value).toBe("'");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][3].value).toBe("some ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][4].value).toBe("{");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][5].value).toBe("obj");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][6].value).toBe("}");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][7].value).toBe("'");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("F");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[3][1].value).toBe("U");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[3][2].value).toBe("'");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][3].value).toBe("some ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[3][4].value).toBe("{");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][5].value).toBe("obj");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[3][6].value).toBe("}");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][7].value).toBe("'");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("u");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[5][1].value).toBe("f");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[5][2].value).toBe("'");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][3].value).toBe("some ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[5][4].value).toBe("{");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[5][5].value).toBe("obj");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[5][6].value).toBe("}");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[5][7].value).toBe("'");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("u");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[6][1].value).toBe("F");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[6][2].value).toBe("'");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][3].value).toBe("some ");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[6][4].value).toBe("{");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[6][5].value).toBe("obj");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[6][6].value).toBe("}");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[6][7].value).toBe("'");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][0].value).toBe("U");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[7][1].value).toBe("f");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[7][2].value).toBe("'");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("some ");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[7][4].value).toBe("{");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[7][5].value).toBe("obj");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[7][6].value).toBe("}");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[7][7].value).toBe("'");
|
|
expect(tokens[7][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("U");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[8][1].value).toBe("F");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[8][2].value).toBe("'");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[8][3].value).toBe("some ");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[8][4].value).toBe("{");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[8][5].value).toBe("obj");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[8][6].value).toBe("}");
|
|
expect(tokens[8][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[8][7].value).toBe("'");
|
|
expect(tokens[8][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/prefixes5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("fb'some {obj}'\nFb'some {obj}'\nfB'some {obj}'\nFB'some {obj}'\n\nbf'some {obj}'\nbF'some {obj}'\nBf'some {obj}'\nBF'some {obj}'")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("b");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[0][2].value).toBe("'");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][3].value).toBe("some ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][4].value).toBe("{");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][5].value).toBe("obj");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][6].value).toBe("}");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("F");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("b");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[1][2].value).toBe("'");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][3].value).toBe("some ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][4].value).toBe("{");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][5].value).toBe("obj");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][6].value).toBe("}");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][7].value).toBe("'");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("f");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][1].value).toBe("B");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[2][2].value).toBe("'");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][3].value).toBe("some ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][4].value).toBe("{");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][5].value).toBe("obj");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][6].value).toBe("}");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][7].value).toBe("'");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("F");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[3][1].value).toBe("B");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[3][2].value).toBe("'");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][3].value).toBe("some ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[3][4].value).toBe("{");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][5].value).toBe("obj");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[3][6].value).toBe("}");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][7].value).toBe("'");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("b");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[5][1].value).toBe("f");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[5][2].value).toBe("'");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][3].value).toBe("some ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[5][4].value).toBe("{");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[5][5].value).toBe("obj");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[5][6].value).toBe("}");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[5][7].value).toBe("'");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("b");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[6][1].value).toBe("F");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[6][2].value).toBe("'");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][3].value).toBe("some ");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[6][4].value).toBe("{");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[6][5].value).toBe("obj");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[6][6].value).toBe("}");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[6][7].value).toBe("'");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[7][0].value).toBe("B");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[7][1].value).toBe("f");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[7][2].value).toBe("'");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][3].value).toBe("some ");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[7][4].value).toBe("{");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[7][5].value).toBe("obj");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[7][6].value).toBe("}");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[7][7].value).toBe("'");
|
|
expect(tokens[7][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("B");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[8][1].value).toBe("F");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[8][2].value).toBe("'");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[8][3].value).toBe("some ");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[8][4].value).toBe("{");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[8][5].value).toBe("obj");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[8][6].value).toBe("}");
|
|
expect(tokens[8][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[8][7].value).toBe("'");
|
|
expect(tokens[8][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = f\"{0[ ]:X>+10d}\"\na = f\"{0[ ]!s:X>+10d}\"\na = f\"{0[ ]:Xd>+10d}\" #invalid")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("{");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("0");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][8].value).toBe("[");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][10].value).toBe("]");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[0][11].value).toBe(":X>+10d");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][12].value).toBe("}");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][13].value).toBe("\"");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("f");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][5].value).toBe("\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("{");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][7].value).toBe("0");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][8].value).toBe("[");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[1][9].value).toBe(" ");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][10].value).toBe("]");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[1][11].value).toBe("!s");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[1][12].value).toBe(":X>+10d");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[1][13].value).toBe("}");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][14].value).toBe("\"");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("f");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][5].value).toBe("\"");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("{");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][7].value).toBe("0");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][8].value).toBe("[");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][10].value).toBe("]");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","meta.fstring.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[2][11].value).toBe(":");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","meta.fstring.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[2][12].value).toBe("Xd");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][13].value).toBe(">");
|
|
expect(tokens[2][13].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[2][14].value).toBe("+");
|
|
expect(tokens[2][14].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[2][15].value).toBe("10d");
|
|
expect(tokens[2][15].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.name.python"]);
|
|
expect(tokens[2][16].value).toBe("}");
|
|
expect(tokens[2][16].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][17].value).toBe("\"");
|
|
expect(tokens[2][17].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][18].value).toBe(" ");
|
|
expect(tokens[2][18].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][19].value).toBe("#");
|
|
expect(tokens[2][19].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][20].value).toBe("invalid");
|
|
expect(tokens[2][20].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = f\"normal {{ normal }} normal } {10!r} normal {fo.__add__!s}\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("normal ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][7].value).toBe("{{");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][8].value).toBe(" normal ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][9].value).toBe("}}");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][10].value).toBe(" normal ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][11].value).toBe("}");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][13].value).toBe("{");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][14].value).toBe("10");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][15].value).toBe("!r");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][16].value).toBe("}");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][17].value).toBe(" normal ");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][18].value).toBe("{");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][19].value).toBe("fo");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][20].value).toBe(".");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.fstring.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][21].value).toBe("__add__");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.fstring.python","support.function.magic.python"]);
|
|
expect(tokens[0][22].value).toBe("!s");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][23].value).toBe("}");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][24].value).toBe("\"");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = f'hello { foo(\"bar\")/23 !r:f} times'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("hello ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][7].value).toBe("{");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][9].value).toBe("foo");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][10].value).toBe("(");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][11].value).toBe("\"");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][12].value).toBe("bar");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[0][13].value).toBe("\"");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][14].value).toBe(")");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][15].value).toBe("/");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][16].value).toBe("23");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][17].value).toBe(" ");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][18].value).toBe("!r");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][19].value).toBe(":f");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][20].value).toBe("}");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][21].value).toBe(" times");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][22].value).toBe("'");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = f'''hello { foo(\"bar\")/23 !r:f} times'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("'''");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("hello ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][7].value).toBe("{");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][9].value).toBe("foo");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][10].value).toBe("(");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][11].value).toBe("\"");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][12].value).toBe("bar");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[0][13].value).toBe("\"");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][14].value).toBe(")");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][15].value).toBe("/");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][16].value).toBe("23");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][17].value).toBe(" ");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][18].value).toBe("!r");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][19].value).toBe(":f");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[0][20].value).toBe("}");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][21].value).toBe(" times");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][22].value).toBe("'''");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = f'''\nhello { foo(\"bar\")/23 !r:f} times\n'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("'''");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][0].value).toBe("hello ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("{");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][3].value).toBe("foo");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[1][4].value).toBe("(");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("bar");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[1][7].value).toBe("\"");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][8].value).toBe(")");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][9].value).toBe("/");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[1][10].value).toBe("23");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][11].value).toBe(" ");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[1][12].value).toBe("!r");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[1][13].value).toBe(":f");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python","meta.fstring.python","storage.type.format.python"]);
|
|
expect(tokens[1][14].value).toBe("}");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][15].value).toBe(" times");
|
|
expect(tokens[1][15].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][0].value).toBe("'''");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'insane{42 + 9000}stuff{def aaa(): pass}'\n# def aaa() must not be parsed as a valid declaration")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("insane");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][4].value).toBe("42");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][6].value).toBe("+");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][8].value).toBe("9000");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][9].value).toBe("}");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][10].value).toBe("stuff");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][11].value).toBe("{");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][12].value).toBe("def");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][14].value).toBe("aaa");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][15].value).toBe("(");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][16].value).toBe(")");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][17].value).toBe(":");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[0][18].value).toBe(" ");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][19].value).toBe("pass");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.fstring.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][20].value).toBe("}");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][21].value).toBe("'");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("#");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][1].value).toBe(" def aaa() must not be parsed as a valid declaration");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'abc \\ efg'")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("abc ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("\\ efg");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'abc \\} }} }}} }}}} }}}}} efg'")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("abc ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("\\");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][4].value).toBe("}");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][6].value).toBe("}}");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][8].value).toBe("}}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][9].value).toBe("}");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][11].value).toBe("}}");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][12].value).toBe("}}");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][14].value).toBe("}}");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][15].value).toBe("}}");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][16].value).toBe("}");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]);
|
|
expect(tokens[0][17].value).toBe(" efg");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][18].value).toBe("'");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/simple9.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("f'foo {{{bar}}}'")
|
|
expect(tokens[0][0].value).toBe("f");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("foo ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{{");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][4].value).toBe("{");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][5].value).toBe("bar");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[0][6].value).toBe("}");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("}}");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[0][8].value).toBe("'");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/unicode1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = f\"\"\"\nmultiline \"unicode\" string \\\n\n \\xf1 \\u1234aaaa \\U1234aaaa\n\n \\N{BLACK SPADE SUIT}\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("\"\"\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][0].value).toBe("multiline \"unicode\" string ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][1].value).toBe("\\");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","constant.language.python"]);
|
|
expect(tokens[1][2].value).toBe("");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][1].value).toBe("\\xf1");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][3].value).toBe("\\u1234");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[3][4].value).toBe("aaaa ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][5].value).toBe("\\U1234aaaa");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[3][6].value).toBe("");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[5][1].value).toBe("\\N{BLACK SPADE SUIT}");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[5][2].value).toBe("");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[6][0].value).toBe("\"\"\"");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/fstrings/unicode2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = f\"\"\"\nmultiline \"unicode\" string\n \\N{BLACK SPADE SUIT} {foo+2}\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("f");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[0][5].value).toBe("\"\"\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[1][0].value).toBe("multiline \"unicode\" string");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][1].value).toBe("\\N{BLACK SPADE SUIT}");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][3].value).toBe("{");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][4].value).toBe("foo");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python"]);
|
|
expect(tokens[2][5].value).toBe("+");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[2][6].value).toBe("2");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][7].value).toBe("}");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][8].value).toBe("");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][0].value).toBe("\"\"\"");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.multi.python string.interpolated.python punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/functions/async1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@foo\nasync def foo():\n a = 1\n async for a, b, c in b:\n async with b as d, c:\n await func(a, b=1)")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe("foo");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[1][0].value).toBe("async");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.async.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("def");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][4].value).toBe("foo");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][5].value).toBe("(");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(")");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][7].value).toBe(":");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("a");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][3].value).toBe("=");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][4].value).toBe(" ");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][5].value).toBe("1");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("async");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][3].value).toBe("for");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][5].value).toBe("a");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][6].value).toBe(",");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[3][7].value).toBe(" ");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][8].value).toBe("b");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][9].value).toBe(",");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[3][10].value).toBe(" ");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][11].value).toBe("c");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][12].value).toBe(" ");
|
|
expect(tokens[3][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][13].value).toBe("in");
|
|
expect(tokens[3][13].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[3][14].value).toBe(" ");
|
|
expect(tokens[3][14].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][15].value).toBe("b");
|
|
expect(tokens[3][15].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][16].value).toBe(":");
|
|
expect(tokens[3][16].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("async");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][2].value).toBe(" ");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][3].value).toBe("with");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][4].value).toBe(" ");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][5].value).toBe("b");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][6].value).toBe(" ");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][7].value).toBe("as");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][8].value).toBe(" ");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][9].value).toBe("d");
|
|
expect(tokens[4][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][10].value).toBe(",");
|
|
expect(tokens[4][10].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[4][11].value).toBe(" ");
|
|
expect(tokens[4][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][12].value).toBe("c");
|
|
expect(tokens[4][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][13].value).toBe(":");
|
|
expect(tokens[4][13].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe("await");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[5][2].value).toBe(" ");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][3].value).toBe("func");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[5][4].value).toBe("(");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[5][5].value).toBe("a");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[5][6].value).toBe(",");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[5][7].value).toBe(" ");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[5][8].value).toBe("b");
|
|
expect(tokens[5][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[5][9].value).toBe("=");
|
|
expect(tokens[5][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[5][10].value).toBe("1");
|
|
expect(tokens[5][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[5][11].value).toBe(")");
|
|
expect(tokens[5][11].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/functions/async2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("async = await = 2")
|
|
expect(tokens[0][0].value).toBe("async");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("await");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("=");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("2");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/functions/async3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("casync def foo(): pass")
|
|
expect(tokens[0][0].value).toBe("casync");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("def");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][4].value).toBe("foo");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][5].value).toBe("(");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][6].value).toBe(")");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][7].value).toBe(":");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("pass");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def myfunc(self, # gotta have self\n param1=\"value\", # values are cool\n param2=True, # or False, whatever\n **kwargs): # you never know\n pass")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("myfunc");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("self");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[0][5].value).toBe(",");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[0][7].value).toBe("#");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][8].value).toBe(" gotta have self");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][1].value).toBe("param1");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[1][3].value).toBe("\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][4].value).toBe("value");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[1][5].value).toBe("\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][6].value).toBe(",");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][8].value).toBe("#");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][9].value).toBe(" values are cool");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[2][1].value).toBe("param2");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[2][3].value).toBe("True");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.language.python"]);
|
|
expect(tokens[2][4].value).toBe(",");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[2][6].value).toBe("#");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][7].value).toBe(" or False, whatever");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][1].value).toBe("**");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[3][2].value).toBe("kwargs");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[3][3].value).toBe(")");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[3][4].value).toBe(":");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][5].value).toBe(" ");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][6].value).toBe("#");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][7].value).toBe(" you never know");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("pass");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl10.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo(True): True")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("True");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.illegal.name.python"]);
|
|
expect(tokens[0][5].value).toBe(")");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][6].value).toBe(":");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("True");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","constant.language.python"]);
|
|
});
|
|
|
|
it("test/functions/decl11.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# testing annotations split over multiple lines\ndef foo(a:('abc' 'def')==123, boo: 'abc'\n\n 'def' == foo(n(m=0)))")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" testing annotations split over multiple lines");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe("a");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[1][6].value).toBe("(");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[1][7].value).toBe("'");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][8].value).toBe("abc");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[1][9].value).toBe("'");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][10].value).toBe(" ");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][11].value).toBe("'");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][12].value).toBe("def");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[1][13].value).toBe("'");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][14].value).toBe(")");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[1][15].value).toBe("==");
|
|
expect(tokens[1][15].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[1][16].value).toBe("123");
|
|
expect(tokens[1][16].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][17].value).toBe(",");
|
|
expect(tokens[1][17].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[1][18].value).toBe(" ");
|
|
expect(tokens[1][18].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][19].value).toBe("boo");
|
|
expect(tokens[1][19].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][20].value).toBe(":");
|
|
expect(tokens[1][20].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[1][21].value).toBe(" ");
|
|
expect(tokens[1][21].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][22].value).toBe("'");
|
|
expect(tokens[1][22].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][23].value).toBe("abc");
|
|
expect(tokens[1][23].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[1][24].value).toBe("'");
|
|
expect(tokens[1][24].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][1].value).toBe("'");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe("def");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[3][3].value).toBe("'");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][5].value).toBe("==");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.comparison.python"]);
|
|
expect(tokens[3][6].value).toBe(" ");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][7].value).toBe("foo");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[3][8].value).toBe("(");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][9].value).toBe("n");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[3][10].value).toBe("(");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][11].value).toBe("m");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[3][12].value).toBe("=");
|
|
expect(tokens[3][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][13].value).toBe("0");
|
|
expect(tokens[3][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][14].value).toBe(")");
|
|
expect(tokens[3][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][15].value).toBe(")");
|
|
expect(tokens[3][15].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][16].value).toBe(")");
|
|
expect(tokens[3][16].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
});
|
|
|
|
it("test/functions/decl12.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def get_streaks(s) \\\n -> 'spam': pass")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("get_streaks");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("s");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][5].value).toBe(")");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][7].value).toBe("\\");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[0][8].value).toBe("");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][1].value).toBe("->");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.annotation.result.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][3].value).toBe("'");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][4].value).toBe("spam");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][6].value).toBe(":");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][8].value).toBe("pass");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl13.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo()\n -> notOK:\n pass")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("->");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","invalid.illegal.annotation.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe("notOK");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe(":");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("pass");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl14.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# testing comments in function definition\ndef foo( # before args\n a=42, # between\n # args\n b= # in args\n 24,\n d # before '='\n =99,\n e\n ) # incomplete definition, missing COLON, you're probably typing it\n # pre docstring\n '''Docstring'''\n # post docstring\n\ndef bar(): return 1")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" testing comments in function definition");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][5].value).toBe("#");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][6].value).toBe(" before args");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[2][1].value).toBe("a");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[2][3].value).toBe("42");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][4].value).toBe(",");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[2][6].value).toBe("#");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][7].value).toBe(" between");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][1].value).toBe("#");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][2].value).toBe(" args");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][1].value).toBe("b");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][4].value).toBe("#");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[4][5].value).toBe(" in args");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][1].value).toBe("24");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[5][2].value).toBe(",");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[6][1].value).toBe("d");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[6][2].value).toBe(" ");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[6][3].value).toBe("#");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[6][4].value).toBe(" before '='");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","comment.line.number-sign.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[7][1].value).toBe("=");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[7][2].value).toBe("99");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[7][3].value).toBe(",");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[8][1].value).toBe("e");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[9][1].value).toBe(")");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[9][2].value).toBe(" ");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[9][3].value).toBe("#");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[9][4].value).toBe(" incomplete definition, missing COLON, you're probably typing it");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe("#");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[10][2].value).toBe(" pre docstring");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[11][0].value).toBe(" ");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[11][1].value).toBe("'''");
|
|
expect(tokens[11][1].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[11][2].value).toBe("Docstring");
|
|
expect(tokens[11][2].scopes).toEqual(["source.python","string.quoted.docstring.multi.python"]);
|
|
expect(tokens[11][3].value).toBe("'''");
|
|
expect(tokens[11][3].scopes).toEqual(["source.python","string.quoted.docstring.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[12][0].value).toBe(" ");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][1].value).toBe("#");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[12][2].value).toBe(" post docstring");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[13][0].value).toBe("");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[14][0].value).toBe("def");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[14][1].value).toBe(" ");
|
|
expect(tokens[14][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[14][2].value).toBe("bar");
|
|
expect(tokens[14][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[14][3].value).toBe("(");
|
|
expect(tokens[14][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[14][4].value).toBe(")");
|
|
expect(tokens[14][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[14][5].value).toBe(":");
|
|
expect(tokens[14][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[14][6].value).toBe(" ");
|
|
expect(tokens[14][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[14][7].value).toBe("return");
|
|
expect(tokens[14][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[14][8].value).toBe(" ");
|
|
expect(tokens[14][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[14][9].value).toBe("1");
|
|
expect(tokens[14][9].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/functions/decl2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def result_annot(lambda, lambda=) -> qqq[None]:\n pass")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("result_annot");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("lambda");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][5].value).toBe(", ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe("lambda");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][7].value).toBe("=");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[0][8].value).toBe(")");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][10].value).toBe("->");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.annotation.result.python"]);
|
|
expect(tokens[0][11].value).toBe(" ");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][12].value).toBe("qqq");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.python","meta.item-access.python"]);
|
|
expect(tokens[0][13].value).toBe("[");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][14].value).toBe("None");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.function.python","meta.item-access.python","meta.item-access.arguments.python","constant.language.python"]);
|
|
expect(tokens[0][15].value).toBe("]");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.function.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][16].value).toBe(":");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("pass");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# testing annotations split over multiple lines\ndef __init__(self, a:('abc' 'def')=123, boo: 'abc'\n\n 'def' = foo(n(m=0), baz=\n 13)) -> 123 : 123")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" testing annotations split over multiple lines");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("__init__");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","support.function.magic.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe("self");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[1][5].value).toBe(",");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][7].value).toBe("a");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][8].value).toBe(":");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[1][9].value).toBe("(");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[1][10].value).toBe("'");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][11].value).toBe("abc");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[1][12].value).toBe("'");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][13].value).toBe(" ");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][14].value).toBe("'");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][15].value).toBe("def");
|
|
expect(tokens[1][15].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[1][16].value).toBe("'");
|
|
expect(tokens[1][16].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][17].value).toBe(")");
|
|
expect(tokens[1][17].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[1][18].value).toBe("=");
|
|
expect(tokens[1][18].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][19].value).toBe("123");
|
|
expect(tokens[1][19].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][20].value).toBe(",");
|
|
expect(tokens[1][20].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[1][21].value).toBe(" ");
|
|
expect(tokens[1][21].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][22].value).toBe("boo");
|
|
expect(tokens[1][22].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][23].value).toBe(":");
|
|
expect(tokens[1][23].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[1][24].value).toBe(" ");
|
|
expect(tokens[1][24].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[1][25].value).toBe("'");
|
|
expect(tokens[1][25].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][26].value).toBe("abc");
|
|
expect(tokens[1][26].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[1][27].value).toBe("'");
|
|
expect(tokens[1][27].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][1].value).toBe("'");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe("def");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[3][3].value).toBe("'");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][5].value).toBe("=");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][6].value).toBe(" ");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][7].value).toBe("foo");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[3][8].value).toBe("(");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][9].value).toBe("n");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[3][10].value).toBe("(");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][11].value).toBe("m");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[3][12].value).toBe("=");
|
|
expect(tokens[3][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][13].value).toBe("0");
|
|
expect(tokens[3][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][14].value).toBe(")");
|
|
expect(tokens[3][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][15].value).toBe(",");
|
|
expect(tokens[3][15].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[3][16].value).toBe(" ");
|
|
expect(tokens[3][16].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[3][17].value).toBe("baz");
|
|
expect(tokens[3][17].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[3][18].value).toBe("=");
|
|
expect(tokens[3][18].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[4][1].value).toBe("13");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[4][2].value).toBe(")");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][3].value).toBe(")");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[4][4].value).toBe(" ");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[4][5].value).toBe("->");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.annotation.result.python"]);
|
|
expect(tokens[4][6].value).toBe(" ");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[4][7].value).toBe("123");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","meta.function.python","constant.numeric.dec.python"]);
|
|
expect(tokens[4][8].value).toBe(" ");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[4][9].value).toBe(":");
|
|
expect(tokens[4][9].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[4][10].value).toBe(" ");
|
|
expect(tokens[4][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][11].value).toBe("123");
|
|
expect(tokens[4][11].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/functions/decl4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# testing annotations split over multiple lines\ndef some_func(a:\n lambda x=None:\n {key: val\n for key, val in\n (x if x is not None else [])\n }=42):")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" testing annotations split over multiple lines");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("some_func");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe("a");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[2][1].value).toBe("lambda");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[2][3].value).toBe("x");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][4].value).toBe("=");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[2][5].value).toBe("None");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.lambda-function.python","meta.function.lambda.parameters.python","constant.language.python"]);
|
|
expect(tokens[2][6].value).toBe(":");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][1].value).toBe("{");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[3][2].value).toBe("key");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][3].value).toBe(":");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][5].value).toBe("val");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][1].value).toBe("for");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][2].value).toBe(" ");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][3].value).toBe("key");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][4].value).toBe(",");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.element.python"]);
|
|
expect(tokens[4][5].value).toBe(" ");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][6].value).toBe("val");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][7].value).toBe(" ");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[4][8].value).toBe("in");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.logical.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][1].value).toBe("(");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[5][2].value).toBe("x");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][4].value).toBe("if");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.control.flow.python"]);
|
|
expect(tokens[5][5].value).toBe(" ");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][6].value).toBe("x");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][7].value).toBe(" ");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][8].value).toBe("is");
|
|
expect(tokens[5][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.logical.python"]);
|
|
expect(tokens[5][9].value).toBe(" ");
|
|
expect(tokens[5][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][10].value).toBe("not");
|
|
expect(tokens[5][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.logical.python"]);
|
|
expect(tokens[5][11].value).toBe(" ");
|
|
expect(tokens[5][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][12].value).toBe("None");
|
|
expect(tokens[5][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.language.python"]);
|
|
expect(tokens[5][13].value).toBe(" ");
|
|
expect(tokens[5][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][14].value).toBe("else");
|
|
expect(tokens[5][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.control.flow.python"]);
|
|
expect(tokens[5][15].value).toBe(" ");
|
|
expect(tokens[5][15].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[5][16].value).toBe("[");
|
|
expect(tokens[5][16].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[5][17].value).toBe("]");
|
|
expect(tokens[5][17].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[5][18].value).toBe(")");
|
|
expect(tokens[5][18].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[6][1].value).toBe("}");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[6][2].value).toBe("=");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[6][3].value).toBe("42");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[6][4].value).toBe(")");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[6][5].value).toBe(":");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
});
|
|
|
|
it("test/functions/decl5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def f()->123:pass")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("f");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][5].value).toBe("->");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","punctuation.separator.annotation.result.python"]);
|
|
expect(tokens[0][6].value).toBe("123");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][7].value).toBe(":");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[0][8].value).toBe("pass");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def True(): pass\ndef None(): pass\ndef False(): pass")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("True");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","keyword.illegal.name.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("pass");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("None");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","keyword.illegal.name.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("False");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","keyword.illegal.name.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][5].value).toBe(":");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[2][6].value).toBe(" ");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][7].value).toBe("pass");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo(*, a): pass\ndef foo(*a): pass\ndef foo(**a): pass")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("*");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[0][5].value).toBe(", ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe("a");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][7].value).toBe(")");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][8].value).toBe(":");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe("pass");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe("*");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[1][5].value).toBe("a");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][6].value).toBe(")");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][7].value).toBe(":");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][8].value).toBe(" ");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][9].value).toBe("pass");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe("**");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[2][5].value).toBe("a");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][6].value).toBe(")");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][7].value).toBe(":");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[2][8].value).toBe(" ");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][9].value).toBe("pass");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("def foo(a=1**1, *b:3*2=1*2, **a=1*2**3): pass")
|
|
expect(tokens[0][0].value).toBe("def");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("a");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][5].value).toBe("=");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[0][6].value).toBe("1");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][7].value).toBe("**");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][8].value).toBe("1");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][9].value).toBe(",");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[0][11].value).toBe("*");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[0][12].value).toBe("b");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][13].value).toBe(":");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.annotation.python"]);
|
|
expect(tokens[0][14].value).toBe("3");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][15].value).toBe("*");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][16].value).toBe("2");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][17].value).toBe("=");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][18].value).toBe("1");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][19].value).toBe("*");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][20].value).toBe("2");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][21].value).toBe(",");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[0][22].value).toBe(" ");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[0][23].value).toBe("**");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[0][24].value).toBe("a");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][25].value).toBe("=");
|
|
expect(tokens[0][25].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[0][26].value).toBe("1");
|
|
expect(tokens[0][26].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][27].value).toBe("*");
|
|
expect(tokens[0][27].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][28].value).toBe("2");
|
|
expect(tokens[0][28].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][29].value).toBe("**");
|
|
expect(tokens[0][29].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][30].value).toBe("3");
|
|
expect(tokens[0][30].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][31].value).toBe(")");
|
|
expect(tokens[0][31].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[0][32].value).toBe(":");
|
|
expect(tokens[0][32].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[0][33].value).toBe(" ");
|
|
expect(tokens[0][33].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][34].value).toBe("pass");
|
|
expect(tokens[0][34].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decl9.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("cdef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("cdef");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][4].value).toBe(")");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("pass");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decorators1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@some_decorator # with comment\n@some.class.decorator\n@some_decorator(1)\n@some.decorator (1, 3)\n@some_decorator(a=2, b={'q': 42}, **kwargs)\n@classmethod\ndef decorated(a): pass")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe("some_decorator");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][2].value).toBe(" ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][3].value).toBe("#");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][4].value).toBe(" with comment");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("@");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[1][1].value).toBe("some");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[1][2].value).toBe(".");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][3].value).toBe("class");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][4].value).toBe(".");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][5].value).toBe("decorator");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[2][0].value).toBe("@");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[2][1].value).toBe("some_decorator");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[2][2].value).toBe("(");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][3].value).toBe("1");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][0].value).toBe("@");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[3][1].value).toBe("some");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[3][2].value).toBe(".");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][3].value).toBe("decorator");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[3][5].value).toBe("(");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][6].value).toBe("1");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][7].value).toBe(",");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[3][8].value).toBe(" ");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[3][9].value).toBe("3");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][10].value).toBe(")");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][0].value).toBe("@");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[4][1].value).toBe("some_decorator");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[4][2].value).toBe("(");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("a");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[4][4].value).toBe("=");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][5].value).toBe("2");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[4][6].value).toBe(",");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[4][7].value).toBe(" ");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[4][8].value).toBe("b");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[4][9].value).toBe("=");
|
|
expect(tokens[4][9].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][10].value).toBe("{");
|
|
expect(tokens[4][10].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[4][11].value).toBe("'");
|
|
expect(tokens[4][11].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][12].value).toBe("q");
|
|
expect(tokens[4][12].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[4][13].value).toBe("'");
|
|
expect(tokens[4][13].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][14].value).toBe(":");
|
|
expect(tokens[4][14].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[4][15].value).toBe(" ");
|
|
expect(tokens[4][15].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[4][16].value).toBe("42");
|
|
expect(tokens[4][16].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[4][17].value).toBe("}");
|
|
expect(tokens[4][17].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[4][18].value).toBe(",");
|
|
expect(tokens[4][18].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[4][19].value).toBe(" ");
|
|
expect(tokens[4][19].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[4][20].value).toBe("**");
|
|
expect(tokens[4][20].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","keyword.operator.unpacking.arguments.python"]);
|
|
expect(tokens[4][21].value).toBe("kwargs");
|
|
expect(tokens[4][21].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[4][22].value).toBe(")");
|
|
expect(tokens[4][22].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[5][0].value).toBe("@");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[5][1].value).toBe("classmethod");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function.decorator.python","support.type.python"]);
|
|
expect(tokens[6][0].value).toBe("def");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[6][2].value).toBe("decorated");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[6][3].value).toBe("(");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[6][4].value).toBe("a");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[6][5].value).toBe(")");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[6][6].value).toBe(":");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[6][7].value).toBe(" ");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][8].value).toBe("pass");
|
|
expect(tokens[6][8].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decorators2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@ f . bar . a . b\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][2].value).toBe("f");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][4].value).toBe(".");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][6].value).toBe("bar");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][8].value).toBe(".");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][10].value).toBe("a");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][11].value).toBe(" ");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][12].value).toBe(".");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][14].value).toBe("b");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decorators3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@ f . bar (baz = 1)\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][2].value).toBe("f");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][4].value).toBe(".");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][6].value).toBe("bar");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][8].value).toBe("(");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][9].value).toBe("baz");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][11].value).toBe("=");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[0][13].value).toBe("1");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][14].value).toBe(")");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decorators4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@a.b.c.None.z\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe("a");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][2].value).toBe(".");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][3].value).toBe("b");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][4].value).toBe(".");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][5].value).toBe("c");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][6].value).toBe(".");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][7].value).toBe("None");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.illegal.name.python"]);
|
|
expect(tokens[0][8].value).toBe(".");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][9].value).toBe("z");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decorators5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@a. \\\n b . \\\n c.None.z \\\n baz(q=1)\n@foo.ok\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe("a");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][2].value).toBe(".");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][4].value).toBe("\\");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[0][5].value).toBe("");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[1][1].value).toBe("b");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[1][3].value).toBe(".");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[1][5].value).toBe("\\");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][6].value).toBe("");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[2][1].value).toBe("c");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[2][2].value).toBe(".");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][3].value).toBe("None");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.illegal.name.python"]);
|
|
expect(tokens[2][4].value).toBe(".");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][5].value).toBe("z");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[2][6].value).toBe(" ");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[2][7].value).toBe("\\");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[2][8].value).toBe("");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[3][1].value).toBe("baz");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[3][2].value).toBe("(");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][3].value).toBe("q");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[3][4].value).toBe("=");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][5].value).toBe("1");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][6].value).toBe(")");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[4][0].value).toBe("@");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[4][1].value).toBe("foo");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[4][2].value).toBe(".");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[4][3].value).toBe("ok");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[5][0].value).toBe("def");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[5][2].value).toBe("foo");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[5][3].value).toBe("(");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[5][4].value).toBe(")");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[5][5].value).toBe(":");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[5][6].value).toBe(" ");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][7].value).toBe("pass");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decorators6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@a. b . \\\n c.None.z(foo=BAR). \\\n baz[1:2]\n@foo.class.bar[]\n@foo.ok '''\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe("a");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][2].value).toBe(".");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][4].value).toBe("b");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][6].value).toBe(".");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[0][8].value).toBe("\\");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[0][9].value).toBe("");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[1][1].value).toBe("c");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[1][2].value).toBe(".");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][3].value).toBe("None");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.illegal.name.python"]);
|
|
expect(tokens[1][4].value).toBe(".");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][5].value).toBe("z");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[1][6].value).toBe("(");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][7].value).toBe("foo");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[1][8].value).toBe("=");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][9].value).toBe("BAR");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","meta.function.decorator.python","meta.function-call.arguments.python","constant.other.caps.python"]);
|
|
expect(tokens[1][10].value).toBe(")");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][11].value).toBe(". \\");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","meta.function.decorator.python","invalid.illegal.decorator.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("baz");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.item-access.python"]);
|
|
expect(tokens[2][2].value).toBe("[");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][3].value).toBe("1");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][4].value).toBe(":");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","punctuation.separator.slice.python"]);
|
|
expect(tokens[2][5].value).toBe("2");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][6].value).toBe("]");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][0].value).toBe("@");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[3][1].value).toBe("foo");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[3][2].value).toBe(".");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][3].value).toBe("class");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.decorator.python","keyword.control.flow.python"]);
|
|
expect(tokens[3][4].value).toBe(".");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][5].value).toBe("bar");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[3][6].value).toBe("[]");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.decorator.python","invalid.illegal.decorator.python","invalid.illegal.decorator.python"]);
|
|
expect(tokens[4][0].value).toBe("@");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[4][1].value).toBe("foo");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[4][2].value).toBe(".");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.separator.period.python"]);
|
|
expect(tokens[4][3].value).toBe("ok");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[4][4].value).toBe(" ");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.function.decorator.python","invalid.illegal.decorator.python"]);
|
|
expect(tokens[4][5].value).toBe("'''");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.function.decorator.python","invalid.illegal.decorator.python","invalid.illegal.decorator.python"]);
|
|
expect(tokens[5][0].value).toBe("def");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[5][2].value).toBe("foo");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[5][3].value).toBe("(");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[5][4].value).toBe(")");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[5][5].value).toBe(":");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[5][6].value).toBe(" ");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][7].value).toBe("pass");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decorators7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# this is testing trailing whitespace after the decorator\n# DO NOT DELETE TRAILING WHITESTAPCE IN THIS FILE\n@foo \n@foo() \n@bar\t\n@bar()\t\n@bar() illegal # legal\n@bar(): \ndef baz(): pass")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" this is testing trailing whitespace after the decorator");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("#");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][1].value).toBe(" DO NOT DELETE TRAILING WHITESTAPCE IN THIS FILE");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[2][0].value).toBe("@");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[2][1].value).toBe("foo");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[3][0].value).toBe("@");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[3][1].value).toBe("foo");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[3][2].value).toBe("(");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[3][3].value).toBe(")");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[3][4].value).toBe(" ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][0].value).toBe("@");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[4][1].value).toBe("bar");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[4][2].value).toBe("\t");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[5][0].value).toBe("@");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[5][1].value).toBe("bar");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[5][2].value).toBe("(");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[5][3].value).toBe(")");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[5][4].value).toBe("\t");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("@");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[6][1].value).toBe("bar");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[6][2].value).toBe("(");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[6][3].value).toBe(")");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[6][4].value).toBe(" illegal");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function.decorator.python","invalid.illegal.decorator.python"]);
|
|
expect(tokens[6][5].value).toBe(" ");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][6].value).toBe("#");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[6][7].value).toBe(" legal");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[7][0].value).toBe("@");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[7][1].value).toBe("bar");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[7][2].value).toBe("(");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[7][3].value).toBe(")");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[7][4].value).toBe(":");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","meta.function.decorator.python","invalid.illegal.decorator.python"]);
|
|
expect(tokens[7][5].value).toBe(" ");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][0].value).toBe("def");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[8][1].value).toBe(" ");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[8][2].value).toBe("baz");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[8][3].value).toBe("(");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[8][4].value).toBe(")");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[8][5].value).toBe(":");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[8][6].value).toBe(" ");
|
|
expect(tokens[8][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][7].value).toBe("pass");
|
|
expect(tokens[8][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/decorators8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("@deco().abc # SyntaxError: invalid syntax\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("@");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[0][1].value).toBe("deco");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[0][2].value).toBe("(");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][3].value).toBe(")");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function.decorator.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][4].value).toBe(".abc");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function.decorator.python","invalid.illegal.decorator.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("#");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][7].value).toBe(" SyntaxError: invalid syntax");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# That's how we want it:\nlll(lambda)")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" That's how we want it:");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("lll");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[1][1].value).toBe("(");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("lambda");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[1][3].value).toBe(")");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("lll(lambda=1)")
|
|
expect(tokens[0][0].value).toBe("lll");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][1].value).toBe("(");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("lambda");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][3].value).toBe("=");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][4].value).toBe("1");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][5].value).toBe(")");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("anon = lambda lambda: 42")
|
|
expect(tokens[0][0].value).toBe("anon");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("lambda");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe("lambda");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][7].value).toBe(":");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("42");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("lambda a : 1")
|
|
expect(tokens[0][0].value).toBe("lambda");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][2].value).toBe("a");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][4].value).toBe(":");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("1");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("anon = lambda -> qqq[None]: None\ndef f(): return 1 # this line should not break")
|
|
expect(tokens[0][0].value).toBe("anon");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("lambda");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe("->");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","invalid.illegal.annotation.python"]);
|
|
expect(tokens[0][7].value).toBe(" qqq[None]");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][8].value).toBe(":");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe("None");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("f");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("return");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][8].value).toBe(" ");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][9].value).toBe("1");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][10].value).toBe(" ");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][11].value).toBe("#");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][12].value).toBe(" this line should not break");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("anon = lambda a=123, c={'': 555}, \\\n d=toow(24): None")
|
|
expect(tokens[0][0].value).toBe("anon");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("lambda");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe("a");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][7].value).toBe("=");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[0][8].value).toBe("123");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][9].value).toBe(",");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][11].value).toBe("c");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][12].value).toBe("=");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[0][13].value).toBe("{");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[0][14].value).toBe("'");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][15].value).toBe("'");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][16].value).toBe(":");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[0][17].value).toBe(" ");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][18].value).toBe("555");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][19].value).toBe("}");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[0][20].value).toBe(",");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[0][21].value).toBe(" ");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][22].value).toBe("\\");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[0][23].value).toBe("");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[1][1].value).toBe("d");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[1][3].value).toBe("toow");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[1][4].value).toBe("(");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("24");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][6].value).toBe(")");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][7].value).toBe(":");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[1][8].value).toBe(" ");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][9].value).toBe("None");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","constant.language.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("anon = lambda a, c={'key':\n\n 555}, e=fff: None")
|
|
expect(tokens[0][0].value).toBe("anon");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("lambda");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe("a");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][7].value).toBe(",");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][9].value).toBe("c");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][10].value).toBe("=");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[0][11].value).toBe("{");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[0][12].value).toBe("'");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][13].value).toBe("key");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","string.quoted.single.python"]);
|
|
expect(tokens[0][14].value).toBe("'");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][15].value).toBe(":");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[2][1].value).toBe("555");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][2].value).toBe("}");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[2][3].value).toBe(",");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[2][4].value).toBe(" ");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[2][5].value).toBe("e");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][6].value).toBe("=");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[2][7].value).toBe("fff");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[2][8].value).toBe(":");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][10].value).toBe("None");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","constant.language.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("anon = lambda a,\n d=1: None\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("anon");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("lambda");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe("a");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][7].value).toBe(",");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[0][8].value).toBe("");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.lambda-function.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("d");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe("1");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][4].value).toBe(":");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("None");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","constant.language.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][5].value).toBe(":");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[2][6].value).toBe(" ");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][7].value).toBe("pass");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/functions/lambda9.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("lambda *, b: b\nlambda *b: b\nlambda **b: b")
|
|
expect(tokens[0][0].value).toBe("lambda");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][2].value).toBe("*");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[0][3].value).toBe(", ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][4].value).toBe("b");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[0][5].value).toBe(":");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("b");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("lambda");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[1][2].value).toBe("*");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[1][3].value).toBe("b");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[1][4].value).toBe(":");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("b");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("lambda");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[2][2].value).toBe("**");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","keyword.operator.unpacking.parameter.python"]);
|
|
expect(tokens[2][3].value).toBe("b");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][4].value).toBe(":");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("b");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/illegals/backticks1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = `(1, `2`)`")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("`");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[0][5].value).toBe("(");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("1");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][7].value).toBe(",");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[0][9].value).toBe("`");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[0][10].value).toBe("2");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","invalid.deprecated.backtick.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][11].value).toBe("`");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[0][12].value).toBe(")");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[0][13].value).toBe("`");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","invalid.deprecated.backtick.python"]);
|
|
});
|
|
|
|
it("test/illegals/backticks2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = `\\\n123`\nprint a")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("`");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[0][5].value).toBe("\\");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[0][6].value).toBe("");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[1][0].value).toBe("123");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","invalid.deprecated.backtick.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][1].value).toBe("`");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[2][0].value).toBe("print");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","support.function.builtin.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("a");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/illegals/backticks3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = lambda `123`\n# comment")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("lambda");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python"]);
|
|
expect(tokens[0][6].value).toBe("`");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[0][7].value).toBe("123");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","invalid.deprecated.backtick.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][8].value).toBe("`");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","meta.lambda-function.python","meta.function.lambda.parameters.python","invalid.deprecated.backtick.python"]);
|
|
expect(tokens[0][9].value).toBe("");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","meta.lambda-function.python"]);
|
|
expect(tokens[1][0].value).toBe("#");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][1].value).toBe(" comment");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/illegals/illegal1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("->\ndef f(): pass\n$\n?\na=$('.class').fuuuu(baz=1)\n# we recover just fine\nb = !some_ruby?\n# hey ;)")
|
|
expect(tokens[0][0].value).toBe("->");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","invalid.illegal.annotation.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("f");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("$");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[3][0].value).toBe("?");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("=");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][2].value).toBe("$");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[4][3].value).toBe("(");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[4][4].value).toBe("'");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][5].value).toBe(".class");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[4][6].value).toBe("'");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][7].value).toBe(")");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[4][8].value).toBe(".");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[4][9].value).toBe("fuuuu");
|
|
expect(tokens[4][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[4][10].value).toBe("(");
|
|
expect(tokens[4][10].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[4][11].value).toBe("baz");
|
|
expect(tokens[4][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[4][12].value).toBe("=");
|
|
expect(tokens[4][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][13].value).toBe("1");
|
|
expect(tokens[4][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[4][14].value).toBe(")");
|
|
expect(tokens[4][14].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[5][0].value).toBe("#");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[5][1].value).toBe(" we recover just fine");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[6][0].value).toBe("b");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][2].value).toBe("=");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[6][3].value).toBe(" ");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][4].value).toBe("!");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[6][5].value).toBe("some_ruby");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][6].value).toBe("?");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[7][0].value).toBe("#");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[7][1].value).toBe(" hey ;)");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/illegals/illegal2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a&&b||c\na &&= a\nb ||= c")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe("&&");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[0][2].value).toBe("b");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe("||");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[0][4].value).toBe("c");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("&&");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[1][3].value).toBe("=");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][5].value).toBe("a");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("b");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("||");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[2][3].value).toBe("=");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][4].value).toBe(" ");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][5].value).toBe("c");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/linecont/linecont1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("1 + \\ sdgfsdf\ndef foo(): pass")
|
|
expect(tokens[0][0].value).toBe("1");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("+");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("\\");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("sdgfsdf");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","invalid.illegal.line.continuation.python"]);
|
|
expect(tokens[1][0].value).toBe("def");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[1][3].value).toBe("(");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("pass");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/linecont/linecont2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("1 + \\\n 3")
|
|
expect(tokens[0][0].value).toBe("1");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("+");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("\\");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[0][5].value).toBe("");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("3");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/numbers/complex1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("3.14j\n10.j\n10j\n.001j\n1e100j\n3.14e-10j")
|
|
expect(tokens[0][0].value).toBe("3.14");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[0][1].value).toBe("j");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[1][0].value).toBe("10.");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[1][1].value).toBe("j");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[2][0].value).toBe("10");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][1].value).toBe("j");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","constant.numeric.dec.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[3][0].value).toBe(".001");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[3][1].value).toBe("j");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[4][0].value).toBe("1e100");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[4][1].value).toBe("j");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[5][0].value).toBe("3.14e-10");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[5][1].value).toBe("j");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
});
|
|
|
|
it("test/numbers/complex2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("3.141_592j\n10_000.j\n10_000j\n.001_123j\n1e10_000j\n3.141_592e-10_000j")
|
|
expect(tokens[0][0].value).toBe("3.141_592");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[0][1].value).toBe("j");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[1][0].value).toBe("10_000.");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[1][1].value).toBe("j");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[2][0].value).toBe("10_000");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][1].value).toBe("j");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","constant.numeric.dec.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[3][0].value).toBe(".001_123");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[3][1].value).toBe("j");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[4][0].value).toBe("1e10_000");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[4][1].value).toBe("j");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
expect(tokens[5][0].value).toBe("3.141_592e-10_000");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[5][1].value).toBe("j");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","constant.numeric.float.python","storage.type.imaginary.number.python"]);
|
|
});
|
|
|
|
it("test/numbers/dec.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("123\n000\n123_456\n1_2_3_4_5_6")
|
|
expect(tokens[0][0].value).toBe("123");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][0].value).toBe("000");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][0].value).toBe("123_456");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][0].value).toBe("1_2_3_4_5_6");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/numbers/floats1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("123.456\n0.456\n000.0001\n.01234\n123e5\n123e-5\n000123e-005\n123.456e+5\n0.456e-5")
|
|
expect(tokens[0][0].value).toBe("123.456");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[1][0].value).toBe("0.456");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[2][0].value).toBe("000.0001");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[3][0].value).toBe(".01234");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[4][0].value).toBe("123e5");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[5][0].value).toBe("123e-5");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[6][0].value).toBe("000123e-005");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[7][0].value).toBe("123.456e+5");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[8][0].value).toBe("0.456e-5");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
});
|
|
|
|
it("test/numbers/floats2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("1_234.567_890\n0.456_789\n000.000_1\n.012_34\n1_234e5_000\n1_234e-5_000\n000_123e-000_5\n1_234.567_8e+5_000\n0.456_78e-5_000")
|
|
expect(tokens[0][0].value).toBe("1_234.567_890");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[1][0].value).toBe("0.456_789");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[2][0].value).toBe("000.000_1");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[3][0].value).toBe(".012_34");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[4][0].value).toBe("1_234e5_000");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[5][0].value).toBe("1_234e-5_000");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[6][0].value).toBe("000_123e-000_5");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[7][0].value).toBe("1_234.567_8e+5_000");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
expect(tokens[8][0].value).toBe("0.456_78e-5_000");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","constant.numeric.float.python"]);
|
|
});
|
|
|
|
it("test/numbers/invalid.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("0123\n0123l\n123f\n123d\n123A\n123__456\n123_")
|
|
expect(tokens[0][0].value).toBe("0");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][1].value).toBe("123");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","constant.numeric.dec.python","invalid.illegal.dec.python"]);
|
|
expect(tokens[1][0].value).toBe("0123l");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[2][0].value).toBe("123f");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[3][0].value).toBe("123d");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[4][0].value).toBe("123A");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[5][0].value).toBe("123__456");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[6][0].value).toBe("123_");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
});
|
|
|
|
it("test/numbers/nondec.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("0o1234567\n0O1234567\n0o1_234_567\n0b0000\n0B0001\n0b_0011_1001\n0xabcdef01234567890\n0XFF12\n0xab_cd_ef_01_23_45_67_89_00\n\n0o\n0b\n0x\n0z\n\n0b02\n0x0z\n0o90")
|
|
expect(tokens[0][0].value).toBe("0o");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.oct.python","storage.type.number.python"]);
|
|
expect(tokens[0][1].value).toBe("1234567");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","constant.numeric.oct.python"]);
|
|
expect(tokens[1][0].value).toBe("0O");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.numeric.oct.python","storage.type.number.python"]);
|
|
expect(tokens[1][1].value).toBe("1234567");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","constant.numeric.oct.python"]);
|
|
expect(tokens[2][0].value).toBe("0o");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","constant.numeric.oct.python","storage.type.number.python"]);
|
|
expect(tokens[2][1].value).toBe("1_234_567");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","constant.numeric.oct.python"]);
|
|
expect(tokens[3][0].value).toBe("0b");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","constant.numeric.bin.python","storage.type.number.python"]);
|
|
expect(tokens[3][1].value).toBe("0000");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","constant.numeric.bin.python"]);
|
|
expect(tokens[4][0].value).toBe("0B");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","constant.numeric.bin.python","storage.type.number.python"]);
|
|
expect(tokens[4][1].value).toBe("0001");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","constant.numeric.bin.python"]);
|
|
expect(tokens[5][0].value).toBe("0b");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","constant.numeric.bin.python","storage.type.number.python"]);
|
|
expect(tokens[5][1].value).toBe("_0011_1001");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","constant.numeric.bin.python"]);
|
|
expect(tokens[6][0].value).toBe("0x");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","constant.numeric.hex.python","storage.type.number.python"]);
|
|
expect(tokens[6][1].value).toBe("abcdef01234567890");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","constant.numeric.hex.python"]);
|
|
expect(tokens[7][0].value).toBe("0X");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","constant.numeric.hex.python","storage.type.number.python"]);
|
|
expect(tokens[7][1].value).toBe("FF12");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","constant.numeric.hex.python"]);
|
|
expect(tokens[8][0].value).toBe("0x");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","constant.numeric.hex.python","storage.type.number.python"]);
|
|
expect(tokens[8][1].value).toBe("ab_cd_ef_01_23_45_67_89_00");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","constant.numeric.hex.python"]);
|
|
expect(tokens[9][0].value).toBe("");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][0].value).toBe("0o");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[11][0].value).toBe("0b");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[12][0].value).toBe("0x");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[13][0].value).toBe("0z");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[14][0].value).toBe("");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[15][0].value).toBe("0b02");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[16][0].value).toBe("0x0z");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
expect(tokens[17][0].value).toBe("0o90");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
});
|
|
|
|
it("test/numbers/python2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("123l\n123L\n1_234l")
|
|
expect(tokens[0][0].value).toBe("123");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","constant.numeric.bin.python"]);
|
|
expect(tokens[0][1].value).toBe("l");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","constant.numeric.bin.python","storage.type.number.python"]);
|
|
expect(tokens[1][0].value).toBe("123");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.numeric.bin.python"]);
|
|
expect(tokens[1][1].value).toBe("L");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","constant.numeric.bin.python","storage.type.number.python"]);
|
|
expect(tokens[2][0].value).toBe("1_234l");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","invalid.illegal.name.python"]);
|
|
});
|
|
|
|
it("test/regexp/comments1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r'''foo[abc] # comment'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'''");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("foo");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[0][7].value).toBe("[");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[0][8].value).toBe("a");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][9].value).toBe("b");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][10].value).toBe("c");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][11].value).toBe("]");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[0][13].value).toBe("#");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][14].value).toBe(" comment");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[0][15].value).toBe("'''");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/fregexp1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = fr'[a-z]'\na = Fr'[a-z]'\na = rf'[a-z]'\na = rF'[a-z]'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("fr");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("[");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[0][7].value).toBe("a");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][8].value).toBe("-");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][9].value).toBe("z");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][10].value).toBe("]");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[0][11].value).toBe("'");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("Fr");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("[");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[1][7].value).toBe("a");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[1][8].value).toBe("-");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[1][9].value).toBe("z");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[1][10].value).toBe("]");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[1][11].value).toBe("'");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("rf");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("[");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[2][7].value).toBe("a");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][8].value).toBe("-");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][9].value).toBe("z");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][10].value).toBe("]");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[2][11].value).toBe("'");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("rF");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[3][5].value).toBe("'");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][6].value).toBe("[");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[3][7].value).toBe("a");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[3][8].value).toBe("-");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[3][9].value).toBe("z");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[3][10].value).toBe("]");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[3][11].value).toBe("'");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/fregexp2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("rf'fo{{2}}'\nrf\"fo{{2}}\"\nrf'''fo{{2}}'''\nrf\"\"\"fo{{2}}\"\"\"")
|
|
expect(tokens[0][0].value).toBe("rf");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("fo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{{2}}");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("rf");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[1][1].value).toBe("\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("fo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][3].value).toBe("{{2}}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[1][4].value).toBe("\"");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("rf");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("'''");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("fo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][3].value).toBe("{{2}}");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[2][4].value).toBe("'''");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("rf");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[3][1].value).toBe("\"\"\"");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe("fo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][3].value).toBe("{{2}}");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[3][4].value).toBe("\"\"\"");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/fregexp3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("rf'fo{2}'\nrf\"fo{2}\"\nrf'''fo{2}'''\nrf\"\"\"fo{2}\"\"\"")
|
|
expect(tokens[0][0].value).toBe("rf");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[0][1].value).toBe("'");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("fo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][3].value).toBe("{2}");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("rf");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[1][1].value).toBe("\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("fo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][3].value).toBe("{2}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][4].value).toBe("\"");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("rf");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[2][1].value).toBe("'''");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("fo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][3].value).toBe("{2}");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[2][4].value).toBe("'''");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("rf");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[3][1].value).toBe("\"\"\"");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][2].value).toBe("fo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][3].value).toBe("{2}");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]);
|
|
expect(tokens[3][4].value).toBe("\"\"\"");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/fregexp4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = rf'fo{{2}}'\na = r'fo{{2}}'\na = r'fo{2}'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("rf");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("fo");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][7].value).toBe("{{2}}");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[0][8].value).toBe("'");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("r");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("fo{");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[1][7].value).toBe("{2}");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[1][8].value).toBe("}");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[1][9].value).toBe("'");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("r");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("fo");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[2][7].value).toBe("{2}");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[2][8].value).toBe("'");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/fregexp5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = rf'{{foo}}'\na = r'\\{foo\\}'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("rf");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("{{");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]);
|
|
expect(tokens[0][7].value).toBe("foo");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][8].value).toBe("}}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]);
|
|
expect(tokens[0][9].value).toBe("'");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("r");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("\\{");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]);
|
|
expect(tokens[1][7].value).toBe("foo");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[1][8].value).toBe("\\}");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]);
|
|
expect(tokens[1][9].value).toBe("'");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/fregexp6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = rf'fo{{{2}}}'\na = rf'fo{{{bar}}}'\na = rf'fo{{2}}'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("rf");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("fo");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][7].value).toBe("{{");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]);
|
|
expect(tokens[0][8].value).toBe("{2}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[0][9].value).toBe("}}");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]);
|
|
expect(tokens[0][10].value).toBe("'");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("rf");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("fo");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][7].value).toBe("{{");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]);
|
|
expect(tokens[1][8].value).toBe("{bar}");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[1][9].value).toBe("}}");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]);
|
|
expect(tokens[1][10].value).toBe("'");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("rf");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("fo");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]);
|
|
expect(tokens[2][7].value).toBe("{{2}}");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[2][8].value).toBe("'");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/python1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r'[a-z]'\na = R'[a-z]'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("[");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[0][7].value).toBe("a");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][8].value).toBe("-");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][9].value).toBe("z");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[0][10].value).toBe("]");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[0][11].value).toBe("'");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("R");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("[a-z]");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[1][7].value).toBe("'");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/python10.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r'(<\\' for\na = r\"(<\\\" for\na = r'[<\\' for\na = r\"[<\\\" for\na = r'(?=\\' for\na = r\"(?=\\\" for\na = r'(?P<a>\\' for\na = r\"(?P<a>\\\" for\na = r'(?<!a\\' for\na = r\"(?<!a\\\" for\nreturn some")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("(");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[0][7].value).toBe("<");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[0][8].value).toBe("\\'");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]);
|
|
expect(tokens[0][9].value).toBe(" for");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[0][10].value).toBe("");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("r");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("(");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[1][7].value).toBe("<");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[1][8].value).toBe("\\\"");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]);
|
|
expect(tokens[1][9].value).toBe(" for");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[1][10].value).toBe("");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("r");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("[");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[2][7].value).toBe("<");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][8].value).toBe("\\'");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.escape.regexp"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][10].value).toBe("f");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][11].value).toBe("o");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][12].value).toBe("r");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[2][13].value).toBe("");
|
|
expect(tokens[2][13].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("r");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[3][5].value).toBe("\"");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][6].value).toBe("[");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[3][7].value).toBe("<");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[3][8].value).toBe("\\\"");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.escape.regexp"]);
|
|
expect(tokens[3][9].value).toBe(" ");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[3][10].value).toBe("f");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[3][11].value).toBe("o");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[3][12].value).toBe("r");
|
|
expect(tokens[3][12].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[3][13].value).toBe("");
|
|
expect(tokens[3][13].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("r");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][5].value).toBe("'");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][6].value).toBe("(");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookahead.regexp","punctuation.parenthesis.lookahead.begin.regexp"]);
|
|
expect(tokens[4][7].value).toBe("?=");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookahead.regexp"]);
|
|
expect(tokens[4][8].value).toBe("\\'");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]);
|
|
expect(tokens[4][9].value).toBe(" for");
|
|
expect(tokens[4][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[4][10].value).toBe("");
|
|
expect(tokens[4][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[5][0].value).toBe("a");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][2].value).toBe("=");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("r");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[5][5].value).toBe("\"");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][6].value).toBe("(");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookahead.regexp","punctuation.parenthesis.lookahead.begin.regexp"]);
|
|
expect(tokens[5][7].value).toBe("?=");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookahead.regexp"]);
|
|
expect(tokens[5][8].value).toBe("\\\"");
|
|
expect(tokens[5][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]);
|
|
expect(tokens[5][9].value).toBe(" for");
|
|
expect(tokens[5][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[5][10].value).toBe("");
|
|
expect(tokens[5][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[6][0].value).toBe("a");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][2].value).toBe("=");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[6][3].value).toBe(" ");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][4].value).toBe("r");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[6][5].value).toBe("'");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][6].value).toBe("(");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.named.regexp","punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[6][7].value).toBe("?P<a>");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.named.regexp","entity.name.tag.named.group.regexp"]);
|
|
expect(tokens[6][8].value).toBe("\\'");
|
|
expect(tokens[6][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.named.regexp","constant.character.escape.regexp"]);
|
|
expect(tokens[6][9].value).toBe(" for");
|
|
expect(tokens[6][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.named.regexp"]);
|
|
expect(tokens[6][10].value).toBe("");
|
|
expect(tokens[6][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[7][0].value).toBe("a");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe(" ");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][2].value).toBe("=");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[7][3].value).toBe(" ");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][4].value).toBe("r");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[7][5].value).toBe("\"");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[7][6].value).toBe("(");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.named.regexp","punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[7][7].value).toBe("?P<a>");
|
|
expect(tokens[7][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.named.regexp","entity.name.tag.named.group.regexp"]);
|
|
expect(tokens[7][8].value).toBe("\\\"");
|
|
expect(tokens[7][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.named.regexp","constant.character.escape.regexp"]);
|
|
expect(tokens[7][9].value).toBe(" for");
|
|
expect(tokens[7][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","meta.named.regexp"]);
|
|
expect(tokens[7][10].value).toBe("");
|
|
expect(tokens[7][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[8][0].value).toBe("a");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe(" ");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][2].value).toBe("=");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[8][3].value).toBe(" ");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][4].value).toBe("r");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[8][5].value).toBe("'");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[8][6].value).toBe("(");
|
|
expect(tokens[8][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookbehind.negative.regexp","punctuation.parenthesis.lookbehind.begin.regexp"]);
|
|
expect(tokens[8][7].value).toBe("?<!");
|
|
expect(tokens[8][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookbehind.negative.regexp"]);
|
|
expect(tokens[8][8].value).toBe("a");
|
|
expect(tokens[8][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[8][9].value).toBe("\\'");
|
|
expect(tokens[8][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]);
|
|
expect(tokens[8][10].value).toBe(" for");
|
|
expect(tokens[8][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[8][11].value).toBe("");
|
|
expect(tokens[8][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[9][0].value).toBe("a");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][1].value).toBe(" ");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][2].value).toBe("=");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[9][3].value).toBe(" ");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][4].value).toBe("r");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[9][5].value).toBe("\"");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[9][6].value).toBe("(");
|
|
expect(tokens[9][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookbehind.negative.regexp","punctuation.parenthesis.lookbehind.begin.regexp"]);
|
|
expect(tokens[9][7].value).toBe("?<!");
|
|
expect(tokens[9][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookbehind.negative.regexp"]);
|
|
expect(tokens[9][8].value).toBe("a");
|
|
expect(tokens[9][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[9][9].value).toBe("\\\"");
|
|
expect(tokens[9][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]);
|
|
expect(tokens[9][10].value).toBe(" for");
|
|
expect(tokens[9][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[9][11].value).toBe("");
|
|
expect(tokens[9][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[10][0].value).toBe("return");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[10][1].value).toBe(" ");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][2].value).toBe("some");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/regexp/python11.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r\"\"\"\n (?x) # multi-XXXline XXX regexp\n foo (?# comm TODOent TODO)\n foo # type: int\n foo (?# type: int)\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("\"\"\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("(?x)");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[1][3].value).toBe("#");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][4].value).toBe(" multi-XXXline ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][5].value).toBe("XXX");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[1][6].value).toBe(" regexp");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[2][0].value).toBe(" foo ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[2][1].value).toBe("(?#");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.regexp","punctuation.comment.begin.regexp"]);
|
|
expect(tokens[2][2].value).toBe(" comm TODOent ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.regexp"]);
|
|
expect(tokens[2][3].value).toBe("TODO");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.regexp","keyword.codetag.notation.python"]);
|
|
expect(tokens[2][4].value).toBe(")");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.regexp","punctuation.comment.end.regexp"]);
|
|
expect(tokens[3][0].value).toBe(" foo ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("#");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][2].value).toBe(" type: int");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[4][0].value).toBe(" foo ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[4][1].value).toBe("(?#");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.regexp","punctuation.comment.begin.regexp"]);
|
|
expect(tokens[4][2].value).toBe(" type: int");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.regexp"]);
|
|
expect(tokens[4][3].value).toBe(")");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.regexp","punctuation.comment.end.regexp"]);
|
|
expect(tokens[5][0].value).toBe("\"\"\"");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/python2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r'\n (?x)\n foo\n'\n# comment")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("(");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("?");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","invalid.illegal.operator.python"]);
|
|
expect(tokens[1][3].value).toBe("x");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe(")");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("foo");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("'");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][1].value).toBe("");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[4][0].value).toBe("#");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[4][1].value).toBe(" comment");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/regexp/python3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r'''\n (?x)\n foo\n'''\na = br'''\n (?x)\n foo\n'''\na = rb'''\n (?x)\n foo\n'''\na = Br'''\n (?x)\n foo\n'''\na = rB'''\n (?x)\n foo\n'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'''");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("(?x)");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[2][0].value).toBe(" foo");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][0].value).toBe("'''");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("br");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][5].value).toBe("'''");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("(?x)");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[6][0].value).toBe(" foo");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[7][0].value).toBe("'''");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("a");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe(" ");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][2].value).toBe("=");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[8][3].value).toBe(" ");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][4].value).toBe("rb");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[8][5].value).toBe("'''");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[9][1].value).toBe("(?x)");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[10][0].value).toBe(" foo");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[11][0].value).toBe("'''");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[12][0].value).toBe("a");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][1].value).toBe(" ");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][2].value).toBe("=");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[12][3].value).toBe(" ");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][4].value).toBe("Br");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[12][5].value).toBe("'''");
|
|
expect(tokens[12][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[13][1].value).toBe("(?x)");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[14][0].value).toBe(" foo");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[15][0].value).toBe("'''");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[16][0].value).toBe("a");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe(" ");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][2].value).toBe("=");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[16][3].value).toBe(" ");
|
|
expect(tokens[16][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][4].value).toBe("rB");
|
|
expect(tokens[16][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[16][5].value).toBe("'''");
|
|
expect(tokens[16][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[17][0].value).toBe(" ");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[17][1].value).toBe("(?x)");
|
|
expect(tokens[17][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[18][0].value).toBe(" foo");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[19][0].value).toBe("'''");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/python4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r\"\"\"\n (?x)\n foo\n\"\"\"\na = br\"\"\"\n (?x)\n foo\n\"\"\"\na = rb\"\"\"\n (?x)\n foo\n\"\"\"\na = Br\"\"\"\n (?x)\n foo\n\"\"\"\na = rB\"\"\"\n (?x)\n foo\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("\"\"\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("(?x)");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[2][0].value).toBe(" foo");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][0].value).toBe("\"\"\"");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("br");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[4][5].value).toBe("\"\"\"");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("(?x)");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[6][0].value).toBe(" foo");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[7][0].value).toBe("\"\"\"");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("a");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe(" ");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][2].value).toBe("=");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[8][3].value).toBe(" ");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][4].value).toBe("rb");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[8][5].value).toBe("\"\"\"");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[9][1].value).toBe("(?x)");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[10][0].value).toBe(" foo");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[11][0].value).toBe("\"\"\"");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[12][0].value).toBe("a");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][1].value).toBe(" ");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][2].value).toBe("=");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[12][3].value).toBe(" ");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[12][4].value).toBe("Br");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[12][5].value).toBe("\"\"\"");
|
|
expect(tokens[12][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[13][1].value).toBe("(?x)");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[14][0].value).toBe(" foo");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[15][0].value).toBe("\"\"\"");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[16][0].value).toBe("a");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][1].value).toBe(" ");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][2].value).toBe("=");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[16][3].value).toBe(" ");
|
|
expect(tokens[16][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[16][4].value).toBe("rB");
|
|
expect(tokens[16][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[16][5].value).toBe("\"\"\"");
|
|
expect(tokens[16][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[17][0].value).toBe(" ");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[17][1].value).toBe("(?x)");
|
|
expect(tokens[17][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[18][0].value).toBe(" foo");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[19][0].value).toBe("\"\"\"");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/python5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r'foo#not a comment'\na = r'''\n (?x) # multi-line regexp\n foo # comment\n'''\na = R'''\n (?x) # not a\n foo # comment\n'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("foo#not a comment");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("r");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'''");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[2][1].value).toBe("(?x)");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[2][3].value).toBe("#");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][4].value).toBe(" multi-line regexp");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][0].value).toBe(" foo ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("#");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][2].value).toBe(" comment");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[4][0].value).toBe("'''");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("a");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][2].value).toBe("=");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("R");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","string.quoted.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[5][5].value).toBe("'''");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][0].value).toBe(" (?x) # not a");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[7][0].value).toBe(" foo # comment");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[8][0].value).toBe("'''");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/python6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r\"foo#not a comment\"\na = r\"\"\"\n (?x) # multi-line regexp\n foo # comment\n\"\"\"\na = R\"\"\"\n (?x) # not a\n foo # comment\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("foo#not a comment");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[0][7].value).toBe("\"");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("r");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("\"\"\"");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[2][1].value).toBe("(?x)");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[2][2].value).toBe(" ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[2][3].value).toBe("#");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][4].value).toBe(" multi-line regexp");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][0].value).toBe(" foo ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("#");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][2].value).toBe(" comment");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[4][0].value).toBe("\"\"\"");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("a");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][2].value).toBe("=");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("R");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","string.quoted.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[5][5].value).toBe("\"\"\"");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][0].value).toBe(" (?x) # not a");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[7][0].value).toBe(" foo # comment");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[8][0].value).toBe("\"\"\"");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/regexp/python7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r'('\n1\n\na = r\"(?=\"\n1\n\na = r\"\"\"(?:\n\"\"\"\n1\n\na = r'''[\n'''\n1")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("(");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("1");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("r");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[3][5].value).toBe("\"");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][6].value).toBe("(");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookahead.regexp","punctuation.parenthesis.lookahead.begin.regexp"]);
|
|
expect(tokens[3][7].value).toBe("?=");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.lookahead.regexp"]);
|
|
expect(tokens[3][8].value).toBe("\"");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("1");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[5][0].value).toBe("");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("a");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][2].value).toBe("=");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[6][3].value).toBe(" ");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][4].value).toBe("r");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[6][5].value).toBe("\"\"\"");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][6].value).toBe("(?:");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.parenthesis.non-capturing.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[7][0].value).toBe("\"\"\"");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[8][0].value).toBe("1");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[9][0].value).toBe("");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][0].value).toBe("a");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][1].value).toBe(" ");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][2].value).toBe("=");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[10][3].value).toBe(" ");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[10][4].value).toBe("r");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[10][5].value).toBe("'''");
|
|
expect(tokens[10][5].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[10][6].value).toBe("[");
|
|
expect(tokens[10][6].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[11][0].value).toBe("'''");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[12][0].value).toBe("1");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/regexp/python8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# And now something fun!\n\nCookiePattern = re.compile(r\"\"\"\n (?x) # This is a verbose pattern\n \\s* # Optional whitespace at start of cookie\n (?P<key> # Start of group 'key'\n [\"\"\" + _LegalKeyChars + r\"\"\"]+? # Any word of at least one letter\n ) # End of group 'key'\n ( # Optional group: there may not be a value.\n \\s*=\\s* # Equal Sign\n (?P<val> # Start of group 'val'\n \"(?:[^\\\\\"]|\\\\.)*\" # Any doublequoted string\n | # or\n \\w{3},\\s[\\w\\d\\s-]{9,11}\\s[\\d:]{8}\\sGMT # Special case for \"expires\" attr\n | # or\n [\"\"\" + _LegalValueChars + r\"\"\"]* # Any word or empty string\n ) # End of group 'val'\n )? # End of optional value group\n \\s* # Any number of spaces.\n (\\s+|;|$) # Ending either at space, semicolon, or EOS.\n \"\"\", re.ASCII) # May be removed if safe.")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" And now something fun!");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("CookiePattern");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("re");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][5].value).toBe(".");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][6].value).toBe("compile");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[2][7].value).toBe("(");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][8].value).toBe("r");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[2][9].value).toBe("\"\"\"");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("(?x)");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.modifier.flag.regexp"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[3][3].value).toBe("#");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][4].value).toBe(" This is a verbose pattern");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[4][1].value).toBe("\\s");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]);
|
|
expect(tokens[4][2].value).toBe("*");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[4][4].value).toBe("#");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[4][5].value).toBe(" Optional whitespace at start of cookie");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("(");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[5][2].value).toBe("?P<key>");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","entity.name.tag.named.group.regexp"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[5][4].value).toBe("#");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[5][5].value).toBe(" Start of group 'key'");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[6][1].value).toBe("[");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[6][2].value).toBe("\"\"\"");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][3].value).toBe(" ");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[6][4].value).toBe("+");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[6][5].value).toBe(" ");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[6][6].value).toBe("_LegalKeyChars");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[6][7].value).toBe(" ");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[6][8].value).toBe("+");
|
|
expect(tokens[6][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[6][9].value).toBe(" ");
|
|
expect(tokens[6][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[6][10].value).toBe("r");
|
|
expect(tokens[6][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[6][11].value).toBe("\"\"\"");
|
|
expect(tokens[6][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][12].value).toBe("]");
|
|
expect(tokens[6][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[6][13].value).toBe("+?");
|
|
expect(tokens[6][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[6][14].value).toBe(" ");
|
|
expect(tokens[6][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[6][15].value).toBe("#");
|
|
expect(tokens[6][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[6][16].value).toBe(" Any word of at least one letter");
|
|
expect(tokens[6][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[7][0].value).toBe(" ) ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[7][1].value).toBe("#");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[7][2].value).toBe(" End of group 'key'");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[8][1].value).toBe("(");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[8][2].value).toBe(" ");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[8][3].value).toBe("#");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[8][4].value).toBe(" Optional group: there may not be a value.");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[9][1].value).toBe("\\s");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]);
|
|
expect(tokens[9][2].value).toBe("*");
|
|
expect(tokens[9][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[9][3].value).toBe("=");
|
|
expect(tokens[9][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[9][4].value).toBe("\\s");
|
|
expect(tokens[9][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]);
|
|
expect(tokens[9][5].value).toBe("*");
|
|
expect(tokens[9][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[9][6].value).toBe(" ");
|
|
expect(tokens[9][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[9][7].value).toBe("#");
|
|
expect(tokens[9][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[9][8].value).toBe(" Equal Sign");
|
|
expect(tokens[9][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[10][0].value).toBe(" ");
|
|
expect(tokens[10][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[10][1].value).toBe("(");
|
|
expect(tokens[10][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[10][2].value).toBe("?P<val>");
|
|
expect(tokens[10][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","entity.name.tag.named.group.regexp"]);
|
|
expect(tokens[10][3].value).toBe(" ");
|
|
expect(tokens[10][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[10][4].value).toBe("#");
|
|
expect(tokens[10][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[10][5].value).toBe(" Start of group 'val'");
|
|
expect(tokens[10][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]);
|
|
expect(tokens[11][0].value).toBe(" \"");
|
|
expect(tokens[11][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[11][1].value).toBe("(?:");
|
|
expect(tokens[11][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.non-capturing.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[11][2].value).toBe("[");
|
|
expect(tokens[11][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[11][3].value).toBe("^");
|
|
expect(tokens[11][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","keyword.operator.negation.regexp"]);
|
|
expect(tokens[11][4].value).toBe("\\\\");
|
|
expect(tokens[11][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.escape.regexp"]);
|
|
expect(tokens[11][5].value).toBe("\"");
|
|
expect(tokens[11][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[11][6].value).toBe("]");
|
|
expect(tokens[11][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[11][7].value).toBe("|");
|
|
expect(tokens[11][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]);
|
|
expect(tokens[11][8].value).toBe("\\\\");
|
|
expect(tokens[11][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","constant.character.escape.regexp"]);
|
|
expect(tokens[11][9].value).toBe(".");
|
|
expect(tokens[11][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.match.any.regexp"]);
|
|
expect(tokens[11][10].value).toBe(")");
|
|
expect(tokens[11][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","punctuation.parenthesis.non-capturing.end.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[11][11].value).toBe("*");
|
|
expect(tokens[11][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[11][12].value).toBe("\" ");
|
|
expect(tokens[11][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[11][13].value).toBe("#");
|
|
expect(tokens[11][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[11][14].value).toBe(" Any doublequoted string");
|
|
expect(tokens[11][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]);
|
|
expect(tokens[12][0].value).toBe(" ");
|
|
expect(tokens[12][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[12][1].value).toBe("|");
|
|
expect(tokens[12][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]);
|
|
expect(tokens[12][2].value).toBe(" ");
|
|
expect(tokens[12][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[12][3].value).toBe("#");
|
|
expect(tokens[12][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[12][4].value).toBe(" or");
|
|
expect(tokens[12][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]);
|
|
expect(tokens[13][0].value).toBe(" ");
|
|
expect(tokens[13][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[13][1].value).toBe("\\w");
|
|
expect(tokens[13][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]);
|
|
expect(tokens[13][2].value).toBe("{3}");
|
|
expect(tokens[13][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[13][3].value).toBe(",");
|
|
expect(tokens[13][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[13][4].value).toBe("\\s");
|
|
expect(tokens[13][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]);
|
|
expect(tokens[13][5].value).toBe("[");
|
|
expect(tokens[13][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[13][6].value).toBe("\\w");
|
|
expect(tokens[13][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]);
|
|
expect(tokens[13][7].value).toBe("\\d");
|
|
expect(tokens[13][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]);
|
|
expect(tokens[13][8].value).toBe("\\s");
|
|
expect(tokens[13][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]);
|
|
expect(tokens[13][9].value).toBe("-");
|
|
expect(tokens[13][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[13][10].value).toBe("]");
|
|
expect(tokens[13][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[13][11].value).toBe("{9,11}");
|
|
expect(tokens[13][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[13][12].value).toBe("\\s");
|
|
expect(tokens[13][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]);
|
|
expect(tokens[13][13].value).toBe("[");
|
|
expect(tokens[13][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[13][14].value).toBe("\\d");
|
|
expect(tokens[13][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","support.other.escape.special.regexp"]);
|
|
expect(tokens[13][15].value).toBe(":");
|
|
expect(tokens[13][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.character.set.regexp"]);
|
|
expect(tokens[13][16].value).toBe("]");
|
|
expect(tokens[13][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]);
|
|
expect(tokens[13][17].value).toBe("{8}");
|
|
expect(tokens[13][17].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[13][18].value).toBe("\\s");
|
|
expect(tokens[13][18].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","support.other.escape.special.regexp"]);
|
|
expect(tokens[13][19].value).toBe("GMT ");
|
|
expect(tokens[13][19].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[13][20].value).toBe("#");
|
|
expect(tokens[13][20].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[13][21].value).toBe(" Special case for \"expires\" attr");
|
|
expect(tokens[13][21].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]);
|
|
expect(tokens[14][0].value).toBe(" ");
|
|
expect(tokens[14][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[14][1].value).toBe("|");
|
|
expect(tokens[14][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","keyword.operator.disjunction.regexp"]);
|
|
expect(tokens[14][2].value).toBe(" ");
|
|
expect(tokens[14][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[14][3].value).toBe("#");
|
|
expect(tokens[14][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[14][4].value).toBe(" or");
|
|
expect(tokens[14][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","comment.line.number-sign.python"]);
|
|
expect(tokens[15][0].value).toBe(" ");
|
|
expect(tokens[15][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp"]);
|
|
expect(tokens[15][1].value).toBe("[");
|
|
expect(tokens[15][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","meta.named.regexp","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]);
|
|
expect(tokens[15][2].value).toBe("\"\"\"");
|
|
expect(tokens[15][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[15][3].value).toBe(" ");
|
|
expect(tokens[15][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[15][4].value).toBe("+");
|
|
expect(tokens[15][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[15][5].value).toBe(" ");
|
|
expect(tokens[15][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[15][6].value).toBe("_LegalValueChars");
|
|
expect(tokens[15][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[15][7].value).toBe(" ");
|
|
expect(tokens[15][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[15][8].value).toBe("+");
|
|
expect(tokens[15][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[15][9].value).toBe(" ");
|
|
expect(tokens[15][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[15][10].value).toBe("r");
|
|
expect(tokens[15][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","storage.type.string.python"]);
|
|
expect(tokens[15][11].value).toBe("\"\"\"");
|
|
expect(tokens[15][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[15][12].value).toBe("]");
|
|
expect(tokens[15][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[15][13].value).toBe("*");
|
|
expect(tokens[15][13].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[15][14].value).toBe(" ");
|
|
expect(tokens[15][14].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[15][15].value).toBe("#");
|
|
expect(tokens[15][15].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[15][16].value).toBe(" Any word or empty string");
|
|
expect(tokens[15][16].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[16][0].value).toBe(" ) ");
|
|
expect(tokens[16][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[16][1].value).toBe("#");
|
|
expect(tokens[16][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[16][2].value).toBe(" End of group 'val'");
|
|
expect(tokens[16][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[17][0].value).toBe(" )");
|
|
expect(tokens[17][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[17][1].value).toBe("?");
|
|
expect(tokens[17][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[17][2].value).toBe(" ");
|
|
expect(tokens[17][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[17][3].value).toBe("#");
|
|
expect(tokens[17][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[17][4].value).toBe(" End of optional value group");
|
|
expect(tokens[17][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[18][0].value).toBe(" ");
|
|
expect(tokens[18][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[18][1].value).toBe("\\s");
|
|
expect(tokens[18][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]);
|
|
expect(tokens[18][2].value).toBe("*");
|
|
expect(tokens[18][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[18][3].value).toBe(" ");
|
|
expect(tokens[18][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[18][4].value).toBe("#");
|
|
expect(tokens[18][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[18][5].value).toBe(" Any number of spaces.");
|
|
expect(tokens[18][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[19][0].value).toBe(" ");
|
|
expect(tokens[19][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[19][1].value).toBe("(");
|
|
expect(tokens[19][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[19][2].value).toBe("\\s");
|
|
expect(tokens[19][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.escape.special.regexp"]);
|
|
expect(tokens[19][3].value).toBe("+");
|
|
expect(tokens[19][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.quantifier.regexp"]);
|
|
expect(tokens[19][4].value).toBe("|");
|
|
expect(tokens[19][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.disjunction.regexp"]);
|
|
expect(tokens[19][5].value).toBe(";");
|
|
expect(tokens[19][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[19][6].value).toBe("|");
|
|
expect(tokens[19][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","keyword.operator.disjunction.regexp"]);
|
|
expect(tokens[19][7].value).toBe("$");
|
|
expect(tokens[19][7].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","support.other.match.end.regexp"]);
|
|
expect(tokens[19][8].value).toBe(")");
|
|
expect(tokens[19][8].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.parenthesis.end.regexp support.other.parenthesis.regexp"]);
|
|
expect(tokens[19][9].value).toBe(" ");
|
|
expect(tokens[19][9].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[19][10].value).toBe("#");
|
|
expect(tokens[19][10].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[19][11].value).toBe(" Ending either at space, semicolon, or EOS.");
|
|
expect(tokens[19][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","comment.line.number-sign.python"]);
|
|
expect(tokens[20][0].value).toBe(" ");
|
|
expect(tokens[20][0].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python"]);
|
|
expect(tokens[20][1].value).toBe("\"\"\"");
|
|
expect(tokens[20][1].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[20][2].value).toBe(",");
|
|
expect(tokens[20][2].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.arguments.python"]);
|
|
expect(tokens[20][3].value).toBe(" ");
|
|
expect(tokens[20][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[20][4].value).toBe("re");
|
|
expect(tokens[20][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[20][5].value).toBe(".");
|
|
expect(tokens[20][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","punctuation.separator.period.python"]);
|
|
expect(tokens[20][6].value).toBe("ASCII");
|
|
expect(tokens[20][6].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.other.caps.python"]);
|
|
expect(tokens[20][7].value).toBe(")");
|
|
expect(tokens[20][7].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[20][8].value).toBe(" ");
|
|
expect(tokens[20][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[20][9].value).toBe("#");
|
|
expect(tokens[20][9].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[20][10].value).toBe(" May be removed if safe.");
|
|
expect(tokens[20][10].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/regexp/python9.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r'foo[^]'\na = r'foo[]'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("foo");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[0][7].value).toBe("[^]");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[0][8].value).toBe("'");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("r");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("foo");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[1][7].value).toBe("[]");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[1][8].value).toBe("'");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/semicolon/semi1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a;\n;\na=1; b")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(";");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","invalid.deprecated.semicolon.python"]);
|
|
expect(tokens[1][0].value).toBe(";");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","invalid.deprecated.semicolon.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("=");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][2].value).toBe("1");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][3].value).toBe("; ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("b");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/annotation1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("some_number: int # variable without initial value\nsome_list: List[int] = [] # variable with initial value")
|
|
expect(tokens[0][0].value).toBe("some_number");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(":");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[0][2].value).toBe(" ");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe("int");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","support.type.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("#");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][6].value).toBe(" variable without initial value");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("some_list");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(":");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe("List");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","meta.item-access.python"]);
|
|
expect(tokens[1][4].value).toBe("[");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("int");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","support.type.python"]);
|
|
expect(tokens[1][6].value).toBe("]");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[1][7].value).toBe(" ");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][8].value).toBe("=");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][9].value).toBe(" ");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][10].value).toBe("[");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","punctuation.definition.list.begin.python"]);
|
|
expect(tokens[1][11].value).toBe("]");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","punctuation.definition.list.end.python"]);
|
|
expect(tokens[1][12].value).toBe(" ");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][13].value).toBe("#");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][14].value).toBe(" variable with initial value");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/statements/for1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("for a, b, c in b:\n pass\nelse:\n 1/0")
|
|
expect(tokens[0][0].value).toBe("for");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("a");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe(",");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("b");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("c");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe("in");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[0][11].value).toBe(" ");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][12].value).toBe("b");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][13].value).toBe(":");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("pass");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][0].value).toBe("else");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][1].value).toBe(":");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("1");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][2].value).toBe("/");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[3][3].value).toBe("0");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/statements/global1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("global a, b, c")
|
|
expect(tokens[0][0].value).toBe("global");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","storage.modifier.declaration.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("a");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe(",");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("b");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("c");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/if1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("if (a if b else c):\n 1\nelif b or c and d:\n 2\nelse:\n 3")
|
|
expect(tokens[0][0].value).toBe("if");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("(");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[0][3].value).toBe("a");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("if");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("b");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("else");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("c");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][12].value).toBe(")");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[0][13].value).toBe(":");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("1");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][0].value).toBe("elif");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("b");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("or");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("c");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][7].value).toBe(" ");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][8].value).toBe("and");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][10].value).toBe("d");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][11].value).toBe(":");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("2");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[4][0].value).toBe("else");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][1].value).toBe(":");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe("3");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/statements/import1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("from ...foo import bar as spam, baz\nimport time as ham, datetime")
|
|
expect(tokens[0][0].value).toBe("from");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("...");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][3].value).toBe("foo");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("import");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("bar");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("as");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("spam");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][12].value).toBe(",");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][13].value).toBe(" ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][14].value).toBe("baz");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("import");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("time");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("as");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("ham");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe(",");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[1][8].value).toBe(" ");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][9].value).toBe("datetime");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/import2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("from .... import a\nfrom ... import b\nfrom .. import c")
|
|
expect(tokens[0][0].value).toBe("from");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("....");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("import");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("a");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("from");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("...");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("import");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("b");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("from");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("..");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("import");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("c");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/import3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("from....import a\nfrom...import b\nfrom..import c\nfrom.import d")
|
|
expect(tokens[0][0].value).toBe("from");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][1].value).toBe("....");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("import");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("a");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("from");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][1].value).toBe("...");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("import");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("b");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("from");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[2][1].value).toBe("..");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][2].value).toBe("import");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("c");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("from");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[3][1].value).toBe(".");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][2].value).toBe("import");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("d");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/import4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("from....foo import a\nfrom...foo import b\nfrom..foo import c\nfrom.foo import d")
|
|
expect(tokens[0][0].value).toBe("from");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][1].value).toBe("....");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("import");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("a");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("from");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][1].value).toBe("...");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("foo");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("import");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("b");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("from");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[2][1].value).toBe("..");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("import");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("c");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("from");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[3][1].value).toBe(".");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][2].value).toBe("foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("import");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[3][5].value).toBe(" ");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][6].value).toBe("d");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/import5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("from.foo import d\nfrom.import a\n\nfoo.import\n\nraise Exception from Foo\n\ndef bar():\n yield from baz")
|
|
expect(tokens[0][0].value).toBe("from");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][1].value).toBe(".");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][2].value).toBe("foo");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("import");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("d");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][0].value).toBe("from");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][1].value).toBe(".");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[1][2].value).toBe("import");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("a");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("foo");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(".");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[3][2].value).toBe("import");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][0].value).toBe("raise");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][2].value).toBe("Exception");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("from");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[5][5].value).toBe(" ");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][6].value).toBe("Foo");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe("");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][0].value).toBe("def");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[7][1].value).toBe(" ");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[7][2].value).toBe("bar");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[7][3].value).toBe("(");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[7][4].value).toBe(")");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[7][5].value).toBe(":");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][1].value).toBe("yield from");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[8][2].value).toBe(" ");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][3].value).toBe("baz");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/import6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("from __future__ import generator_stop")
|
|
expect(tokens[0][0].value).toBe("from");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("__future__");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","support.variable.magic.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("import");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("generator_stop");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/import7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("from .importing import *\nfrom importing import *")
|
|
expect(tokens[0][0].value).toBe("from");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe(".");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][3].value).toBe("importing");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("import");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("*");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[1][0].value).toBe("from");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("importing");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("import");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","keyword.control.import.python"]);
|
|
expect(tokens[1][5].value).toBe(" ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][6].value).toBe("*");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
});
|
|
|
|
it("test/statements/nonlocal1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("nonlocal a, b, c")
|
|
expect(tokens[0][0].value).toBe("nonlocal");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","storage.modifier.declaration.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("a");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe(",");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("b");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe(",");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("c");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
});
|
|
|
|
it("test/statements/try1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("try:\n 1/0\nexcept AbcError as ex:\n pass\nexcept (ZeroDivisionError, GhiError) as ex:\n print(ex)\nelse:\n 1\nfinally:\n 2")
|
|
expect(tokens[0][0].value).toBe("try");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(":");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("1");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][2].value).toBe("/");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[1][3].value).toBe("0");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][0].value).toBe("except");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("AbcError");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("as");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("ex");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][7].value).toBe(":");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe("pass");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][0].value).toBe("except");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("(");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("ZeroDivisionError");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","support.type.exception.python"]);
|
|
expect(tokens[4][4].value).toBe(",");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[4][5].value).toBe(" ");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][6].value).toBe("GhiError");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][7].value).toBe(")");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
expect(tokens[4][8].value).toBe(" ");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][9].value).toBe("as");
|
|
expect(tokens[4][9].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[4][10].value).toBe(" ");
|
|
expect(tokens[4][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][11].value).toBe("ex");
|
|
expect(tokens[4][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][12].value).toBe(":");
|
|
expect(tokens[4][12].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe("print");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[5][2].value).toBe("(");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[5][3].value).toBe("ex");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[5][4].value).toBe(")");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[6][0].value).toBe("else");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[6][1].value).toBe(":");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("1");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[8][0].value).toBe("finally");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[8][1].value).toBe(":");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[9][0].value).toBe(" ");
|
|
expect(tokens[9][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[9][1].value).toBe("2");
|
|
expect(tokens[9][1].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
});
|
|
|
|
it("test/statements/while1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("while 1:\n pass")
|
|
expect(tokens[0][0].value).toBe("while");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("1");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][3].value).toBe(":");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("pass");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/statements/with1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("with a as b, c as d:\n pass")
|
|
expect(tokens[0][0].value).toBe("with");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("a");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("as");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][5].value).toBe(" ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][6].value).toBe("b");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe(",");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("c");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("as");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[0][12].value).toBe(" ");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][13].value).toBe("d");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][14].value).toBe(":");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","punctuation.separator.colon.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("pass");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/strings/bad1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = \"bad \\\\ string\nfoo \\' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\"\ndef foo(a=1): pass")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("\"");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("bad ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("\\\\");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[0][7].value).toBe(" string");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][8].value).toBe("");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[1][0].value).toBe("foo");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("\\");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][3].value).toBe("' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","invalid.illegal.line.continuation.python"]);
|
|
expect(tokens[2][0].value).toBe("def");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[2][2].value).toBe("foo");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[2][3].value).toBe("(");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[2][4].value).toBe("a");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[2][5].value).toBe("=");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[2][6].value).toBe("1");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[2][7].value).toBe(")");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[2][8].value).toBe(":");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][10].value).toBe("pass");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/strings/bad2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = b\"bad \\\\ string\nfoo \\' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\"\n\ndef foo(a=1): pass")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("b");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("bad ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[0][7].value).toBe("\\\\");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.binary.single.python","constant.character.escape.python"]);
|
|
expect(tokens[0][8].value).toBe(" string");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[0][9].value).toBe("");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.binary.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[1][0].value).toBe("foo");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("\\");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][3].value).toBe("' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","invalid.illegal.line.continuation.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("def");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[3][2].value).toBe("foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[3][3].value).toBe("(");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[3][4].value).toBe("a");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[3][5].value).toBe("=");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[3][6].value).toBe("1");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][7].value).toBe(")");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[3][8].value).toBe(":");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][9].value).toBe(" ");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][10].value).toBe("pass");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
|
|
it("test/strings/bad3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = r\"bad string\nfoo \\' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\"\n\ndef foo(a=1): pass # doesn't break!")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("r");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("bad string");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[0][7].value).toBe("");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.illegal.newline.python"]);
|
|
expect(tokens[1][0].value).toBe("foo");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("\\");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][3].value).toBe("' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","invalid.illegal.line.continuation.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][0].value).toBe("def");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[3][2].value).toBe("foo");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[3][3].value).toBe("(");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[3][4].value).toBe("a");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[3][5].value).toBe("=");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[3][6].value).toBe("1");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][7].value).toBe(")");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[3][8].value).toBe(":");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[3][9].value).toBe(" ");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][10].value).toBe("pass");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[3][11].value).toBe(" ");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][12].value).toBe("#");
|
|
expect(tokens[3][12].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[3][13].value).toBe(" doesn't break!");
|
|
expect(tokens[3][13].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/strings/bug1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# issue 150\nrecord = {\n \"a\": {k: str(v) for k, v in foo if \"\"}\n}")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" issue 150");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("record");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("{");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("\"");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("a");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][3].value).toBe("\"");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][4].value).toBe(":");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("{");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[2][7].value).toBe("k");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][8].value).toBe(":");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][10].value).toBe("str");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","meta.function-call.python","support.type.python"]);
|
|
expect(tokens[2][11].value).toBe("(");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[2][12].value).toBe("v");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python"]);
|
|
expect(tokens[2][13].value).toBe(")");
|
|
expect(tokens[2][13].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[2][14].value).toBe(" ");
|
|
expect(tokens[2][14].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][15].value).toBe("for");
|
|
expect(tokens[2][15].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][16].value).toBe(" ");
|
|
expect(tokens[2][16].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][17].value).toBe("k");
|
|
expect(tokens[2][17].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][18].value).toBe(",");
|
|
expect(tokens[2][18].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[2][19].value).toBe(" ");
|
|
expect(tokens[2][19].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][20].value).toBe("v");
|
|
expect(tokens[2][20].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][21].value).toBe(" ");
|
|
expect(tokens[2][21].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][22].value).toBe("in");
|
|
expect(tokens[2][22].scopes).toEqual(["source.python","keyword.operator.logical.python"]);
|
|
expect(tokens[2][23].value).toBe(" ");
|
|
expect(tokens[2][23].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][24].value).toBe("foo");
|
|
expect(tokens[2][24].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][25].value).toBe(" ");
|
|
expect(tokens[2][25].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][26].value).toBe("if");
|
|
expect(tokens[2][26].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[2][27].value).toBe(" ");
|
|
expect(tokens[2][27].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][28].value).toBe("\"");
|
|
expect(tokens[2][28].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][29].value).toBe("\"");
|
|
expect(tokens[2][29].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][30].value).toBe("}");
|
|
expect(tokens[2][30].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]);
|
|
expect(tokens[3][0].value).toBe("}");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]);
|
|
});
|
|
|
|
it("test/strings/bug2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# issue 150\ncmd = \"git-clang-format --style=\\\"{{BasedOnStyle: Google, ColumnLimit: 100, IndentWidth: 2, \" \\\n \"AlignConsecutiveAssignments: true}}\\\" {COMMIT_SHA} -- ./**/*.proto > {OUTPUT}\".format(")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" issue 150");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("cmd");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("\"");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("git-clang-format --style=");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][6].value).toBe("\\\"");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][7].value).toBe("{{");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][8].value).toBe("BasedOnStyle: Google, ColumnLimit: 100, IndentWidth: 2, ");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][9].value).toBe("\"");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][10].value).toBe(" ");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][11].value).toBe("\\");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","punctuation.separator.continuation.line.python"]);
|
|
expect(tokens[1][12].value).toBe("");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("\"");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("AlignConsecutiveAssignments: true");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][3].value).toBe("}}");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][4].value).toBe("\\\"");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][6].value).toBe("{COMMIT_SHA}");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][7].value).toBe(" -- ./**/*.proto > ");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][8].value).toBe("{OUTPUT}");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][9].value).toBe("\"");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][10].value).toBe(".");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[2][11].value).toBe("format");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[2][12].value).toBe("(");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
});
|
|
|
|
it("test/strings/bytes1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = b\"\"\"\nmultiline \"binary\" string \\\n\n \\xf1 \\u1234aaaa \\U1234aaaa\n\n \\N{BLACK SPADE SUIT}\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("b");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("\"\"\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe("multiline \"binary\" string ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("\\");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","constant.language.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("\\xf1");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][2].value).toBe(" \\u1234aaaa \\U1234aaaa");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[5][0].value).toBe(" \\N{BLACK SPADE SUIT}");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[6][0].value).toBe("\"\"\"");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/bytes2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a[1] = b'''\nmultiline 'binary' string \\\n\n \\xf1 \\u1234aaaa \\U1234aaaa\n\n \\N{BLACK SPADE SUIT}\n'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.item-access.python"]);
|
|
expect(tokens[0][1].value).toBe("[");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][2].value).toBe("1");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.item-access.python","meta.item-access.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][3].value).toBe("]");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.item-access.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[0][4].value).toBe(" ");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][5].value).toBe("=");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][6].value).toBe(" ");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][7].value).toBe("b");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.binary.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][8].value).toBe("'''");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe("multiline 'binary' string ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("\\");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","constant.language.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("\\xf1");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.binary.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][2].value).toBe(" \\u1234aaaa \\U1234aaaa");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[5][0].value).toBe(" \\N{BLACK SPADE SUIT}");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python"]);
|
|
expect(tokens[6][0].value).toBe("'''");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.binary.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/escaping1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = \"simple \\\\ string \\\nfoo \\' \\\" \\a \\b \\c \\f \\n \\r \\t \\v \\5 \\55 \\555 \\05 \\005\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("\"");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("simple ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("\\\\");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[0][7].value).toBe(" string ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][8].value).toBe("\\");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","constant.language.python"]);
|
|
expect(tokens[1][0].value).toBe("foo ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][1].value).toBe("\\'");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][2].value).toBe(" ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][3].value).toBe("\\\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][5].value).toBe("\\a");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][7].value).toBe("\\b");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][8].value).toBe(" \\c ");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][9].value).toBe("\\f");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][10].value).toBe(" ");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][11].value).toBe("\\n");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][12].value).toBe(" ");
|
|
expect(tokens[1][12].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][13].value).toBe("\\r");
|
|
expect(tokens[1][13].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][14].value).toBe(" ");
|
|
expect(tokens[1][14].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][15].value).toBe("\\t");
|
|
expect(tokens[1][15].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][16].value).toBe(" ");
|
|
expect(tokens[1][16].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][17].value).toBe("\\v");
|
|
expect(tokens[1][17].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][18].value).toBe(" ");
|
|
expect(tokens[1][18].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][19].value).toBe("\\5");
|
|
expect(tokens[1][19].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][20].value).toBe(" ");
|
|
expect(tokens[1][20].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][21].value).toBe("\\55");
|
|
expect(tokens[1][21].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][22].value).toBe(" ");
|
|
expect(tokens[1][22].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][23].value).toBe("\\555");
|
|
expect(tokens[1][23].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][24].value).toBe(" ");
|
|
expect(tokens[1][24].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][25].value).toBe("\\05");
|
|
expect(tokens[1][25].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][26].value).toBe(" ");
|
|
expect(tokens[1][26].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][27].value).toBe("\\005");
|
|
expect(tokens[1][27].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][28].value).toBe("\"");
|
|
expect(tokens[1][28].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/escaping2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("replace = {'\"' : R'\\\"',\n \"'\" : R'\\'',\n '\\\\': R'\\\\'}")
|
|
expect(tokens[0][0].value).toBe("replace");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("{");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","punctuation.definition.dict.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("\"");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe(":");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("R");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][12].value).toBe("'");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][13].value).toBe("\\\"");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[0][14].value).toBe("'");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][15].value).toBe(",");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("\"");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("'");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][3].value).toBe("\"");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][4].value).toBe(" ");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][5].value).toBe(":");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[1][6].value).toBe(" ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][7].value).toBe("R");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][8].value).toBe("'");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][9].value).toBe("\\'");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[1][10].value).toBe("'");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][11].value).toBe(",");
|
|
expect(tokens[1][11].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe("'");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][2].value).toBe("\\\\");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.single.python","constant.character.escape.python"]);
|
|
expect(tokens[2][3].value).toBe("'");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][4].value).toBe(":");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","punctuation.separator.dict.python"]);
|
|
expect(tokens[2][5].value).toBe(" ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][6].value).toBe("R");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][7].value).toBe("'");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][8].value).toBe("\\\\");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[2][9].value).toBe("'");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][10].value).toBe("}");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","punctuation.definition.dict.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = \"{0[ ]:X>+10d}\"\na = \"{0[ ]!s:X>+10d}\"\na = \"{0[ ]:Xd>+10d}\" #invalid")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("\"");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("{0[ ]");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][6].value).toBe(":X>+10d");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[0][7].value).toBe("}");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][8].value).toBe("\"");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("\"");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("{0[ ]");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][6].value).toBe("!s");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[1][7].value).toBe(":X>+10d");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[1][8].value).toBe("}");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][9].value).toBe("\"");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("\"");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("{0[ ]");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][6].value).toBe(":");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[2][7].value).toBe("Xd>+10d}");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][8].value).toBe("\"");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][10].value).toBe("#");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][11].value).toBe("invalid");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
});
|
|
|
|
it("test/strings/format10.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = '''blah {foo-bar %d\n blah {foo-bar %d}\n blah {foo-bar %d //insane {}}\n {}blah {foo-bar %d //insane {}}'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'''");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("blah {foo-bar ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[0][6].value).toBe("%d");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][0].value).toBe(" blah ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("{foo-bar ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[1][2].value).toBe("%d");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][3].value).toBe("}");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" blah {foo-bar ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[2][1].value).toBe("%d");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][2].value).toBe(" //insane {}}");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" {}blah {foo-bar ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("%d");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][2].value).toBe(" //insane {}}");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[3][3].value).toBe("'''");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format11.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = R'''\\fr{still_ok}ac{m_{j \\rightarrow i}(\\mathrm{good})}\n {not_ok} %d\n'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("R");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'''");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("\\fr");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[0][7].value).toBe("{still_ok}");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.raw.multi.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][8].value).toBe("ac");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[0][9].value).toBe("{m_{j \\rightarrow i}(\\mathrm{good})}");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[1][0].value).toBe(" {not_ok} ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("%d");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.raw.multi.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][0].value).toBe("'''");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format12.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = R'$\\frac{m_{j \\%srightarrow i}(\\mathrm{%sgood})}{\\su%m{m_{j \\rightarrow i}}}$'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("R");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("$\\frac");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[0][7].value).toBe("{m_{j \\");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[0][8].value).toBe("%s");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.raw.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][9].value).toBe("rightarrow i}(\\mathrm{");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[0][10].value).toBe("%s");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.raw.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][11].value).toBe("good})}{\\su%m{m_{j \\rightarrow i}}}$");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[0][12].value).toBe("'");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format13.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = '''\\n\n{% for item in seq %}\n \\n {{ item }} \\n \\N{BLACK SPADE SUIT}\n{% endfor %}\n'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'''");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("\\n");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[1][0].value).toBe("{% for item in seq %}");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[2][1].value).toBe("\\n");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[2][2].value).toBe(" {{ item }} ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[2][3].value).toBe("\\n");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[2][4].value).toBe(" ");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[2][5].value).toBe("\\N{BLACK SPADE SUIT}");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][0].value).toBe("{% endfor %}");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("'''");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format14.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = R'''\\n\n{% for item in seq %}\n \\n {{ item }} \\n \\N{BLACK SPADE SUIT}\n{% endfor %}\n'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("R");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'''");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("\\n");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[1][0].value).toBe("{% for item in seq %}");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[2][0].value).toBe(" \\n {{ item }} \\n \\N{BLACK SPADE SUIT}");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[3][0].value).toBe("{% endfor %}");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("'''");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format15.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = '''\n{{ before detection }}\n{# jinja comment #}\n{{ after detection }}\n'''")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'''");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe("{{");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][1].value).toBe(" before detection ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[1][2].value).toBe("}}");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.multi.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][0].value).toBe("{# jinja comment #}");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[3][0].value).toBe("{{ after detection }}");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("'''");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format16.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = b'%b' % b'foo'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("b");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("%b");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.binary.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][8].value).toBe(" ");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][9].value).toBe("%");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][10].value).toBe(" ");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][11].value).toBe("b");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][12].value).toBe("'");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][13].value).toBe("foo");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[0][14].value).toBe("'");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = \"normal {{ normal }} normal {10!r} normal {fo.__add__!s}\".format(fo=1)")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("\"");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("normal ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("{{");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe(" normal ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][8].value).toBe("}}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][9].value).toBe(" normal ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][10].value).toBe("{10");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][11].value).toBe("!r");
|
|
expect(tokens[0][11].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[0][12].value).toBe("}");
|
|
expect(tokens[0][12].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][13].value).toBe(" normal ");
|
|
expect(tokens[0][13].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][14].value).toBe("{fo.__add__");
|
|
expect(tokens[0][14].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][15].value).toBe("!s");
|
|
expect(tokens[0][15].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[0][16].value).toBe("}");
|
|
expect(tokens[0][16].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][17].value).toBe("\"");
|
|
expect(tokens[0][17].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][18].value).toBe(".");
|
|
expect(tokens[0][18].scopes).toEqual(["source.python","punctuation.separator.period.python"]);
|
|
expect(tokens[0][19].value).toBe("format");
|
|
expect(tokens[0][19].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.generic.python"]);
|
|
expect(tokens[0][20].value).toBe("(");
|
|
expect(tokens[0][20].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[0][21].value).toBe("fo");
|
|
expect(tokens[0][21].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","variable.parameter.function-call.python"]);
|
|
expect(tokens[0][22].value).toBe("=");
|
|
expect(tokens[0][22].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][23].value).toBe("1");
|
|
expect(tokens[0][23].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","constant.numeric.dec.python"]);
|
|
expect(tokens[0][24].value).toBe(")");
|
|
expect(tokens[0][24].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = '%i' % 42\na = \"%(language)s has %(number)03d quote types.\"\na = b\"%(language)s has %(number)03d quote types.\"\na = R\"%(language)s has %(number)03d quote types.\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("%i");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][6].value).toBe("'");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[0][7].value).toBe(" ");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][8].value).toBe("%");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[0][9].value).toBe(" ");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][10].value).toBe("42");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("\"");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("%(language)s");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][6].value).toBe(" has ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][7].value).toBe("%(number)03d");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][8].value).toBe(" quote types.");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][9].value).toBe("\"");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("b");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][5].value).toBe("\"");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("%(language)s");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.binary.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][7].value).toBe(" has ");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[2][8].value).toBe("%(number)03d");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.binary.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][9].value).toBe(" quote types.");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[2][10].value).toBe("\"");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("R");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[3][5].value).toBe("\"");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][6].value).toBe("%(language)s");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.raw.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][7].value).toBe(" has ");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[3][8].value).toBe("%(number)03d");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.raw.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][9].value).toBe(" quote types.");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[3][10].value).toBe("\"");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format4.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = 'qqq{:%Y-%m-%d %H:%M:%S}www'\na = 'qqq{0:{fill}{align}16}www'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("qqq");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("{");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe(":");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[0][8].value).toBe("%Y-%m-%d %H:%M:%S}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][9].value).toBe("www");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][10].value).toBe("'");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("'");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("qqq");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][6].value).toBe("{0");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][7].value).toBe(":");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[1][8].value).toBe("{fill}{align}16}");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][9].value).toBe("www");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][10].value).toBe("'");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format5.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = 'qqq{0:{width}{base}}www'\na = 'qqq{0:$20}www'\na = 'qqq{0}www'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("qqq");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("{0");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe(":");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[0][8].value).toBe("{width}{base}}");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][9].value).toBe("www");
|
|
expect(tokens[0][9].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][10].value).toBe("'");
|
|
expect(tokens[0][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("'");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("qqq");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][6].value).toBe("{0");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][7].value).toBe(":");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python","storage.type.format.python"]);
|
|
expect(tokens[1][8].value).toBe("$20}");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][9].value).toBe("www");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][10].value).toBe("'");
|
|
expect(tokens[1][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("'");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("qqq");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][6].value).toBe("{0}");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][7].value).toBe("www");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][8].value).toBe("'");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format6.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = 'qqqwww'\na = ' { '\na = 'qqq{0:{widt' + 'h}{base}}www'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("qqqwww");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("'");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("'");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][5].value).toBe(" { ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][6].value).toBe("'");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("'");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("qqq{0:{widt");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][6].value).toBe("'");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][7].value).toBe(" ");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][8].value).toBe("+");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[2][9].value).toBe(" ");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][10].value).toBe("'");
|
|
expect(tokens[2][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][11].value).toBe("h}");
|
|
expect(tokens[2][11].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][12].value).toBe("{base}");
|
|
expect(tokens[2][12].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][13].value).toBe("}www");
|
|
expect(tokens[2][13].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][14].value).toBe("'");
|
|
expect(tokens[2][14].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format7.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("# XXX we have to highlight '% o' here, as it is a valid python\n# format spec. Otherwise, it would be hard to spot an error in\n# the code below.\na = '12% of %s' % ('name',)")
|
|
expect(tokens[0][0].value).toBe("#");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[0][2].value).toBe("XXX");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","comment.line.number-sign.python","keyword.codetag.notation.python"]);
|
|
expect(tokens[0][3].value).toBe(" we have to highlight '% o' here, as it is a valid python");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[1][0].value).toBe("#");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[1][1].value).toBe(" format spec. Otherwise, it would be hard to spot an error in");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[2][0].value).toBe("#");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","comment.line.number-sign.python","punctuation.definition.comment.python"]);
|
|
expect(tokens[2][1].value).toBe(" the code below.");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","comment.line.number-sign.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("'");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][5].value).toBe("12");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[3][6].value).toBe("% o");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][7].value).toBe("f ");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[3][8].value).toBe("%s");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][9].value).toBe("'");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][10].value).toBe(" ");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][11].value).toBe("%");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","keyword.operator.arithmetic.python"]);
|
|
expect(tokens[3][12].value).toBe(" ");
|
|
expect(tokens[3][12].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][13].value).toBe("(");
|
|
expect(tokens[3][13].scopes).toEqual(["source.python","punctuation.parenthesis.begin.python"]);
|
|
expect(tokens[3][14].value).toBe("'");
|
|
expect(tokens[3][14].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][15].value).toBe("name");
|
|
expect(tokens[3][15].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[3][16].value).toBe("'");
|
|
expect(tokens[3][16].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][17].value).toBe(",");
|
|
expect(tokens[3][17].scopes).toEqual(["source.python","punctuation.separator.element.python"]);
|
|
expect(tokens[3][18].value).toBe(")");
|
|
expect(tokens[3][18].scopes).toEqual(["source.python","punctuation.parenthesis.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format8.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = R'$\\frac{m_{j \\rightarrow i}(\\mathrm{good})}{\\sum{m_{j \\rightarrow i}}}$'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("R");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("$\\frac");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[0][7].value).toBe("{m_{j \\rightarrow i}(\\mathrm{good})}{\\sum{m_{j \\rightarrow i}}}$");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[0][8].value).toBe("'");
|
|
expect(tokens[0][8].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/format9.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = 'blah {foo-bar %d'\na = 'blah {foo-bar %d}'\na = 'blah {foo-bar %d //insane {}}'\na = '{}blah {foo-bar %d //insane {}}'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("blah {foo-bar ");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("%d");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("'");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][5].value).toBe("blah ");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][6].value).toBe("{foo-bar ");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][7].value).toBe("%d");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[1][8].value).toBe("}");
|
|
expect(tokens[1][8].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][9].value).toBe("'");
|
|
expect(tokens[1][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("'");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][5].value).toBe("blah ");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][6].value).toBe("{foo-bar ");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][7].value).toBe("%d");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[2][8].value).toBe(" //insane {}}");
|
|
expect(tokens[2][8].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][9].value).toBe("'");
|
|
expect(tokens[2][9].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("'");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][5].value).toBe("{}");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.brace.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][6].value).toBe("blah ");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[3][7].value).toBe("{foo-bar ");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[3][8].value).toBe("%d");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.single.python","meta.format.percent.python","constant.character.format.placeholder.other.python"]);
|
|
expect(tokens[3][9].value).toBe(" //insane {}}");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[3][10].value).toBe("'");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/note1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = 'XXX FIXME NB TODO'\na = r'XXX FIXME NB TODO'\na = b'XXX FIXME NB TODO'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("XXX FIXME NB TODO");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("'");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("r");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("XXX FIXME NB TODO");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[1][7].value).toBe("'");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("b");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("XXX FIXME NB TODO");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[2][7].value).toBe("'");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/prefixes1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = 's t r'\na = u's t r'\na = b's t r'\na = r's t r'\na = br's t r'\na = rb's t r'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("'");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][5].value).toBe("s t r");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][6].value).toBe("'");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("u");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("s t r");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[1][7].value).toBe("'");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("b");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("s t r");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[2][7].value).toBe("'");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("r");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[3][5].value).toBe("'");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][6].value).toBe("s t r");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[3][7].value).toBe("'");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("br");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][5].value).toBe("'");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][6].value).toBe("s t r");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[4][7].value).toBe("'");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("a");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][2].value).toBe("=");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("rb");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[5][5].value).toBe("'");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][6].value).toBe("s t r");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[5][7].value).toBe("'");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/prefixes2.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = U'S T R'\na = B'S T R'\na = R'S T R'\na = BR'S T R'\na = RB'S T R'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("U");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("S T R");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("B");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("S T R");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.binary.single.python"]);
|
|
expect(tokens[1][7].value).toBe("'");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("R");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python","string.quoted.raw.single.python","storage.type.string.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("S T R");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[2][7].value).toBe("'");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("BR");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[3][5].value).toBe("'");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][6].value).toBe("S T R");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python"]);
|
|
expect(tokens[3][7].value).toBe("'");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("RB");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][5].value).toBe("'");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][6].value).toBe("S T R");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python"]);
|
|
expect(tokens[4][7].value).toBe("'");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/prefixes3.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = Ur'S T R'\na = UR'S T R'\na = uB'S T R'\na = Ru'S T R'\na = RU'S T R'\na = bR'S T R'\na = Rb'S T R'")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("Ur");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","invalid.deprecated.prefix.python"]);
|
|
expect(tokens[0][5].value).toBe("'");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[0][6].value).toBe("S T R");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]);
|
|
expect(tokens[0][7].value).toBe("'");
|
|
expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[1][0].value).toBe("a");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe(" ");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][2].value).toBe("=");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[1][3].value).toBe(" ");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][4].value).toBe("UR");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.raw.single.python","invalid.deprecated.prefix.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][6].value).toBe("S T R");
|
|
expect(tokens[1][6].scopes).toEqual(["source.python","string.quoted.raw.single.python"]);
|
|
expect(tokens[1][7].value).toBe("'");
|
|
expect(tokens[1][7].scopes).toEqual(["source.python","string.quoted.raw.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe("a");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][1].value).toBe(" ");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][2].value).toBe("=");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[2][3].value).toBe(" ");
|
|
expect(tokens[2][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][4].value).toBe("uB");
|
|
expect(tokens[2][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[2][5].value).toBe("'");
|
|
expect(tokens[2][5].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[2][6].value).toBe("S T R");
|
|
expect(tokens[2][6].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[2][7].value).toBe("'");
|
|
expect(tokens[2][7].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[3][0].value).toBe("a");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][1].value).toBe(" ");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][2].value).toBe("=");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[3][3].value).toBe(" ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[3][4].value).toBe("R");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.single.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[3][5].value).toBe("u");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[3][6].value).toBe("'");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[3][7].value).toBe("S T R");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[3][8].value).toBe("'");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][0].value).toBe("a");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe(" ");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][2].value).toBe("=");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[4][3].value).toBe(" ");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][4].value).toBe("R");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","string.quoted.single.python","invalid.illegal.prefix.python"]);
|
|
expect(tokens[4][5].value).toBe("U");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","string.quoted.single.python","storage.type.string.python"]);
|
|
expect(tokens[4][6].value).toBe("'");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][7].value).toBe("S T R");
|
|
expect(tokens[4][7].scopes).toEqual(["source.python","string.quoted.single.python"]);
|
|
expect(tokens[4][8].value).toBe("'");
|
|
expect(tokens[4][8].scopes).toEqual(["source.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[5][0].value).toBe("a");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe(" ");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][2].value).toBe("=");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[5][3].value).toBe(" ");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][4].value).toBe("bR");
|
|
expect(tokens[5][4].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[5][5].value).toBe("'");
|
|
expect(tokens[5][5].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[5][6].value).toBe("S T R");
|
|
expect(tokens[5][6].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python"]);
|
|
expect(tokens[5][7].value).toBe("'");
|
|
expect(tokens[5][7].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[6][0].value).toBe("a");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe(" ");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][2].value).toBe("=");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[6][3].value).toBe(" ");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][4].value).toBe("Rb");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","storage.type.string.python"]);
|
|
expect(tokens[6][5].value).toBe("'");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[6][6].value).toBe("S T R");
|
|
expect(tokens[6][6].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python"]);
|
|
expect(tokens[6][7].value).toBe("'");
|
|
expect(tokens[6][7].scopes).toEqual(["source.python","string.quoted.raw.binary.single.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/raw1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = R\"\"\"\nmultiline \"raw\" string \\\n\n \\xf1 \\u1234aaaa \\U1234aaaa\n\n \\N{BLACK SPADE SUIT}\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("R");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.raw.multi.python","storage.type.string.python"]);
|
|
expect(tokens[0][5].value).toBe("\"\"\"");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe("multiline \"raw\" string ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("\\");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" \\xf1 \\u1234aaaa \\U1234aaaa");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[5][0].value).toBe(" \\N");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("{BLACK SPADE SUIT}");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.raw.multi.python"]);
|
|
expect(tokens[6][0].value).toBe("\"\"\"");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.raw.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/strings/unicode1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("a = \"\"\"\nmultiline \"unicode\" string \\\n\n \\xf1 \\u1234aaaa \\U1234aaaa\n\n \\N{BLACK SPADE SUIT}\n\"\"\"")
|
|
expect(tokens[0][0].value).toBe("a");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][2].value).toBe("=");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[0][3].value).toBe(" ");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[0][4].value).toBe("\"\"\"");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][0].value).toBe("multiline \"unicode\" string ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[1][1].value).toBe("\\");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.multi.python","constant.language.python"]);
|
|
expect(tokens[2][0].value).toBe("");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[3][1].value).toBe("\\xf1");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[3][3].value).toBe("\\u1234");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[3][4].value).toBe("aaaa ");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[3][5].value).toBe("\\U1234aaaa");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[4][0].value).toBe("");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python","string.quoted.multi.python"]);
|
|
expect(tokens[5][1].value).toBe("\\N{BLACK SPADE SUIT}");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","string.quoted.multi.python","constant.character.escape.python"]);
|
|
expect(tokens[6][0].value).toBe("\"\"\"");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python","string.quoted.multi.python","punctuation.definition.string.end.python"]);
|
|
});
|
|
|
|
it("test/unicode/unicode1.py",
|
|
function() {
|
|
tokens = grammar.tokenizeLines("class Üa(Êa):\n 'Œ\\nŃ'\n @æaœ\n def ŌÏŒĘ(self, Ú=1):\n print('превед 你好')\n return Ù\n ÜBER = 1\n 你好 = lambda: 你好\n def 你好(): pass")
|
|
expect(tokens[0][0].value).toBe("class");
|
|
expect(tokens[0][0].scopes).toEqual(["source.python","meta.class.python","storage.type.class.python"]);
|
|
expect(tokens[0][1].value).toBe(" ");
|
|
expect(tokens[0][1].scopes).toEqual(["source.python","meta.class.python"]);
|
|
expect(tokens[0][2].value).toBe("Üa");
|
|
expect(tokens[0][2].scopes).toEqual(["source.python","meta.class.python","entity.name.type.class.python"]);
|
|
expect(tokens[0][3].value).toBe("(");
|
|
expect(tokens[0][3].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.begin.python"]);
|
|
expect(tokens[0][4].value).toBe("Êa");
|
|
expect(tokens[0][4].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","entity.other.inherited-class.python"]);
|
|
expect(tokens[0][5].value).toBe(")");
|
|
expect(tokens[0][5].scopes).toEqual(["source.python","meta.class.python","meta.class.inheritance.python","punctuation.definition.inheritance.end.python"]);
|
|
expect(tokens[0][6].value).toBe(":");
|
|
expect(tokens[0][6].scopes).toEqual(["source.python","meta.class.python","punctuation.section.class.begin.python"]);
|
|
expect(tokens[1][0].value).toBe(" ");
|
|
expect(tokens[1][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[1][1].value).toBe("'");
|
|
expect(tokens[1][1].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[1][2].value).toBe("Œ");
|
|
expect(tokens[1][2].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[1][3].value).toBe("\\n");
|
|
expect(tokens[1][3].scopes).toEqual(["source.python","string.quoted.docstring.single.python","constant.character.escape.python"]);
|
|
expect(tokens[1][4].value).toBe("Ń");
|
|
expect(tokens[1][4].scopes).toEqual(["source.python","string.quoted.docstring.single.python"]);
|
|
expect(tokens[1][5].value).toBe("'");
|
|
expect(tokens[1][5].scopes).toEqual(["source.python","string.quoted.docstring.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[2][0].value).toBe(" ");
|
|
expect(tokens[2][0].scopes).toEqual(["source.python","meta.function.decorator.python"]);
|
|
expect(tokens[2][1].value).toBe("@");
|
|
expect(tokens[2][1].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python","punctuation.definition.decorator.python"]);
|
|
expect(tokens[2][2].value).toBe("æaœ");
|
|
expect(tokens[2][2].scopes).toEqual(["source.python","meta.function.decorator.python","entity.name.function.decorator.python"]);
|
|
expect(tokens[3][0].value).toBe(" ");
|
|
expect(tokens[3][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[3][1].value).toBe("def");
|
|
expect(tokens[3][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[3][2].value).toBe(" ");
|
|
expect(tokens[3][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[3][3].value).toBe("ŌÏŒĘ");
|
|
expect(tokens[3][3].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[3][4].value).toBe("(");
|
|
expect(tokens[3][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[3][5].value).toBe("self");
|
|
expect(tokens[3][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python","variable.parameter.function.language.special.self.python"]);
|
|
expect(tokens[3][6].value).toBe(",");
|
|
expect(tokens[3][6].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.separator.parameters.python"]);
|
|
expect(tokens[3][7].value).toBe(" ");
|
|
expect(tokens[3][7].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python"]);
|
|
expect(tokens[3][8].value).toBe("Ú");
|
|
expect(tokens[3][8].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","variable.parameter.function.language.python"]);
|
|
expect(tokens[3][9].value).toBe("=");
|
|
expect(tokens[3][9].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","keyword.operator.python"]);
|
|
expect(tokens[3][10].value).toBe("1");
|
|
expect(tokens[3][10].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","constant.numeric.dec.python"]);
|
|
expect(tokens[3][11].value).toBe(")");
|
|
expect(tokens[3][11].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[3][12].value).toBe(":");
|
|
expect(tokens[3][12].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[4][0].value).toBe(" ");
|
|
expect(tokens[4][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[4][1].value).toBe("print");
|
|
expect(tokens[4][1].scopes).toEqual(["source.python","meta.function-call.python","support.function.builtin.python"]);
|
|
expect(tokens[4][2].value).toBe("(");
|
|
expect(tokens[4][2].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.begin.python"]);
|
|
expect(tokens[4][3].value).toBe("'");
|
|
expect(tokens[4][3].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.begin.python"]);
|
|
expect(tokens[4][4].value).toBe("превед 你好");
|
|
expect(tokens[4][4].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python"]);
|
|
expect(tokens[4][5].value).toBe("'");
|
|
expect(tokens[4][5].scopes).toEqual(["source.python","meta.function-call.python","meta.function-call.arguments.python","string.quoted.single.python","punctuation.definition.string.end.python"]);
|
|
expect(tokens[4][6].value).toBe(")");
|
|
expect(tokens[4][6].scopes).toEqual(["source.python","meta.function-call.python","punctuation.definition.arguments.end.python"]);
|
|
expect(tokens[5][0].value).toBe(" ");
|
|
expect(tokens[5][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][1].value).toBe("return");
|
|
expect(tokens[5][1].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
expect(tokens[5][2].value).toBe(" ");
|
|
expect(tokens[5][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[5][3].value).toBe("Ù");
|
|
expect(tokens[5][3].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][0].value).toBe(" ");
|
|
expect(tokens[6][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][1].value).toBe("ÜBER");
|
|
expect(tokens[6][1].scopes).toEqual(["source.python","constant.other.caps.python"]);
|
|
expect(tokens[6][2].value).toBe(" ");
|
|
expect(tokens[6][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][3].value).toBe("=");
|
|
expect(tokens[6][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[6][4].value).toBe(" ");
|
|
expect(tokens[6][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[6][5].value).toBe("1");
|
|
expect(tokens[6][5].scopes).toEqual(["source.python","constant.numeric.dec.python"]);
|
|
expect(tokens[7][0].value).toBe(" ");
|
|
expect(tokens[7][0].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][1].value).toBe("你好");
|
|
expect(tokens[7][1].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][2].value).toBe(" ");
|
|
expect(tokens[7][2].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][3].value).toBe("=");
|
|
expect(tokens[7][3].scopes).toEqual(["source.python","keyword.operator.assignment.python"]);
|
|
expect(tokens[7][4].value).toBe(" ");
|
|
expect(tokens[7][4].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][5].value).toBe("lambda");
|
|
expect(tokens[7][5].scopes).toEqual(["source.python","meta.lambda-function.python","storage.type.function.lambda.python"]);
|
|
expect(tokens[7][6].value).toBe(":");
|
|
expect(tokens[7][6].scopes).toEqual(["source.python","meta.lambda-function.python","punctuation.section.function.lambda.begin.python"]);
|
|
expect(tokens[7][7].value).toBe(" ");
|
|
expect(tokens[7][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[7][8].value).toBe("你好");
|
|
expect(tokens[7][8].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][0].value).toBe(" ");
|
|
expect(tokens[8][0].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[8][1].value).toBe("def");
|
|
expect(tokens[8][1].scopes).toEqual(["source.python","meta.function.python","storage.type.function.python"]);
|
|
expect(tokens[8][2].value).toBe(" ");
|
|
expect(tokens[8][2].scopes).toEqual(["source.python","meta.function.python"]);
|
|
expect(tokens[8][3].value).toBe("你好");
|
|
expect(tokens[8][3].scopes).toEqual(["source.python","meta.function.python","entity.name.function.python"]);
|
|
expect(tokens[8][4].value).toBe("(");
|
|
expect(tokens[8][4].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.begin.python"]);
|
|
expect(tokens[8][5].value).toBe(")");
|
|
expect(tokens[8][5].scopes).toEqual(["source.python","meta.function.python","meta.function.parameters.python","punctuation.definition.parameters.end.python"]);
|
|
expect(tokens[8][6].value).toBe(":");
|
|
expect(tokens[8][6].scopes).toEqual(["source.python","meta.function.python","punctuation.section.function.begin.python"]);
|
|
expect(tokens[8][7].value).toBe(" ");
|
|
expect(tokens[8][7].scopes).toEqual(["source.python"]);
|
|
expect(tokens[8][8].value).toBe("pass");
|
|
expect(tokens[8][8].scopes).toEqual(["source.python","keyword.control.flow.python"]);
|
|
});
|
|
});
|
|
|