Git Product home page Git Product logo

scan's Introduction

scan's People

Contributors

rwxrob avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

playfloor

scan's Issues

Migrate into pegn package

This scanner is already heavily influenced by the infinite-memory (PEG)
approach, so might as well move it into pegn where that expectation will
be more welcome and understood.

Close access to the cursor directly

Allowing scan.R users to have write access to the internal cursor is a
bad idea because they will attempt to manipulate it breaking any
automatic line detection and other magic that can happen in the Scan
method. The cost in performance to force a call to Scan for every rune
is minimal in comparison.

Replace Snap/Back with Save/Revert

Now that we have parsing in the mix we need to be able to revert both
the buffer cursor position and the current state of the node tree that
has been parsed.

Expand positive lookahead, ban z.P

z.P parsing expressions are not allowed within either lookahead
expression, need to be sure people don't try it, at the slight cost of
performance

Fix complex parsing

Parsing is suffering from the lack of any sort of transactional commit
method to the s.Tree.Root. While it is possible to jump back to a
position in the buffer during recursive calls to scan.X it is not
currently possible to revert the state of the s.Tree.Root to that moment
in time which produces additions to the tree that do not belong that
were successful during other scans. z.X currently has a broken fix for
this by taking a reference to s.Tree.Root and restoring it, but that
solution will not work going forward for everything.

It's quite possible there isn't a simple solution for this problem given
the nature of the Node tree since once the internal references of any
node are updated from Add or Append, removing them is difficult even
with Cut available because we don't know which Node to CutParsing is
suffering from the lack of any sort of transactional commit method to
the s.Tree.Root. While it is possible to jump back to a position in the
buffer during recursive calls to scan.X it is not currently possible to
revert the state of the s.Tree.Root to that moment in time which
produces additions to the tree that do not belong that were successful
during other scans. z.X currently has a broken fix for this by taking a
reference to s.Tree.Root and restoring it, but that solution will not
work going forward for everything.

It's quite possible there isn't a simple solution for this problem given
the nature of the Node tree since once the internal references of any
node are updated from Add or Append, removing them is difficult even
with Cut available because we don't know which Node to Cut.

Restore Peek and Match to previous

The inclusion of the last scanned rune is only convenient when working
inside for loops, but it wrong and error-prone in other situations
such as from within a functional parser where each function is
responsible to advance itself, if and only if, it has a peek ahead
match.

Really we need something like the following:

  • Peek - only stuff ahead of the last rune scanned (s.P)
  • PeekMatch - regular expression against stuff ahead (s.P)
  • Is - string including the last rune scanned (s.LP)
  • Match - regular expression against last scanned (s.LP)

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.