Skip to content

Commit

Permalink
feat: highlight builtin pikchr constants
Browse files Browse the repository at this point in the history
  • Loading branch information
senyai committed Mar 25, 2024
1 parent dea3149 commit f7d14e8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ resources/icons/*-light
/coverage
*.js
package-lock.json
*.pdf
*.gv
8 changes: 6 additions & 2 deletions pikchr/pikchr.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
]
},
"basetype-classname": {
"begin": "(?<=^|;|:)\\s*(?:\\b(arc|arrow|box|circle|cylinder|diamond|dot|ellipse|file|line|move|oval|spline|text)\\b|(\".*\"))\\s*",
"begin": "(?<=^|;|:|{)\\s*(?:\\b(arc|arrow|box|circle|cylinder|diamond|dot|ellipse|file|line|move|oval|spline|text)\\b|(\".*\"))\\s*",
"beginCaptures": {
"1": {
"name": "storage.type.class.pikchr"
Expand Down Expand Up @@ -393,13 +393,17 @@
},
"boolproperty": {
"comment": "Properties with no argument",
"match": "(<->|<-|->)|\\b(cw|ccw|invis(ible)?|thick|thin|solid|same|chop|fit)\\b\\s*",
"match": "(<->|<-|->)|\\b(cw|ccw|invis(ible)?|thick|thin|solid|same|chop|fit)\\b|(&(?:larr|leftarrow|leftrightarrow|rarr|rightarrow);)\\s*",
"captures": {
"1": {
"name": "entity.name.tag.pikchr"
},
"2": {
"name": "entity.name.tag.pikchr"
},
"4": {
"comment": "obscure pikchr constants",
"name": "entity.name.tag.pikchr"
}
}
},
Expand Down
8 changes: 8 additions & 0 deletions pikchr/test/advanced.test.pikchr
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,11 @@ box "expr" fit with .w at 1.75*$h below BTW.w
// ^^^ variable.language.pikchr
// ^ punctuation.separator.period.pikchr
// ^ entity.name.class.pikchr

define square { box ht $7 wid $8 $9 }
// <------ keyword.control.directive.define.pikchr
// ^^^^^^ variable.language.pikchr
// ^ punctuation.section.block.begin.bracket.curly.pikchr
// ^^^ storage.type.class.pikchr
// ^^ ^^^ support.constant.property-value.pikchr
// ^^ ^^ ^^ variable.language.pikchr
15 changes: 15 additions & 0 deletions pikchr/test/boolproperty.test.pikchr
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,18 @@ cylinder same
box same;
// <--- storage.type.class.pikchr
// ^^^^ source.pikchr entity.name.tag.pikchr

arrow &rarr;
// ^^^^^^ entity.name.tag.pikchr

arrow &rightarrow;
// ^^^^^^^^^^^^ entity.name.tag.pikchr

arrow &larr;
// ^^^^^^ entity.name.tag.pikchr

arrow &leftarrow;
// ^^^^^^^^^^^ entity.name.tag.pikchr

arrow &leftrightarrow;
// ^^^^^^^^^^^^^^^^ entity.name.tag.pikchr

0 comments on commit f7d14e8

Please sign in to comment.