Skip to content
New issue

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

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

Already on GitHub? # to your account

Read pattern as string #310

Open
bvssvni opened this issue May 21, 2016 · 3 comments
Open

Read pattern as string #310

bvssvni opened this issue May 21, 2016 · 3 comments

Comments

@bvssvni
Copy link
Member

bvssvni commented May 21, 2016

Sometimes you want to match over a pattern of rules and use it as a string.

Examples of usage:

  • Code generation (part of the syntax rules describe a pattern for another language)
  • Doc comments (follows a pattern but is not processed at the first stage of parsing)
@bvssvni
Copy link
Member Author

bvssvni commented Dec 2, 2016

One idea: Allow meta data on sequence and select rules.

// sequence
[a b c]:"foo"
// select
{a b c}:"foo"

@bvssvni
Copy link
Member Author

bvssvni commented Dec 2, 2016

In the case of comments, this text includes the special characters, so their meaning becomes application specific:

// includes `//` and `/* ... */` in "text".
1 comment = {multi_line_comment ["//" ..."\n"?]}:"text"

@bvssvni
Copy link
Member Author

bvssvni commented Jan 6, 2017

Another idea is to pass it to another rule.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant