Skip to content

Commit

Permalink
Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jtran committed Nov 4, 2024
1 parent 457adc6 commit 83d8d2c
Show file tree
Hide file tree
Showing 3 changed files with 314 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# macOS
.DS_Store
298 changes: 298 additions & 0 deletions Syntaxes/kcl.tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>KCL</string>
<key>scopeName</key>
<string>source.kcl</string>
<key>fileTypes</key>
<array>
<string>kcl</string>
</array>
<key>uuid</key>
<string>1ec087d3-5945-49c4-94a0-ce9c757dc153</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.line.double-slash.kcl</string>
<key>match</key>
<string>//.*$</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.conditional.kcl</string>
<key>match</key>
<string>\b(if|else if|else)\b</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.conditional.kcl</string>
<key>match</key>
<string>\b(if|else if|else)\b</string>
</dict>
<dict>
<key>name</key>
<string>keyword.control.return.kcl</string>
<key>match</key>
<string>\breturn\b</string>
</dict>
<dict>
<key>name</key>
<string>keyword.declaration.kcl</string>
<key>match</key>
<string>\b(var|let|const)\b</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.comparison.kcl</string>
<key>match</key>
<string>(==|!=|&lt;=|&gt;=|&lt;|&gt;)</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.definition.kcl</string>
<key>match</key>
<string>=</string>
</dict>
<dict>
<key>name</key>
<string>keyword.module.import.kcl</string>
<key>match</key>
<string>\bimport\b</string>
</dict>
<dict>
<key>name</key>
<string>entity.name.tag.kcl</string>
<key>match</key>
<string>\$\w+\b</string>
</dict>
<dict>
<!-- Named function definition -->
<key>name</key>
<string>meta.function.definition.kcl</string>
<key>begin</key>
<string>\b((export)\s+)?(fn)\s+(\w+)\s*(=)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.modifier.visibility.kcl</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>keyword.control.function.kcl</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>entity.name.function.kcl</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>keyword.operator.definition.kcl</string>
</dict>
</dict>
<key>end</key>
<string>\{</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.block.begin.kcl</string>
</dict>
</dict>
<key>patterns</key>
<array>
<!-- Function parameters -->
<dict>
<key>name</key>
<string>meta.parameters.kcl</string>
<key>begin</key>
<string>\(</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.parameters.begin.kcl</string>
</dict>
</dict>
<key>end</key>
<string>\)</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.parameters.end.kcl</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>variable.parameter.kcl</string>
<key>match</key>
<string>\b\w+\b</string>
</dict>
<dict>
<key>name</key>
<string>punctuation.separator.parameter.function.kcl</string>
<key>match</key>
<string>,</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.fat-arrow.kcl</string>
<key>match</key>
<string>=&gt;</string>
</dict>
</array>
</dict>
<dict>
<!-- Double quoted string -->
<key>name</key>
<string>string.quoted.double.kcl</string>
<key>begin</key>
<string>"</string>
<key>end</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.kcl</string>
</dict>
</dict>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.kcl</string>
</dict>
</dict>
<key>patterns</key>
<array>
<!-- Escape characters -->
<dict>
<key>name</key>
<string>constant.character.escape.kcl</string>
<key>match</key>
<string>\\.</string>
</dict>
</array>
</dict>
<dict>
<!-- Single quoted string -->
<key>name</key>
<string>string.quoted.single.kcl</string>
<key>begin</key>
<string>'</string>
<key>end</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.kcl</string>
</dict>
</dict>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.kcl</string>
</dict>
</dict>
<key>patterns</key>
<array>
<!-- Escape characters -->
<dict>
<key>name</key>
<string>constant.character.escape.kcl</string>
<key>match</key>
<string>\\.</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.control.pipeline.kcl</string>
<key>match</key>
<string>\|></string>
</dict>
<dict>
<key>name</key>
<string>variable.language.pipe-substitution.kcl</string>
<key>match</key>
<string>%</string>
</dict>
<dict>
<key>match</key>
<string>\b(true|false)\b</string>
<key>name</key>
<string>constant.language.kcl</string>
</dict>
<dict>
<key>name</key>
<string>constant.numeric.kcl</string>
<key>match</key>
<string>\b(\d+(\.\d+)?|\.\d+)\b</string>
</dict>
<dict>
<key>name</key>
<string>keyword.operator.arithmetic.kcl</string>
<key>match</key>
<string>[+\-*/^]</string>
</dict>
<dict>
<key>name</key>
<string>support.constant.prelude.kcl</string>
<key>match</key>
<string>\b(ZERO|QUARTER_TURN|HALF_TURN|THREE_QUARTER_TURN)\b</string>
</dict>
<dict>
<key>name</key>
<string>support.function.stdlib.kcl</string>
<key>match</key>
<string>\b(abs|acos|arc|angledLine|angledLineOfXLength|angledLineOfYLength|angledLineThatIntersects|angledLineToX|angledLineToY|angleToMatchLengthX|angleToMatchLengthY|arc|asin|assert|assertEqual|assertGreaterThan|assertGreaterThanOrEq|assertLessThan|assertLessThanOrEq|atan|bezierCurve|ceil|chamfer|circle|close|cm|cos|e|extrude|fillet|floor|ft|getNextAdjacentEdge|getOppositeEdge|getPreviousAdjacentEdge|helix|hole|hollow|import|inch|int|lastSegX|lastSegY|legAngX|legAngY|legLen|line|lineTo|ln|loft|log|log10|log2|m|map|max|min|mirror2d|mm|offetPlane|patternCircular2d|patternCircular3d|patternLinear2d|patternLinear3d|patternTransform|pi|polar|polygon|pow|profileStart|profileStartX|profileStartY|push|reduce|rem|revolve|segAng|segEndX|segEndY|segLen|shell|sin|sqrt|startProfileAt|startSketchAt|startSketchOn|tan|tangentialArc|tangentialArcTo|tangentialArcToRelative|tau|toDegrees|toRadians|xLine|xLineTo|yd|yLine|yLineTo)\b</string>
</dict>
<dict>
<key>name</key>
<string>punctuation.section.array.begin.kcl</string>
<key>match</key>
<string>\[</string>
</dict>
<dict>
<key>name</key>
<string>punctuation.section.array.end.kcl</string>
<key>match</key>
<string>\]</string>
</dict>
<dict>
<key>name</key>
<string>punctuation.separator.kcl</string>
<key>match</key>
<string>:</string>
</dict>
<dict>
<key>name</key>
<string>variable.other.kcl</string>
<key>match</key>
<string>\b(\w+)\b</string>
</dict>
</array>
</dict>
</plist>
14 changes: 14 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>KCL</string>
<key>CFBundleIdentifier</key>
<string>dev.zoo.kcl</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>TMGrammar</key>
<string>Syntaxes/kcl.tmLanguage</string>
</dict>
</plist>

0 comments on commit 83d8d2c

Please sign in to comment.