• Stars
    star
    206
  • Rank 189,428 (Top 4 %)
  • Language
    Python
  • License
    Other
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ECMAScript parsing infrastructure for multipurpose analysis

Donate PyPI Version PyPI License PyPI Format PyPI Status

Esprima (esprima.org, BSD license) is a high performance, standard-compliant ECMAScript parser officially written in ECMAScript (also popularly known as JavaScript) and ported to Python. Esprima is created and maintained by Ariya Hidayat, with the help of many contributors.

Python port is a line-by-line manual translation and was created and is maintained by German Mendez Bravo (Kronuz).

Features

Installation

pip install esprima

API

Esprima can be used to perform lexical analysis (tokenization) or syntactic analysis (parsing) of a JavaScript program.

A simple example:

>>> import esprima
>>> program = 'const answer = 42'

>>> esprima.tokenize(program)
[{
    type: "Keyword",
    value: "const"
}, {
    type: "Identifier",
    value: "answer"
}, {
    type: "Punctuator",
    value: "="
}, {
    type: "Numeric",
    value: "42"
}]

>>> esprima.parseScript(program)
{
    body: [
        {
            kind: "const",
            declarations: [
                {
                    init: {
                        raw: "42",
                        type: "Literal",
                        value: 42
                    },
                    type: "VariableDeclarator",
                    id: {
                        type: "Identifier",
                        name: "answer"
                    }
                }
            ],
            type: "VariableDeclaration"
        }
    ],
    type: "Program",
    sourceType: "script"
}

For more information, please read the complete documentation.

More Repositories

1

pyScss

pyScss, a Scss compiler for Python
CSS
583
star
2

Xapiand

Xapiand: A RESTful Search Engine
C++
363
star
3

cpp-btree

Modern C++ B-tree containers
C++
178
star
4

KomodoEdit-SublimeCodeIntel

Python
119
star
5

ColorHighlight

🎨 Lightweight Color Highlight colorizer for Sublime Text
Python
109
star
6

SublimeLinter

40
star
7

constexpr-phf

Computes a constexpr (minimal) perfect hash function
C++
32
star
8

TextMarker

πŸ– Text Marker (Highlighter) highlights words in Sublime Text
Python
20
star
9

Kronuz-Theme

Kronuz Theme for Sublime Text 3
16
star
10

SublimeCodeIntel

πŸ’‘ SublimeCodeIntel LSP
Python
14
star
11

ansi2html

Simple Python tool to convert ANSI color characters to HTML with colored style.
Python
14
star
12

base-x

BaseX encoder / decoder for C++
C++
12
star
13

IndentSize

Sublime Text 3 plugin for adding indent_size setting
Python
8
star
14

pyXapiand

Xapian indexing and querying server implemented in Python
Python
5
star
15

iscroll-overflow

Similar to iScroll4 (lite), using native overflow
JavaScript
3
star
16

django-gitlist

Django GitList
JavaScript
2
star
17

logkext

logKext is a freeware open-source keylogger for OS X that hooks into the kernel to bypass userspace security measures.
C++
2
star
18

react-gestalt-masonry

Masonry ported to TypeScript from pinterest/gestalt
TypeScript
1
star
19

leetcode

C++
1
star
20

OpenLegends

C++
1
star
21

console-colorizer

Adds colored console logging (for node and browser)
TypeScript
1
star
22

HTML-CodeIntel

HTML Plugin for SublimeCodeIntel LSP
JavaScript
1
star
23

KomodoEdit-CodeIntel

C
1
star
24

fsc

FreeBSD Services Control Utilities
C
1
star
25

docker-nginx

Alpine Docker image with Nginx 1.14.0 + LUA + Push Stream +H264 streaming + Headers More
Dockerfile
1
star
26

SublimeStackTracer

What are my Sublime Text plugins doing?
Python
1
star
27

react-gestalt-collage

Collage ported to TypeScript from pinterest/gestalt
TypeScript
1
star