I am making a basic JS-like programming language as a side project, with the exception being that it is statically typed (rather similar to TypeScript). I am currently implementing classes and OOP inheritance; however, I have come across an mild issue as far as specifying attributes for member methods and properties. For example, say I want to have a method talk() as part of a basic class, and I want to make it const, abstract, and one of either private or public. If I were to implement these three keywords with the slash operator for public/private, like so:
const:'const'? _ abs:'abstract'? _ acc:('public' / 'private')?
Then it is all well and good, with the exception being that one would have to specify the keywords in exactly that order. The only way I can think of as of yet to make the order irrelevant would be to create separate subrules for each placement of the keywords... Obviously less than optimal.
Is there a PEGjs feature I'm missing here, or is there any other way of making dynamic keyword placement work that I'm just not thinking of? Thanks in advance!