Skip to content

Commit

Permalink
Initial Push
Browse files Browse the repository at this point in the history
Bioblaze committed Dec 19, 2024
0 parents commit 0acc220
Showing 18 changed files with 587 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set default behavior to automatically normalize line endings.
* text=auto
90 changes: 90 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build and Release VSIX

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install vsce
run: npm install -g @vscode/vsce

- name: Install dependencies
run: npm install

- name: Determine Version Bump
id: version
run: |
$comment = "${{ github.event.head_commit.message }}"
if ($comment -match "#major") {
echo "bumpType=major" >> $GITHUB_OUTPUT
} elseif ($comment -match "#minor") {
echo "bumpType=minor" >> $GITHUB_OUTPUT
} else {
echo "bumpType=patch" >> $GITHUB_OUTPUT
}
- name: Execute Update Script
id: update
run: |
$DebugInfo = @()
$DebugInfo += "Executing update.ps1 with VersionType=${{ steps.version.outputs.bumpType }}"
$result = pwsh ./scripts/update.ps1 -VersionType ${{ steps.version.outputs.bumpType }}
echo "version=$result" >> $GITHUB_OUTPUT
echo "$DebugInfo" >> $GITHUB_STEP_SUMMARY
shell: pwsh

- name: Validate Version Output
id: validate
run: |
$version = "${{ steps.update.outputs.version }}"
echo "Validating version: $version" >> $GITHUB_STEP_SUMMARY
if ($version -notmatch "^\d+\.\d+\.\d+$") {
Write-Error "Invalid version format: $version"
exit 1
}
echo "newVersion=$version" >> $GITHUB_OUTPUT
- name: Build VSIX file
run: |
vsce package --out dist/blazium-anko-extension-${{ steps.validate.outputs.newVersion }}.vsix
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: blazium-anko-extension-vsix
path: dist/blazium-anko-extension-${{ steps.validate.outputs.newVersion }}.vsix

release:
needs: build
runs-on: windows-latest

steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: blazium-anko-extension-vsix

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.validate.outputs.newVersion }}
release_name: Blazium Anko Extension v${{ steps.validate.outputs.newVersion }}
draft: false
prerelease: false
files: dist/blazium-anko-extension-${{ steps.validate.outputs.newVersion }}.vsix
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist/*.vsix
node_modules
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Anko Extension",
"type": "extensionHost",

"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/anko"
]
},
{
"name": "Reload Anko Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/anko",
"--disable-extensions"
]
}
]
}
58 changes: 58 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Package Anko Extension",
"type": "shell",
"command": "vsce",
"args": [
"package",
"--allow-missing-repository",
"--out",
"${workspaceFolder}/dist/blazium-anko-extension-0.1.0.vsix"
],
"options": {
"cwd": "${workspaceFolder}/anko"
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Packages the Anko extension into a .vsix file and places it in the 'dist' folder."
},
{
"label": "Install Anko Extension",
"type": "shell",
"command": "code",
"args": [
"--install-extension",
"${workspaceFolder}/dist/blazium-anko-extension-0.1.0.vsix"
],
"problemMatcher": [],
"detail": "Installs the packaged Anko extension from the 'dist' folder."
},
{
"label": "Reload Anko Extension",
"type": "shell",
"command": "code",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/anko",
"--disable-extensions"
],
"problemMatcher": [],
"detail": "Reloads the Anko extension for development."
},
{
"label": "Uninstall Anko Extension",
"type": "shell",
"command": "code",
"args": [
"--uninstall-extension",
"blazium-engine.anko"
],
"problemMatcher": [],
"detail": "Uninstalls the Anko extension from VS Code."
}
]
}
4 changes: 4 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MIT
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is the Blazium Anko Syntax Highlighter cause we need one..

I do this for Dragos!


ALL HAIL THE GREAT DRAGOS~
9 changes: 9 additions & 0 deletions anko/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "anko" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
1 change: 1 addition & 0 deletions anko/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MIT
6 changes: 6 additions & 0 deletions anko/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is the Blazium Anko Syntax Highlighter cause we need one..

I do this for Dragos!


ALL HAIL THE GREAT DRAGOS~
59 changes: 59 additions & 0 deletions anko/language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"comments": {
"lineComment": "//",
"blockComment": ["/*", "*/"]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "\"", "close": "\"" },
{ "open": "'", "close": "'" }
],
"surroundingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "\"", "close": "\"" },
{ "open": "'", "close": "'" }
],
"indentationRules": {
"increaseIndentPattern": ".*\\{[^}\"']*$",
"decreaseIndentPattern": "^\\s*\\}"
},
"folding": {
"markers": {
"start": "^\\s*//\\s*#region\\b",
"end": "^\\s*//\\s*#endregion\\b"
}
},
"wordPattern": "[a-zA-Z_][a-zA-Z0-9_]*",
"onEnterRules": [
{
"beforeText": "^(\\s*(?:if|while|for|func|else|switch|case|default).*\\{)[^}]*$",
"action": {
"indent": "indent",
"appendText": ""
}
},
{
"beforeText": "^\\s*\\}",
"action": {
"indent": "indent",
"appendText": ""
}
},
{
"beforeText": "^#!(anko|blazium-anko)",
"action": {
"indent": "none"
}
}
]

}
36 changes: 36 additions & 0 deletions anko/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "anko",
"displayName": "Blazium Anko",
"description": "Syntax highlighting for Blazium\u0027s Flavor of Anko",
"publisher": "blazium-engine",
"version": "0.0.2",
"engines": {
"vscode": "^1.92.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [
{
"id": "blazium-anko",
"aliases": [
"Blazium Anko",
"blazium-anko"
],
"extensions": [
".anko",
".blazium-anko"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "blazium-anko",
"scopeName": "source.anko",
"path": "./syntaxes/blazium-anko.tmLanguage.json"
}
]
}
}
97 changes: 97 additions & 0 deletions anko/syntaxes/blazium-anko.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Blazium Anko",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"include": "#variables"
},
{
"include": "#parentheses"
},
{
"include": "#functions"
},
{
"include": "#comments"
},
{
"include": "#shebang"
}
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.control.blazium-anko",
"match": "\\b(if|while|for|return|func)\\b"
}
]
},
"strings": {
"name": "string.quoted.double.blazium-anko",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.blazium-anko",
"match": "\\\\."
}
]
},
"variables": {
"patterns": [
{
"name": "variable.other.blazium-anko",
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
}
]
},
"parentheses": {
"patterns": [
{
"name": "punctuation.definition.parentheses.blazium-anko",
"match": "[\\(\\)]"
}
]
},
"functions": {
"patterns": [
{
"name": "entity.name.function.blazium-anko",
"match": "\\b(func)\\s+[a-zA-Z_][a-zA-Z0-9_]*"
}
]
},
"comments": {
"patterns": [
{
"name": "comment.line.double-slash.blazium-anko",
"begin": "//",
"end": "(?=\\n)",
"patterns": []
},
{
"name": "comment.block.blazium-anko",
"begin": "/\\*",
"end": "\\*/",
"patterns": []
}
]
},
"shebang": {
"patterns": [
{
"name": "comment.line.shebang.blazium-anko",
"match": "^#!anko|^#!blazium-anko"
}
]
}
},
"scopeName": "source.anko"
}
29 changes: 29 additions & 0 deletions anko/vsc-extension-quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Welcome to your VS Code Extension

## What's in the folder

* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
* `syntaxes/blazium-anko.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.

## Get up and running straight away

* Make sure the language configuration settings in `language-configuration.json` are accurate.
* Press `F5` to open a new window with your extension loaded.
* Create a new file with a file name suffix matching your language.
* Verify that syntax highlighting works and that the language configuration settings are working.

## Make changes

* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.

## Add more language features

* To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs

## Install your extension

* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.
Empty file added dist/.keep
Empty file.
104 changes: 104 additions & 0 deletions examples/script.anko
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!anko

// Importing standard libraries
fmt = import("fmt") // For printing to the console
rand = import("math/rand") // For random number generation

// Function: Demonstrates function definition
func example_function() {
// Variables: Demonstrates variable declaration and assignment
greeting = "Hello, World!" // String variable
number = 42 // Integer variable
pi = 3.14 // Float variable
isAnkoFun = true // Boolean variable

fmt.Println(greeting) // Print a string
fmt.Println("The answer is:", number) // Print multiple values
fmt.Println("Value of pi:", pi)
fmt.Println("Is Anko fun?", isAnkoFun)
}

// Arrays: Demonstrates array usage
func example_array() {
colors = ["Red", "Green", "Blue"] // Array of strings
for color in colors { // Looping through an array
fmt.Println("Color:", color)
}
}

// Maps: Demonstrates map usage
func example_map() {
scores = { "Alice": 90, "Bob": 85 } // Map with string keys and integer values
fmt.Println("Alice's score:", scores["Alice"])

scores["Charlie"] = 95 // Adding a new key-value pair
for name, score in scores { // Iterating over a map
fmt.Println(name, "scored", score)
}
}

// Conditionals: Demonstrates if-else statements
func example_conditionals(number) {
if number > 0 {
fmt.Println("The number is positive.")
} else if number < 0 {
fmt.Println("The number is negative.")
} else {
fmt.Println("The number is zero.")
}
}

// Loops: Demonstrates for loops
func example_loops() {
for i = 1; i <= 5; i++ { // Simple for loop
fmt.Println("Number:", i)
}

// While loop using a for construct
counter = 0
for counter < 3 {
fmt.Println("Counter:", counter)
counter += 1
}
}

// Random Numbers: Demonstrates usage of the math/rand library
func example_random() {
rand.Seed(42) // Seeding the random number generator
randomNum = rand.Intn(100) // Random number between 0 and 99
fmt.Println("Random number:", randomNum)
}

// Functions with parameters and return values
func add_numbers(a, b) {
return a + b // Return the sum of two numbers
}

// Example of calling all the structures
func main() {
fmt.Println("=== Variables ===")
example_function()

fmt.Println("=== Arrays ===")
example_array()

fmt.Println("=== Maps ===")
example_map()

fmt.Println("=== Conditionals ===")
example_conditionals(5)
example_conditionals(0)

fmt.Println("=== Loops ===")
example_loops()

fmt.Println("=== Random Numbers ===")
example_random()

fmt.Println("=== Function with Return ===")
result = add_numbers(10, 20)
fmt.Println("Sum of 10 and 20 is:", result)
}

// Call the main function
main()
60 changes: 60 additions & 0 deletions scripts/update.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Requires PowerShell 5.0+
param (
[Parameter(Mandatory=$true)]
[ValidateSet("major", "minor", "patch")]
[string]$VersionType
)

# Path to package.json
$PackageJsonPath = "./anko/package.json"

# Check if package.json exists
if (-Not (Test-Path -Path $PackageJsonPath)) {
Write-Error "package.json not found at path: $PackageJsonPath"
exit 1
}

# Read package.json
$PackageData = Get-Content -Path $PackageJsonPath -Raw | ConvertFrom-Json

# Ensure version field exists
if (-Not $PackageData.version) {
Write-Error "No version field found in package.json"
exit 1
}

# Parse version into major, minor, and patch
$VersionParts = $PackageData.version -split '\.'
if ($VersionParts.Count -ne 3) {
Write-Error "Invalid version format in package.json. Expected format: major.minor.patch"
exit 1
}

[int]$Major = $VersionParts[0]
[int]$Minor = $VersionParts[1]
[int]$Patch = $VersionParts[2]

# Increment version based on input
switch ($VersionType) {
"major" {
$Major++
$Minor = 0
$Patch = 0
}
"minor" {
$Minor++
$Patch = 0
}
"patch" {
$Patch++
}
}

# Update the version field
$PackageData.version = "$Major.$Minor.$Patch"

# Write updated package.json back to file
$PackageData | ConvertTo-Json -Depth 10 | Set-Content -Path $PackageJsonPath

# Output the new version
Write-Output $PackageData.version

0 comments on commit 0acc220

Please sign in to comment.