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

Forward references aren't validated #84

Open
Aloso opened this issue Mar 17, 2023 · 0 comments
Open

Forward references aren't validated #84

Aloso opened this issue Mar 17, 2023 · 0 comments
Labels
bug Something isn't working C-language Issues regarding Pomsky's syntax good first issue Good for newcomers

Comments

@Aloso
Copy link
Member

Aloso commented Mar 17, 2023

Forward references can only appear within a repeated group that also contains the group the reference refers to. For example:

:first( :second( ::third ) :third() )+

This is ok because both the reference ::third and the referenced group :third() are within the first group, which is repeated.

Describe the bug

Pomsky does not check that forward references fulfill the above criteria. Ruby allows forward references, but fails to compile when they're invalid, so this should be validated by Pomsky as well.

To Reproduce

Compile one of these with Pomsky using the Ruby flavor:

:first( :second( ::third ) :third() ) # no repetition

::third :first( :second() :third() ) # no common parent group

then try to compile the result with Ruby.

Expected behavior

Since Ruby doesn't accept invalid forward references, Pomsky shouldn't either.

@Aloso Aloso added bug Something isn't working good first issue Good for newcomers C-language Issues regarding Pomsky's syntax labels Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working C-language Issues regarding Pomsky's syntax good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant