hedhyw / rex

Flexible regular expressions constructor for Golang.
MIT License
196 stars 5 forks source link

feat: add basic generation of rex code #57

Closed ryzheboka closed 1 year ago

ryzheboka commented 2 years ago

The PR is related to #13. To run the script, execute

go build

In the generator folder. Then run following command with the regex of your choice:

./generator "((\d+)([a-z]+))"
coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 3428068994


Totals Coverage Status
Change from base Build 3400309470: 0.0%
Covered Lines: 735
Relevant Lines: 735

💛 - Coveralls
ryzheboka commented 2 years ago

Thanks for a fast review! I added your suggested changes and pushed them.

  1. Is following addition to the Makefile ok?
    build:
    go build -o ./bin/generate/rex ./cmd/generator/main.go
  2. Thanks, that's way more practical than pushing each time
  3. How do you mean: "I think we don't handle the escape character (" ?
  4. I am not sure about how to use the parser. Do you mean creating a *Regexp first, and then generating the code?
  5. Thank you for your answers! It's a great learning experience for me :)
hedhyw commented 2 years ago

Thanks for a fast review! I added your suggested changes and pushed them.

  1. Is following addition to the Makefile ok?
build:
  go build -o ./bin/generate/rex ./cmd/generator/main.go
  1. Thanks, that's way more practical than pushing each time
  2. How do you mean: "I think we don't handle the escape character (" ?
  3. I am not sure about how to use the parser. Do you mean creating a *Regexp first, and then generating the code?
  4. Thank you for your answers! It's a great learning experience for me :)
  1. yes
  2. 👍
  3. For example, I want to match "(#123)", then I will write \(#\d+\). \( indicates the symbol (, not starting of the group.
  4. https://go.dev/play/p/RkRAXCl1O6G
  5. 👍
ryzheboka commented 1 year ago

Your suggestions are pushed :)

  1. I added the handling of "( ", as well as corresponding changes to one the test cases
  2. Would it be better to do this as part of the PR? Or separate from the PR?
ryzheboka commented 1 year ago

The PR is adjusted according to comments :) There should be no duplicates now