Code Monkey home page Code Monkey logo

lext's People

Contributors

jhauberg avatar

Stargazers

 avatar

Watchers

 avatar

lext's Issues

Prefer returning bool/enum values over integers

In the most basic cases, where a function is indeed only either successful or not, bool should always be used.

In cases where a non-successful result carries more information, an enum should be used. For example, lxt_parse, which can hit several different failures, should return which exact failure it hit (e.g. max containers, entries etc.).

It might even be worthwhile to go further than just simple enums and instead return stateful information so that the library can report exactly where and why something went wrong; e.g. parsing errors at line and column numbers. But that is probably better fit as a separate issue.

Sequence variables only resolve if followed by whitespace

Some patterns won't resolve as expected because variables are not parsed properly in certain cases.

For example, the following pattern starts out with a variable @letter; however, this particular variable happens to be followed by a comma, making the parser think it is part of the variable name (e.g. variable,). In this case, it shouldn't be.

letter (a, b, c) seq <@letter, @letter, @letter>

I suppose a simple fix is to break on both isspace(..) and any non-alphabet character (such as ,, . etc.).

Alternatively, require an escape for any character not part of the name- something like <@letter\, @letter\, @letter>.

Support escaping keyword symbols as literals

For example, currently, you specifically can't use either @ or > literally in a generator sequence, because these, respectively, indicates either start of variable or end of sequence. It would be nice being able to escape these so they can be used as literals.

Similarly, this is also an issue in container entries, where you e.g. can't use commas (,) because they would indicate end of entry.

You can get around the issue by limiting commas to sequences, and limiting variable/end of sequence symbols to only occur in entries, but generally, you'd probably expect just being able to escape these as literals.

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.