I have this code structure:
STRING 1
// possible comment
{
Multi
line
text
}
STRING 2
...
And write this bnf:
{
...
tokens = [
t_lbrace = '{'
t_rbrace = '}'
t_string = "STRING"
t_line_comment="regexp://.*"
t_number='regexp:[1-9]\d*'
t_whitespace = 'regexp:[^\S\r\n]'
t_newline = 'regexp:\n|\r\n'
t_block = 'regexp:\{[\s\S]*?}'
]
}
string_num ::= t_string t_whitespace* t_number t_whitespace* t_newline
block ::= t_block
How to properly organize the file structure?
I searched the Internet and did not find a single normal example of writing your own bnf structure.