The 'isMethod' support in SmaCC regular expressions isn't clear to me.
These two sources essentially say the same thing
- https://files.pharo.org/books-pdfs/booklet-Smacc/2017-10-29-Smacc.pdf
- http://www.refactoryworkers.com/SmaCC/Scanner.html
<isMethod> Copies the characters where Character>>isMethod returns true into
the current regular expression. For example, instead of using \d, we could use
<isDigit> since Character>>isDigit returns true for digits.
There isn't much to go on, so I have a few questions:
- Does this mean I can use isWhitespace, isNotWhitespace etc. ? (How do I know the names?)
- Does this mean I can use my own tokens? (like isVariable, isMultiLineComment if I define these?)
- Are there some good places for me to better understand this?
Thanks for your time
The comment could admittedly be a little clearer, but starting from its example -
#isDigit
- there is only one implementor in the image:Character
. Thus, the likely meaning is that you can put any message whichCharacter
understands between the brackets.To answer your specific questions:
You can't use
#isWhitespace
because there is no such message, but#isSeparator
seems to do thatYou learn the available names by exploring
Character
e.g. in the browser.Yes, you can use your own tokens by implementing them in
Character
(or its superclasses)As @Stephan Eggermont suggested, GT's Discord is a good place to ask. Pharo MLs and Discord are generally helpful, and a question like this would likely easily be answered there, but as you dive deeper into Smacc, you'll find fewer experts and the GT community currently uses Smacc heavily.