Ondřej Súkup 2019-03-14 12:52:09 +00:00 committed by Git OBS Bridge
commit 8975f560fc
8 changed files with 161 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Piotr Dabkowski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

37
README.md Normal file
View File

@ -0,0 +1,37 @@
# pyjsparser
Fast JavaScript parser - manual translation of esprima.js to python. Takes 1 second to parse whole angular.js library so parsing speed is about 100k characters per second which makes it the fastest and most comprehensible JavaScript parser for python out there.
Supports whole ECMAScript 5.1 and parts of ECMAScript 6. If you need full ECMA 6 support I recomment trying out [this](https://github.com/Kronuz/esprima-python) parser by Kronuz.
# Installation
pip install pyjsparser
# Example
>>> from pyjsparser import PyJsParser
>>> p = PyJsParser()
>>> p.parse('var $ = "Hello!"')
{
"type": "Program",
"body": [
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "$"
},
"init": {
"type": "Literal",
"value": "Hello!",
"raw": '"Hello!"'
}
}
],
"kind": "var"
}
]
}

12
fix_version.patch Normal file
View File

@ -0,0 +1,12 @@
Index: pyjsparser-2.5.2/pyjsparser/__init__.py
===================================================================
--- pyjsparser-2.5.2.orig/pyjsparser/__init__.py
+++ pyjsparser-2.5.2/pyjsparser/__init__.py
@@ -1,4 +1,4 @@
__all__ = ['PyJsParser', 'parse', 'JsSyntaxError']
__author__ = 'Piotr Dabkowski'
-__version__ = '2.2.0'
-from .parser import PyJsParser, parse, JsSyntaxError
\ No newline at end of file
+__version__ = '2.5.2'
+from .parser import PyJsParser, parse, JsSyntaxError

3
pyjsparser-2.5.2.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e4a659df3db42a2ff9fbc961eb6d4076a0b945e1aadfc20d48f913ad5dca011d
size 24039

View File

@ -0,0 +1,5 @@
-------------------------------------------------------------------
Wed Mar 13 15:47:24 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com>
- Initial commit
- add fix_version.patch

59
python-pyjsparser.spec Normal file
View File

@ -0,0 +1,59 @@
#
# spec file for package python-pyjsparser
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pyjsparser
Version: 2.5.2
Release: 0
License: MIT
Summary: Fast javascript parser (based on esprimajs)
Url: https://github.com/PiotrDabkowski/pyjsparser
Group: Development/Languages/Python
Source: https://files.pythonhosted.org/packages/source/p/pyjsparser/pyjsparser-%{version}.tar.gz
Source1: https://raw.githubusercontent.com/PiotrDabkowski/pyjsparser/master/LICENSE
Source2: https://raw.githubusercontent.com/PiotrDabkowski/pyjsparser/master/README.md
Patch0: fix_version.patch
BuildRequires: python-rpm-macros
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildArch: noarch
%python_subpackages
%description
Fast JavaScript parser - manual translation of esprima.js to python
Supports whole ECMAScript 5.1 and parts of ECMAScript 6.
%prep
%setup -q -n pyjsparser-%{version}
%patch0 -p1
cp %{S:1} .
cp %{S:2} .
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitelib}/*
%changelog