Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regex_dat: the order of the overrides is not specified in the spec #19

Open
0x5c opened this issue Nov 19, 2019 · 5 comments
Open

regex_dat: the order of the overrides is not specified in the spec #19

0x5c opened this issue Nov 19, 2019 · 5 comments
Labels
bug Something isn't working question Further information is requested

Comments

@0x5c
Copy link
Member

0x5c commented Nov 19, 2019

It isn't specified in neither the country-files page or the CT9 manual.

@0x5c 0x5c added the bug Something isn't working label Nov 19, 2019
@0x5c 0x5c added this to the 2.0.0 Release milestone Nov 19, 2019
@0x5c
Copy link
Member Author

0x5c commented Nov 19, 2019

Can be fixed "simply" if we ignore repeat overrides (ie: 3G7[16][15], where we just consider the last one).

Original regex

r"""=?(?P<prefix>[a-zA-Z0-9/]+)
      (?:\((?P<cq>\d+)\))?
      (?:\[(?P<itu>\d+)\])?
      (?P<latlong>
          <(?P<lat>[+-]?\d+(?:\.\d+)?)
          \/
          (?P<long>[+-]?\d+(?:.\d+)?)>
      )?
      (?:\{(?P<continent>\w+)\})?
      (?:~(?P<tz>[+-]?\d+(?:\.\d+)?)~)?"""

Railroad diagram

Fixed(?) regex

r"""=?(?P<prefix>[a-zA-Z0-9/]+)
      (?:
        (?:\((?P<cq>\d+)\))
        | (?:\[(?P<itu>\d+)\])
        | (?P<latlong>
            <(?P<lat>[+-]?\d+(?:\.\d+)?)
            \/
            (?P<long>[+-]?\d+(?:.\d+)?)>
        )
        | (?:\{(?P<continent>\w+)\})
        | (?:~(?P<tz>[+-]?\d+(?:\.\d+)?)~)
      )*"""

iRailroad diagram

The main problem is that the regex complexity then jumps upwards dramatically

@classabbyamp
Copy link
Member

oof damn. good catch

@0x5c
Copy link
Member Author

0x5c commented Nov 25, 2019

We need to choose how we approach this.

Note on the "fixed" regex: it's unclear how it would handle a case where multiple overrides of the same types are present for a since call/prefix.

@0x5c 0x5c added the question Further information is requested label Nov 25, 2019
@0x5c
Copy link
Member Author

0x5c commented Nov 25, 2019

Other question: Do we decide of that before or after release of 2.0.0?

@classabbyamp
Copy link
Member

I think decide later

@0x5c 0x5c removed this from the 2.0.0 Release milestone Nov 25, 2019
@classabbyamp classabbyamp modified the milestone: 2.0.0 Release Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants