pegn-spec
pegn-spec copied to clipboard
Insignificant Definitions
I would like to open a discussion about the insignificant PEGN definitions such as ScanDef
, ClassDef
and TokenDef
.
https://github.com/pegn/spec/blob/4266ea7a5ae3d6540b534e0d07b91428f0f53485/grammar.pegn#L28-L32
Q: Why would I use ClassDef
and TokenDef
?
TOKEN <- '?'
class <- '?'
Scan <- '?'
All the previous definitions are the same. They only have different restrictions:
TokenDef
A sequence of token values. https://github.com/pegn/spec/blob/4266ea7a5ae3d6540b534e0d07b91428f0f53485/grammar.pegn#L37
ClassDef
An alternation of simple values. https://github.com/pegn/spec/blob/4266ea7a5ae3d6540b534e0d07b91428f0f53485/grammar.pegn#L54-L55
ScanDef
Can do anything.