Hi
I am creating a grammar for a language in which users can create their own ‘commands’; to handle this users can prefix the command definition with the text “define!” and when they use the command they have to prefix it with “myblock!”. In the grammar I have create the following rules (this is an excerpt but contains all the associated rules and tokens):
Myblock {
custom { Directive MyBlockDefinition }
}
Field { ( “(” Phrase “)” | “<” Phrase “>” ) }
Directive {
(“define”|“myblock”) “!”
}
MyBlockDefinition { Phrase (Field Phrase?)* }
@tokens {
char { @asciiLetter | $[_\u{a1}-\u{10ffff}] }
word { (@digit | char)+ }
Phrase { word (" " word)* }
}
Using a styleTags in the props option for parser.configure I am able to style the Directive but not the MyBlockDefinition. Below is the result of parser.parse(“define!create asteroids (num)”).toString()
Script(Myblock(Directive,MyBlockDefinition(Phrase,Field(Phrase))))
Script is defined in the @top
I have a custom tag defined “myblock: Tag.define()”
And in Highlights.define([ {tag: myblock, color: “#501C21”}, …
And in the parser.configure in the styleTags in the props I have:
MyBlockDefinition: myblock
Should I be able to style MyBlockDefinition? As I said the “define!” highlights correctly. Failing that is there anyway to style a Phrase that is contained in a MyBlockDefinition?