BenjaminSchaaf / sbnf

A BNF-style language for writing sublime-syntax files
MIT License
58 stars 6 forks source link

Allow unquoted CLAUSES as scope names #41

Open eugenesvk opened 1 year ago

eugenesvk commented 1 year ago

Given the mandate of UPPERCASE for the vars, these should add more benefits - like allowing using them within{scope} without having to {#[INTERPOLATE]}

main : ( ~( foo
          | bar
       )  )*
     ;
FOO='meFOO'
BAR='meBAR'
foo : 'foo'{FOO} ; # ← this should work the same as
bar : 'bar'{#[BAR]} ;     # ← this
BenjaminSchaaf commented 1 year ago

Unfortunately this doesn't quite work because variables are required to be ASCII uppercase, but not unicode uppercase. (This is due to case not actually being meaningful in some languages) So something like 'a'{CLAUSé} would be ambiguous as to whether it's interpolating like 'a'{#[CLAUS]é} or 'a'{#[CLAUSé]}.