PistonDevelopers / meta

A DSL parsing library for human readable text documents
MIT License
89 stars 5 forks source link

Read pattern as string #310

Open bvssvni opened 8 years ago

bvssvni commented 8 years ago

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

Examples of usage:

bvssvni commented 7 years ago

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

// sequence
[a b c]:"foo"
// select
{a b c}:"foo"
bvssvni commented 7 years ago

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 commented 7 years ago

Another idea is to pass it to another rule.