Git Product home page Git Product logo

Comments (8)

peter-winter avatar peter-winter commented on July 22, 2024

Why would you do this? It is the same term.

from ctpg.

peter-winter avatar peter-winter commented on July 22, 2024

There isn't much to release really. I'm sort of waiting until there are some good ideas on how to improve the library.

from ctpg.

95833 avatar 95833 commented on July 22, 2024

Why would you do this? It is the same term.

for recognize following:
int : "[0-9]+" and float : "[0-9]+\.[0-9]+"
or
float self " [0-9]\\.[0-9]+[Ee]-?[0-9]+ | [0-9]+[Ee]-?[0-9]+ | [0-9]+\\.[0-9]+"
or
class "[A-Z][a-zA-Z0-9_]+" and class_ptr "[A-Z][a-zA-Z0-9_]+\*"
and so on.

place them in terms will be an error.

from ctpg.

95833 avatar 95833 commented on July 22, 2024

@peter-winter placing some string(eg: "except", "match", "while") in terms also will be an error.

from ctpg.

peter-winter avatar peter-winter commented on July 22, 2024

Can you please provide some code which isn't working?

from ctpg.

95833 avatar 95833 commented on July 22, 2024

Can you please provide some code which isn't working?

Might I writen mistake. the error of string cannot be reappeared and has been deleted due to finding a new lib(https://github.com/metthal/pog). the following is the code of regex error:

#include <ctpg/ctpg.hpp>
#include <iostream>
#include <charconv>

using namespace ctpg;
using namespace ctpg::buffers;

constexpr nterm<int> list("list");

constexpr char number_pattern[] = "[0-9]+\\.[0-9]+[Ee]-?[0-9]+|[0-9]+[Ee]-?[0-9]+";
constexpr regex_term<number_pattern> number("number");

constexpr parser p(
    list,
    terms(
        number
    ),
    nterms(
        list
    ),
    rules(
        list(number) >= [](const auto& n) { 
            return 0; 
        }
    )
);

int main(int argc, char* argv[])
{
    if (argc < 2)
        return -1;
    auto res = p.parse(string_buffer(argv[1]), std::cerr);
    bool success = res.has_value();
    if (success)
        std::cout << res.value() << std::endl;
    return success ? 0 : -1;
}

from ctpg.

95833 avatar 95833 commented on July 22, 2024

Maybe the function of mode switcher need to be added also.

from ctpg.

peter-winter avatar peter-winter commented on July 22, 2024

I know you closed it, but actually you were encountering a bug which I just fixed. The problem was with regexes of the form:
a*b|a*
a+b|a+

from ctpg.

Related Issues (20)

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.