Giter Site home page Giter Site logo

wbsoft / parce Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 1.0 2.27 MB

:deciduous_tree: Python lexer that can remember tokens and state and only reparse changed parts of a text document

Home Page: http://parce.info

License: GNU General Public License v3.0

Python 94.95% CSS 3.60% HTML 1.15% LilyPond 0.01% Scheme 0.02% TeX 0.04% Roff 0.04% JavaScript 0.02% Tcl 0.02% Shell 0.06% C 0.01% XSLT 0.09%
lexing parsing python3 text tokenizer tree-structure

parce's People

Contributors

wbsoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pombredanne

parce's Issues

Use async/await

It would be nice if asyncio and the new async/await features of Python could be used. Still the work should not be done in the main thread but a background thread (because parce needs to be usable for GUI applications that have the GUI in the main thread), and signals or events could still be used when a job is done. But it would be nice if that was handled by awaitables. Interaction with parceqt and/or other GUIs is important.

This thread is created to collect (my own or others) thinking about this subject and determine a way to go.

In python 3.9 `'text' in context` or `<lexicon> in context` no longer works

It seems Python 3.9 changed the semantics of __contains__.

A Token can be tested for equality with a string, in that case the Token's text is tested for equality with the string.

Likewise, a Context can be compared with a Lexicon, in which case the Context's lexicon is test for equality with the specified Lexicon.

This used to work for the in operator of lists and tuples, "text" in context or some_lexicon in context used to work, because __eq__ was called on the items of the sequence. But starting with Python 3.9, it seems the in operator calls __eq__ the other way around, not on the sequence's item, but on the item that's searched for in the sequence.

Although we could keep stuff like:

if token == "text":
    do_something()

we can't use the in operator anymore, as it calls "text".__eq__(token) instead of token.__eq__(text).
This also has consequences for the query.__call__() method, which currently depends on the pre 3.9 behaviour.

Better integration of Transformer with Document

A Document is neatly integrated with a tree builder which updates the parce tree on every change.
This should also be the case for transforming jobs.

Without cluttering Document further (it is already too cluttered!) there should be a clean possibility to either/or:

  • connect a transformer with a Document
  • know if a transform is busy or not
  • get the transformed object for a Document
  • await the now being transformed object
  • get a callback if a transform is ready
  • etc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.