Hi everyone,
I'm trying to find the formal\acceptable method for finding patterns within a group of otherwise unimportant information. For example to find ${i} within a string, where n is some integer.
The grammar looks quite verbose:
Pattern
= (Plain Integer Plain)*
Plain
= $(!'${'.)* { return "<String>" }
Integer
= '${' v:$([0-9]+) '}' { return parseInt(v, 10); }
Which for the input:
[
[
"<String>",
1,
"<String>"
],
[
"<String>",
2,
"<String>"
],
[
"<String>",
3,
"<String>"
]
]
Where as this would be far more preferable:
[
"<String>",
1,
"<String>",
2,
"<String>",
3,
"<String>"
]
Any and all suggestions are welcome.