diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 6475ab1..62ba2d9 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -10,33 +10,114 @@ name: Upload Python Package on: release: - types: [published] + types: [created] workflow_dispatch: permissions: contents: read jobs: - deploy: + deploy-wheels: + name: Deploy wheels on ${{ matrix.os }} for ${{ matrix.arch }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: [36, 37, 38, 39, 310] + manylinux-image: [manylinux2010, manylinux2014, manylinux_2_24] + arch: [auto] + include: + - os: ubuntu-latest + manylinux-image: manylinux2014 + arch: aarch64 + python-version: 36 + - os: ubuntu-latest + manylinux-image: manylinux2014 + arch: aarch64 + python-version: 37 + - os: ubuntu-latest + manylinux-image: manylinux2014 + arch: aarch64 + python-version: 38 + - os: ubuntu-latest + manylinux-image: manylinux2014 + arch: aarch64 + python-version: 39 + - os: ubuntu-latest + manylinux-image: manylinux2014 + arch: aarch64 + python-version: 310 + exclude: + # manyliunx image is not a valid variation on MacOS and Windows + - os: macos-latest + manylinux-image: manylinux2010 + - os: windows-latest + manylinux-image: manylinux2010 + - os: macos-latest + manylinux-image: manylinux2014 + - os: windows-latest + manylinux-image: manylinux2014 - runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up QEMU + if: ${{ matrix.arch == 'aarch64' }} + uses: docker/setup-qemu-action@v1 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install twine flake8 setuptools wheel + - name: Install cibuildwheel + run: python -m pip install cibuildwheel -U + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + env: + CIBW_BUILD: 'cp${{ matrix.python-version }}-*' + CIBW_SKIP: '*musllinux*' + CIBW_ARCHS: ${{matrix.arch}} + CIBW_MANYLINUX_*_IMAGE: ${{ matrix.manylinux-image }} + CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux-image }} + + - name: Publish wheels to PyPI Unix + if: matrix.os != 'windows-latest' + continue-on-error: true + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + twine upload wheelhouse/*.whl + - name: Publish wheels to PyPI Windows + if: matrix.os == 'windows-latest' + continue-on-error: true + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + twine upload (Get-ChildItem wheelhouse/*.whl) + deploy-tar: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.6' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools --upgrade - pip install wheel - - name: Build package - run: | - python setup.py sdist - - name: Publish package - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install twine flake8 setuptools wheel + - name: Build source tar + run: | + python setup.py sdist + - name: Publish wheels to PyPI + continue-on-error: true + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + twine upload dist/*tar* diff --git a/README.md b/README.md index 574b3be..4b07ad3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Simple python module for KoiLang parsing. [![License](https://img.shields.io/github/license/Ovizro/Kola.svg)](LICENSE) [![PyPI](https://img.shields.io/pypi/v/KoiLang.svg)](https://pypi.python.org/pypi/KoiLang) -![Python Version](https://img.shields.io/badge/python-3.6|3.7|3.8|3.9|3.10-blue.svg) +![Python Version](https://img.shields.io/badge/python-3.6%20|%203.7%20|%203.8%20|%203.9%20|%203.10-blue.svg) ## Installation From pip: @@ -86,7 +86,7 @@ And there are all my friends. #space hello - #file "bob.txt" + #file "Bob.txt" Hello Bob. #file "Alice.txt" @@ -157,4 +157,22 @@ if __name__ = "__main__": FMultiFileManager().parse_file("kolafile.kola") ``` -You will see new files in your work dir. \ No newline at end of file +You will see new files in your work dir. + + workdir + │ + │ hello.txt + │ + └─hello + Alice.txt + Bob.txt + +## What is more + +The most difference between KoiLang and other markup language like YAML which is data-centric is that KoiLang more pay attention to the command. Yeah, text in Kola file is a special command named `@text` too. In fact, the core idea of Kola is to separate data and instructions. The kola file is the data to execute commands, and the python script is the instructions. Then Kola module just mix they together. It can be considered as a simple virtual machine engine. if you want, you can even build a Python virtual machine (of course, I guess no one like to do that). + +On the other hand, text is also an important feature of Kola, which is a separate part, independent of context during parsing. The text is the soul of a Kola file. Any commands just are used to tell the computer what to do with the text. Though you can make a Kola file with only commands, it is not recommended. Instead, you ought to consider switching to another language. + +## Bugs/Requests + +Please send bug reports and feature requests through [github issue tracker](https://github.com/Ovizro/Kola/issues). Kola is open to any constructive suggestions. \ No newline at end of file diff --git a/examples/example1.kola b/examples/example1.kola index 98fa5dc..d90aa60 100644 --- a/examples/example1.kola +++ b/examples/example1.kola @@ -4,7 +4,7 @@ And there are all my friends. #space hello - #file "bob.txt" + #file "Bob.txt" Hello Bob. #file "Alice.txt" diff --git a/kola/__main__.py b/kola/__main__.py index c8d2112..29e3d95 100644 --- a/kola/__main__.py +++ b/kola/__main__.py @@ -82,7 +82,7 @@ def mkdir(self, dir: str, mode: int = 777) -> None: os.mkdir(dir, mode) @kola_command - def open(self, path: str, mode: str = "r", *, encoding: str = "utf-8") -> None: + def open(self, path: str, mode: str = "w", *, encoding: str = "utf-8") -> None: if hasattr(self, "file"): self.file.close() self.file = open(path, mode, encoding=encoding) @@ -92,6 +92,10 @@ def close(self) -> None: self.file.close() del self.file + @kola_command + def remove(self, path: str) -> None: + os.remove(path) + @kola_command def load(self, path: str, type: str = "kola", *, encoding: str = "utf-8") -> None: if type == "kola": @@ -155,11 +159,11 @@ def exit(self, code: int = 0) -> None: print(f"KoiLang Command Debugger {__version__} on {sys.platform}") while True: try: - sys.stdout.write("$kola : ") + sys.stdout.write("$kola: ") sys.stdout.flush() i = sys.stdin.readline() while i.endswith("\\\n"): - sys.stdout.write("$kola . ") + sys.stdout.write("$...: ") sys.stdout.flush() i += sys.stdin.readline() Parser(StringLexer(i), CommandDebugger).exec_once() @@ -181,14 +185,14 @@ def exit(self, code: int = 0) -> None: print(f"KoiLang Runner {__version__} on {sys.platform}") while True: try: - sys.stdout.write("$kola #: ") + sys.stdout.write("$kola: ") sys.stdout.flush() i = sys.stdin.readline() while i.endswith("\\\n"): - sys.stdout.write("$kola .: ") + sys.stdout.write("$... : ") sys.stdout.flush() i += sys.stdin.readline() - command_set.parse_command(i) + command_set.parse(i) except KeyboardInterrupt: break except KoiLangError: diff --git a/kola/_helper.h b/kola/_helper.h index a4ffdd0..39eda36 100644 --- a/kola/_helper.h +++ b/kola/_helper.h @@ -14,13 +14,13 @@ enum TokenSyn { } TokenSyn; static const uint8_t yy_goto[7][8] = { - 15, 63, 0, 0, 0, 0, 0, 0, // CMD | CMD_N | TEXT - 34, 162, 35, 117, 0, 151, 0, 40, // LITERAL - 17, 49, 35, 117, 0, 151, 0, 40, // NUM | STRING - 0, 0, 134, 0, 0, 0, 0, 6, // CLN - 0, 0, 100, 0, 4, 0, 8, 0, // CMA - 0, 3, 0, 0, 0, 0, 0, 0, // SLP - 0, 0, 65, 0, 81, 0, 81, 0 // SRP + {15, 63, 0, 0, 0, 0, 0, 0}, // CMD | CMD_N | TEXT + {34, 162, 35, 117, 0, 151, 0, 40}, // LITERAL + {17, 49, 35, 117, 0, 151, 0, 40}, // NUM | STRING + {0, 0, 134, 0, 0, 0, 0, 6}, // CLN + {0, 0, 100, 0, 4, 0, 8, 0}, // CMA + {0, 3, 0, 0, 0, 0, 0, 0}, // SLP + {0, 0, 65, 0, 81, 0, 81, 0} // SRP }; #ifndef FLEX_SCANNER @@ -59,9 +59,10 @@ static const char* get_format(int code) { ERR_MSG(unknown symbol '%s'); case 10: ERR_MSG(end of line in incurrect place); + case 28: + ERR_MSG(keyword must be a literal); case 201: case 202: - ERR_MSG(keyword must be a literal); case 210: ERR_MSG(bad argument count); } diff --git a/kola/lexer.c b/kola/lexer.c index df8ffea..891873c 100644 --- a/kola/lexer.c +++ b/kola/lexer.c @@ -2231,9 +2231,9 @@ static const char __pyx_k_S_CMA[] = "S_CMA"; static const char __pyx_k_S_CMD[] = "S_CMD"; static const char __pyx_k_S_NUM[] = "S_NUM"; static const char __pyx_k_S_SLP[] = "S_SLP"; +static const char __pyx_k_S_SRP[] = "S_SRP"; static const char __pyx_k_Token[] = "Token"; static const char __pyx_k_close[] = "close"; -static const char __pyx_k_s_SRP[] = "s_SRP"; static const char __pyx_k_state[] = "state"; static const char __pyx_k_S_TEXT[] = "S_TEXT"; static const char __pyx_k_dict_2[] = "_dict"; @@ -2325,6 +2325,7 @@ static PyObject *__pyx_n_s_S_NUM_B; static PyObject *__pyx_n_s_S_NUM_F; static PyObject *__pyx_n_s_S_NUM_H; static PyObject *__pyx_n_s_S_SLP; +static PyObject *__pyx_n_s_S_SRP; static PyObject *__pyx_n_s_S_STRING; static PyObject *__pyx_n_s_S_TEXT; static PyObject *__pyx_n_s_StopIteration; @@ -2380,7 +2381,6 @@ static PyObject *__pyx_n_s_raw_val; static PyObject *__pyx_n_s_reduce; static PyObject *__pyx_n_s_reduce_cython; static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_s_SRP; static PyObject *__pyx_n_s_self; static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; @@ -2505,6 +2505,7 @@ typedef struct { PyObject *__pyx_n_s_S_NUM_F; PyObject *__pyx_n_s_S_NUM_H; PyObject *__pyx_n_s_S_SLP; + PyObject *__pyx_n_s_S_SRP; PyObject *__pyx_n_s_S_STRING; PyObject *__pyx_n_s_S_TEXT; PyObject *__pyx_n_s_StopIteration; @@ -2560,7 +2561,6 @@ typedef struct { PyObject *__pyx_n_s_reduce; PyObject *__pyx_n_s_reduce_cython; PyObject *__pyx_n_s_reduce_ex; - PyObject *__pyx_n_s_s_SRP; PyObject *__pyx_n_s_self; PyObject *__pyx_n_s_setstate; PyObject *__pyx_n_s_setstate_cython; @@ -2659,6 +2659,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_S_NUM_F); Py_CLEAR(clear_module_state->__pyx_n_s_S_NUM_H); Py_CLEAR(clear_module_state->__pyx_n_s_S_SLP); + Py_CLEAR(clear_module_state->__pyx_n_s_S_SRP); Py_CLEAR(clear_module_state->__pyx_n_s_S_STRING); Py_CLEAR(clear_module_state->__pyx_n_s_S_TEXT); Py_CLEAR(clear_module_state->__pyx_n_s_StopIteration); @@ -2714,7 +2715,6 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_reduce); Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); - Py_CLEAR(clear_module_state->__pyx_n_s_s_SRP); Py_CLEAR(clear_module_state->__pyx_n_s_self); Py_CLEAR(clear_module_state->__pyx_n_s_setstate); Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); @@ -2800,6 +2800,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_S_NUM_F); Py_VISIT(traverse_module_state->__pyx_n_s_S_NUM_H); Py_VISIT(traverse_module_state->__pyx_n_s_S_SLP); + Py_VISIT(traverse_module_state->__pyx_n_s_S_SRP); Py_VISIT(traverse_module_state->__pyx_n_s_S_STRING); Py_VISIT(traverse_module_state->__pyx_n_s_S_TEXT); Py_VISIT(traverse_module_state->__pyx_n_s_StopIteration); @@ -2855,7 +2856,6 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_reduce); Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); - Py_VISIT(traverse_module_state->__pyx_n_s_s_SRP); Py_VISIT(traverse_module_state->__pyx_n_s_self); Py_VISIT(traverse_module_state->__pyx_n_s_setstate); Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); @@ -2938,6 +2938,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_S_NUM_F __pyx_mstate_global->__pyx_n_s_S_NUM_F #define __pyx_n_s_S_NUM_H __pyx_mstate_global->__pyx_n_s_S_NUM_H #define __pyx_n_s_S_SLP __pyx_mstate_global->__pyx_n_s_S_SLP +#define __pyx_n_s_S_SRP __pyx_mstate_global->__pyx_n_s_S_SRP #define __pyx_n_s_S_STRING __pyx_mstate_global->__pyx_n_s_S_STRING #define __pyx_n_s_S_TEXT __pyx_mstate_global->__pyx_n_s_S_TEXT #define __pyx_n_s_StopIteration __pyx_mstate_global->__pyx_n_s_StopIteration @@ -2993,7 +2994,6 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce #define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython #define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex -#define __pyx_n_s_s_SRP __pyx_mstate_global->__pyx_n_s_s_SRP #define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self #define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate #define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython @@ -4970,7 +4970,7 @@ static void __pyx_f_4kola_5lexer_9BaseLexer_set_error(struct __pyx_obj_4kola_5le goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("kola.lexer.BaseLexer.set_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + //__Pyx_AddTraceback("kola.lexer.BaseLexer.set_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } @@ -8505,6 +8505,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, __pyx_k_S_NUM_F, sizeof(__pyx_k_S_NUM_F), 0, 0, 1, 1}, {0, __pyx_k_S_NUM_H, sizeof(__pyx_k_S_NUM_H), 0, 0, 1, 1}, {0, __pyx_k_S_SLP, sizeof(__pyx_k_S_SLP), 0, 0, 1, 1}, + {0, __pyx_k_S_SRP, sizeof(__pyx_k_S_SRP), 0, 0, 1, 1}, {0, __pyx_k_S_STRING, sizeof(__pyx_k_S_STRING), 0, 0, 1, 1}, {0, __pyx_k_S_TEXT, sizeof(__pyx_k_S_TEXT), 0, 0, 1, 1}, {0, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, @@ -8560,7 +8561,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, {0, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {0, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {0, __pyx_k_s_SRP, sizeof(__pyx_k_s_SRP), 0, 0, 1, 1}, {0, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, {0, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {0, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, @@ -8596,6 +8596,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_S_NUM_F, __pyx_k_S_NUM_F, sizeof(__pyx_k_S_NUM_F), 0, 0, 1, 1}, {&__pyx_n_s_S_NUM_H, __pyx_k_S_NUM_H, sizeof(__pyx_k_S_NUM_H), 0, 0, 1, 1}, {&__pyx_n_s_S_SLP, __pyx_k_S_SLP, sizeof(__pyx_k_S_SLP), 0, 0, 1, 1}, + {&__pyx_n_s_S_SRP, __pyx_k_S_SRP, sizeof(__pyx_k_S_SRP), 0, 0, 1, 1}, {&__pyx_n_s_S_STRING, __pyx_k_S_STRING, sizeof(__pyx_k_S_STRING), 0, 0, 1, 1}, {&__pyx_n_s_S_TEXT, __pyx_k_S_TEXT, sizeof(__pyx_k_S_TEXT), 0, 0, 1, 1}, {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, @@ -8651,7 +8652,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_s_SRP, __pyx_k_s_SRP, sizeof(__pyx_k_s_SRP), 0, 0, 1, 1}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, @@ -8851,62 +8851,62 @@ static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { if (__Pyx_InitString(__pyx_string_tab[20], &__pyx_n_s_S_NUM_F) < 0) __PYX_ERR(0, 1, __pyx_L1_error); if (__Pyx_InitString(__pyx_string_tab[21], &__pyx_n_s_S_NUM_H) < 0) __PYX_ERR(0, 1, __pyx_L1_error); if (__Pyx_InitString(__pyx_string_tab[22], &__pyx_n_s_S_SLP) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[23], &__pyx_n_s_S_STRING) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[24], &__pyx_n_s_S_TEXT) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[25], &__pyx_n_s_StopIteration) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[26], &__pyx_n_s_StringLexer) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[27], &__pyx_n_s_StringLexer___reduce_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[28], &__pyx_n_s_StringLexer___setstate_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[29], &__pyx_n_s_Token) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[30], &__pyx_n_s_Token___reduce_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[31], &__pyx_n_s_Token___setstate_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[32], &__pyx_n_s_Token_get_flag) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[33], &__pyx_n_s_TypeError) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[34], &__pyx_n_s_ValueError) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[35], &__pyx_n_s__24) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[36], &__pyx_kp_u__3) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[37], &__pyx_kp_u__4) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[38], &__pyx_kp_u__5) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[39], &__pyx_kp_u__6) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[40], &__pyx_n_s_asyncio_coroutines) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[41], &__pyx_n_s_cline_in_traceback) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[42], &__pyx_n_s_close) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[43], &__pyx_n_s_content) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[44], &__pyx_n_s_dict) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[45], &__pyx_n_s_dict_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[46], &__pyx_kp_u_disable) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[47], &__pyx_kp_u_enable) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[48], &__pyx_n_s_ensure) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[49], &__pyx_n_s_exception) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[50], &__pyx_n_s_filename) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[51], &__pyx_kp_u_gc) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[52], &__pyx_n_s_get_flag) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[53], &__pyx_n_s_getstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[54], &__pyx_n_s_import) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[55], &__pyx_n_s_is_coroutine) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[56], &__pyx_kp_u_isenabled) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[57], &__pyx_n_s_kola_lexer) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[58], &__pyx_kp_s_kola_lexer_pyx) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[59], &__pyx_kp_u_lexer_state_must_be_between_0_an) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[60], &__pyx_n_s_lineno) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[61], &__pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[62], &__pyx_n_s_name) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[63], &__pyx_n_s_new) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[64], &__pyx_kp_s_no_default___reduce___due_to_non) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[65], &__pyx_kp_u_operation_on_closed_lexer) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[66], &__pyx_n_s_pickle) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[67], &__pyx_n_s_pyx_PickleError) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[68], &__pyx_n_s_pyx_checksum) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[69], &__pyx_n_s_pyx_result) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[70], &__pyx_n_s_pyx_state) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[71], &__pyx_n_s_pyx_type) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[72], &__pyx_n_s_pyx_unpickle_Token) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[73], &__pyx_n_s_pyx_vtable) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[74], &__pyx_n_s_raw_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[75], &__pyx_n_s_reduce) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[76], &__pyx_n_s_reduce_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[77], &__pyx_n_s_reduce_ex) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[78], &__pyx_n_s_s_SRP) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[23], &__pyx_n_s_S_SRP) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[24], &__pyx_n_s_S_STRING) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[25], &__pyx_n_s_S_TEXT) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[26], &__pyx_n_s_StopIteration) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[27], &__pyx_n_s_StringLexer) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[28], &__pyx_n_s_StringLexer___reduce_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[29], &__pyx_n_s_StringLexer___setstate_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[30], &__pyx_n_s_Token) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[31], &__pyx_n_s_Token___reduce_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[32], &__pyx_n_s_Token___setstate_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[33], &__pyx_n_s_Token_get_flag) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[34], &__pyx_n_s_TypeError) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[35], &__pyx_n_s_ValueError) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[36], &__pyx_n_s__24) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[37], &__pyx_kp_u__3) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[38], &__pyx_kp_u__4) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[39], &__pyx_kp_u__5) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[40], &__pyx_kp_u__6) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[41], &__pyx_n_s_asyncio_coroutines) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[42], &__pyx_n_s_cline_in_traceback) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[43], &__pyx_n_s_close) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[44], &__pyx_n_s_content) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[45], &__pyx_n_s_dict) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[46], &__pyx_n_s_dict_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[47], &__pyx_kp_u_disable) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[48], &__pyx_kp_u_enable) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[49], &__pyx_n_s_ensure) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[50], &__pyx_n_s_exception) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[51], &__pyx_n_s_filename) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[52], &__pyx_kp_u_gc) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[53], &__pyx_n_s_get_flag) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[54], &__pyx_n_s_getstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[55], &__pyx_n_s_import) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[56], &__pyx_n_s_is_coroutine) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[57], &__pyx_kp_u_isenabled) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[58], &__pyx_n_s_kola_lexer) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[59], &__pyx_kp_s_kola_lexer_pyx) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[60], &__pyx_kp_u_lexer_state_must_be_between_0_an) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[61], &__pyx_n_s_lineno) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[62], &__pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[63], &__pyx_n_s_name) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[64], &__pyx_n_s_new) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[65], &__pyx_kp_s_no_default___reduce___due_to_non) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[66], &__pyx_kp_u_operation_on_closed_lexer) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[67], &__pyx_n_s_pickle) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[68], &__pyx_n_s_pyx_PickleError) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[69], &__pyx_n_s_pyx_checksum) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[70], &__pyx_n_s_pyx_result) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[71], &__pyx_n_s_pyx_state) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[72], &__pyx_n_s_pyx_type) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[73], &__pyx_n_s_pyx_unpickle_Token) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[74], &__pyx_n_s_pyx_vtable) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[75], &__pyx_n_s_raw_val) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[76], &__pyx_n_s_reduce) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[77], &__pyx_n_s_reduce_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[78], &__pyx_n_s_reduce_ex) < 0) __PYX_ERR(0, 1, __pyx_L1_error); if (__Pyx_InitString(__pyx_string_tab[79], &__pyx_n_s_self) < 0) __PYX_ERR(0, 1, __pyx_L1_error); if (__Pyx_InitString(__pyx_string_tab[80], &__pyx_n_s_setstate) < 0) __PYX_ERR(0, 1, __pyx_L1_error); if (__Pyx_InitString(__pyx_string_tab[81], &__pyx_n_s_setstate_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); @@ -9590,7 +9590,7 @@ if (!__Pyx_RefNanny) { * S_CLN = CLN * S_CMA = CMA # <<<<<<<<<<<<<< * S_SLP = SLP - * s_SRP = SRP + * S_SRP = SRP */ __pyx_t_3 = __Pyx_PyInt_From_enum__TokenSyn(CMA); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); @@ -9601,7 +9601,7 @@ if (!__Pyx_RefNanny) { * S_CLN = CLN * S_CMA = CMA * S_SLP = SLP # <<<<<<<<<<<<<< - * s_SRP = SRP + * S_SRP = SRP * */ __pyx_t_3 = __Pyx_PyInt_From_enum__TokenSyn(SLP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) @@ -9612,13 +9612,13 @@ if (!__Pyx_RefNanny) { /* "kola/lexer.pyx":21 * S_CMA = CMA * S_SLP = SLP - * s_SRP = SRP # <<<<<<<<<<<<<< + * S_SRP = SRP # <<<<<<<<<<<<<< * * */ __pyx_t_3 = __Pyx_PyInt_From_enum__TokenSyn(SRP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_s_SRP, __pyx_t_3) < 0) __PYX_ERR(0, 21, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_S_SRP, __pyx_t_3) < 0) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "kola/lexer.pyx":49 diff --git a/kola/lexer.pyi b/kola/lexer.pyi index e320c5a..7cfa7d0 100644 --- a/kola/lexer.pyi +++ b/kola/lexer.pyi @@ -13,13 +13,15 @@ S_NUM_F: int S_CLN: int S_CMA: int S_SLP: int -s_SRP: int +S_SRP: int class Token: syn: Final[int] val: Final[Any] + def get_flag(self) -> int: ... + class BaseLexer: filename: Final[str] diff --git a/kola/lexer.pyx b/kola/lexer.pyx index 8e770f7..fcd2d23 100644 --- a/kola/lexer.pyx +++ b/kola/lexer.pyx @@ -18,7 +18,7 @@ S_NUM_F = NUM_F S_CLN = CLN S_CMA = CMA S_SLP = SLP -s_SRP = SRP +S_SRP = SRP @cython.final diff --git a/kola/parser.c b/kola/parser.c index f9b6558..0817d8c 100644 --- a/kola/parser.c +++ b/kola/parser.c @@ -3727,7 +3727,7 @@ static void __pyx_f_4kola_6parser_6Parser_set_error(struct __pyx_obj_4kola_6pars goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("kola.parser.Parser.set_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + //__Pyx_AddTraceback("kola.parser.Parser.set_error", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } @@ -4594,7 +4594,7 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ PyObject *__pyx_v_name = 0; PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwds = 0; - struct __pyx_obj_4kola_5lexer_Token *__pyx_v_i = 0; + struct __pyx_obj_4kola_5lexer_Token *__pyx_v_token = 0; PyObject *__pyx_v_cmd = NULL; PyObject *__pyx_v_e = NULL; PyObject *__pyx_r = NULL; @@ -4684,54 +4684,54 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ } /* "kola/parser.pyx":105 - * Token i + * Token token * - * i = self.t_cache # <<<<<<<<<<<<<< - * if i is None: - * i = self.lexer.next_token() + * token = self.t_cache # <<<<<<<<<<<<<< + * if token is None: + * token = self.lexer.next_token() */ __pyx_t_1 = ((PyObject *)__pyx_v_self->t_cache); __Pyx_INCREF(__pyx_t_1); - __pyx_v_i = ((struct __pyx_obj_4kola_5lexer_Token *)__pyx_t_1); + __pyx_v_token = ((struct __pyx_obj_4kola_5lexer_Token *)__pyx_t_1); __pyx_t_1 = 0; /* "kola/parser.pyx":106 * - * i = self.t_cache - * if i is None: # <<<<<<<<<<<<<< - * i = self.lexer.next_token() - * if i is None: + * token = self.t_cache + * if token is None: # <<<<<<<<<<<<<< + * token = self.lexer.next_token() + * if token is None: */ - __pyx_t_6 = (((PyObject *)__pyx_v_i) == Py_None); + __pyx_t_6 = (((PyObject *)__pyx_v_token) == Py_None); __pyx_t_7 = (__pyx_t_6 != 0); if (__pyx_t_7) { /* "kola/parser.pyx":107 - * i = self.t_cache - * if i is None: - * i = self.lexer.next_token() # <<<<<<<<<<<<<< - * if i is None: + * token = self.t_cache + * if token is None: + * token = self.lexer.next_token() # <<<<<<<<<<<<<< + * if token is None: * self.stat = 255 */ __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_4kola_5lexer_BaseLexer *)__pyx_v_self->lexer->__pyx_vtab)->next_token(__pyx_v_self->lexer)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_i, ((struct __pyx_obj_4kola_5lexer_Token *)__pyx_t_1)); + __Pyx_DECREF_SET(__pyx_v_token, ((struct __pyx_obj_4kola_5lexer_Token *)__pyx_t_1)); __pyx_t_1 = 0; /* "kola/parser.pyx":108 - * if i is None: - * i = self.lexer.next_token() - * if i is None: # <<<<<<<<<<<<<< + * if token is None: + * token = self.lexer.next_token() + * if token is None: # <<<<<<<<<<<<<< * self.stat = 255 * return */ - __pyx_t_7 = (((PyObject *)__pyx_v_i) == Py_None); + __pyx_t_7 = (((PyObject *)__pyx_v_token) == Py_None); __pyx_t_6 = (__pyx_t_7 != 0); if (__pyx_t_6) { /* "kola/parser.pyx":109 - * i = self.lexer.next_token() - * if i is None: + * token = self.lexer.next_token() + * if token is None: * self.stat = 255 # <<<<<<<<<<<<<< * return * @@ -4739,7 +4739,7 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ __pyx_v_self->stat = 0xFF; /* "kola/parser.pyx":110 - * if i is None: + * if token is None: * self.stat = 255 * return # <<<<<<<<<<<<<< * @@ -4750,9 +4750,9 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ goto __pyx_L0; /* "kola/parser.pyx":108 - * if i is None: - * i = self.lexer.next_token() - * if i is None: # <<<<<<<<<<<<<< + * if token is None: + * token = self.lexer.next_token() + * if token is None: # <<<<<<<<<<<<<< * self.stat = 255 * return */ @@ -4760,10 +4760,10 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ /* "kola/parser.pyx":106 * - * i = self.t_cache - * if i is None: # <<<<<<<<<<<<<< - * i = self.lexer.next_token() - * if i is None: + * token = self.t_cache + * if token is None: # <<<<<<<<<<<<<< + * token = self.lexer.next_token() + * if token is None: */ } @@ -4803,7 +4803,7 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ * kwds = args[1] * args = args[0] # <<<<<<<<<<<<<< * - * if i.syn == CMD: + * if token.syn == CMD: */ if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); @@ -4820,21 +4820,21 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ /* "kola/parser.pyx":116 * args = args[0] * - * if i.syn == CMD: # <<<<<<<<<<<<<< - * name = i.val - * elif i.syn == CMD_N: + * if token.syn == CMD: # <<<<<<<<<<<<<< + * name = token.val + * elif token.syn == CMD_N: */ - switch (__pyx_v_i->syn) { + switch (__pyx_v_token->syn) { case CMD: /* "kola/parser.pyx":117 * - * if i.syn == CMD: - * name = i.val # <<<<<<<<<<<<<< - * elif i.syn == CMD_N: + * if token.syn == CMD: + * name = token.val # <<<<<<<<<<<<<< + * elif token.syn == CMD_N: * name = "@number" */ - __pyx_t_1 = __pyx_v_i->val; + __pyx_t_1 = __pyx_v_token->val; __Pyx_INCREF(__pyx_t_1); __pyx_v_name = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; @@ -4842,35 +4842,35 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ /* "kola/parser.pyx":116 * args = args[0] * - * if i.syn == CMD: # <<<<<<<<<<<<<< - * name = i.val - * elif i.syn == CMD_N: + * if token.syn == CMD: # <<<<<<<<<<<<<< + * name = token.val + * elif token.syn == CMD_N: */ break; case CMD_N: /* "kola/parser.pyx":119 - * name = i.val - * elif i.syn == CMD_N: + * name = token.val + * elif token.syn == CMD_N: * name = "@number" # <<<<<<<<<<<<<< - * args = (i.val,) + args - * elif i.syn == TEXT: + * args = (token.val,) + args + * elif token.syn == TEXT: */ __Pyx_INCREF(__pyx_kp_u_number); __pyx_v_name = __pyx_kp_u_number; /* "kola/parser.pyx":120 - * elif i.syn == CMD_N: + * elif token.syn == CMD_N: * name = "@number" - * args = (i.val,) + args # <<<<<<<<<<<<<< - * elif i.syn == TEXT: + * args = (token.val,) + args # <<<<<<<<<<<<<< + * elif token.syn == TEXT: * name = "@text" */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_i->val); - __Pyx_GIVEREF(__pyx_v_i->val); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_i->val); + __Pyx_INCREF(__pyx_v_token->val); + __Pyx_GIVEREF(__pyx_v_token->val); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_token->val); __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_args); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4878,46 +4878,46 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ __pyx_t_2 = 0; /* "kola/parser.pyx":118 - * if i.syn == CMD: - * name = i.val - * elif i.syn == CMD_N: # <<<<<<<<<<<<<< + * if token.syn == CMD: + * name = token.val + * elif token.syn == CMD_N: # <<<<<<<<<<<<<< * name = "@number" - * args = (i.val,) + args + * args = (token.val,) + args */ break; case TEXT: /* "kola/parser.pyx":122 - * args = (i.val,) + args - * elif i.syn == TEXT: + * args = (token.val,) + args + * elif token.syn == TEXT: * name = "@text" # <<<<<<<<<<<<<< - * args = (i.val,) + * args = (token.val,) * try: */ __Pyx_INCREF(__pyx_kp_u_text); __pyx_v_name = __pyx_kp_u_text; /* "kola/parser.pyx":123 - * elif i.syn == TEXT: + * elif token.syn == TEXT: * name = "@text" - * args = (i.val,) # <<<<<<<<<<<<<< + * args = (token.val,) # <<<<<<<<<<<<<< * try: * cmd = self.command_set[name] */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_i->val); - __Pyx_GIVEREF(__pyx_v_i->val); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_i->val); + __Pyx_INCREF(__pyx_v_token->val); + __Pyx_GIVEREF(__pyx_v_token->val); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_token->val); __Pyx_DECREF_SET(__pyx_v_args, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; /* "kola/parser.pyx":121 * name = "@number" - * args = (i.val,) + args - * elif i.syn == TEXT: # <<<<<<<<<<<<<< + * args = (token.val,) + args + * elif token.syn == TEXT: # <<<<<<<<<<<<<< * name = "@text" - * args = (i.val,) + * args = (token.val,) */ break; default: break; @@ -4925,7 +4925,7 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ /* "kola/parser.pyx":124 * name = "@text" - * args = (i.val,) + * args = (token.val,) * try: # <<<<<<<<<<<<<< * cmd = self.command_set[name] * except KeyError: @@ -4940,7 +4940,7 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ /*try:*/ { /* "kola/parser.pyx":125 - * args = (i.val,) + * args = (token.val,) * try: * cmd = self.command_set[name] # <<<<<<<<<<<<<< * except KeyError: @@ -4954,7 +4954,7 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ /* "kola/parser.pyx":124 * name = "@text" - * args = (i.val,) + * args = (token.val,) * try: # <<<<<<<<<<<<<< * cmd = self.command_set[name] * except KeyError: @@ -5047,7 +5047,7 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ /* "kola/parser.pyx":124 * name = "@text" - * args = (i.val,) + * args = (token.val,) * try: # <<<<<<<<<<<<<< * cmd = self.command_set[name] * except KeyError: @@ -5321,7 +5321,7 @@ static PyObject *__pyx_f_4kola_6parser_6Parser_exec_once(struct __pyx_obj_4kola_ __Pyx_XDECREF(__pyx_v_name); __Pyx_XDECREF(__pyx_v_args); __Pyx_XDECREF(__pyx_v_kwds); - __Pyx_XDECREF((PyObject *)__pyx_v_i); + __Pyx_XDECREF((PyObject *)__pyx_v_token); __Pyx_XDECREF(__pyx_v_cmd); __Pyx_XDECREF(__pyx_v_e); __Pyx_XGIVEREF(__pyx_r); diff --git a/kola/version.py b/kola/version.py index d4d19a3..47fc159 100644 --- a/kola/version.py +++ b/kola/version.py @@ -1,2 +1,2 @@ -__version__ = "0.1.0b2" -version_info = (0, 1, 0, "beta", 2) \ No newline at end of file +__version__ = "0.1.0b3" +version_info = (0, 1, 0, "beta", 3) \ No newline at end of file