### Install and Build Civet LSP Packages Source: https://github.com/danielxmoore/civet/blob/main/lsp/README.md Installs all dependencies and builds the server and monaco packages from the repository root. ```bash pnpm install pnpm -C lsp/server build pnpm -C lsp/monaco build ``` -------------------------------- ### Install Dependencies Source: https://github.com/danielxmoore/civet/blob/main/integration/eslint/README.md Install the Civet ESLint plugin, Civet, ESLint, and optionally typescript-eslint. This command is for development or project setup. ```sh npm install -D eslint-plugin-civet @danielxmoore/civet eslint @eslint/js typescript-eslint ``` -------------------------------- ### Install Dependencies and Build Civet Source: https://github.com/danielxmoore/civet/blob/main/CONTRIBUTING.md Standard commands to install project dependencies and build the Civet compiler. Ensure you have pnpm installed. ```sh pnpm install pnpm build ``` -------------------------------- ### Start Local Development Server Source: https://github.com/danielxmoore/civet/blob/main/integration/unplugin-examples/astro/README.md Starts a local development server for previewing your Astro site during development. Accessible at localhost:3000. ```bash npm run dev ``` -------------------------------- ### Install Dependencies and Generate Parser Source: https://github.com/danielxmoore/civet/blob/main/lsp/tree-sitter/README.md Navigate to the tree-sitter directory, install dependencies using pnpm, and then run the generate script to create the parser. ```bash cd lsp/tree-sitter pnpm install pnpm run generate ``` -------------------------------- ### Install and Run Civet CLI Source: https://github.com/danielxmoore/civet/blob/main/README.md Commands for installing Civet globally, running its REPL, transpiling code, and executing Civet scripts. ```bash npm install -g @danielx/civet civet civet -c civet < source.civet > output.ts civet source.civet ...args... node --import @danielx/civet/register source.civet npm install -g typescript civet --typecheck ``` -------------------------------- ### Configure Neovim for Civet LSP Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/integrations.md Set up Neovim to recognize Civet files and start the Civet language server. Ensure the path to the server is correct for your installation. ```lua vim.filetype.add({ extension = { civet = "civet" } }) vim.api.nvim_create_autocmd("FileType", { pattern = "civet", callback = function(args) vim.lsp.start({ name = "civet_lsp", cmd = { "node", "/path/to/civet/lsp/server/dist/node.js", "--stdio" }, root_dir = vim.fs.root(args.file, { "tsconfig.json", "package.json", ".git" }) or vim.fn.getcwd(), }) end, }) ``` -------------------------------- ### Run Development Server Source: https://github.com/danielxmoore/civet/blob/main/integration/unplugin-examples/nextjs/README.md Commands to start the Next.js development server. ```bash npm run dev # or pnpm dev ``` -------------------------------- ### Install Dependencies Source: https://github.com/danielxmoore/civet/blob/main/integration/unplugin-examples/astro/README.md Installs all the necessary dependencies for your Astro project. ```bash npm install ``` -------------------------------- ### Install Dependencies Source: https://github.com/danielxmoore/civet/blob/main/lsp/vscode/CONTRIBUTING.md Installs project dependencies using pnpm from the repository root. ```bash pnpm install ``` -------------------------------- ### Install Civet Language Server for Zed Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/integrations.md Install the Civet language server globally using npm. This is required for Zed's LSP integration. ```bash npm install -g @danielx/civet-language-server ``` -------------------------------- ### Install Civet Globally Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/getting-started.md Install Civet globally for command-line usage, enabling the 'civet' command. ```sh npm i -g @danielx/civet ``` -------------------------------- ### Example Hera Transpiler Plugin for Civet Source: https://github.com/danielxmoore/civet/blob/main/lsp/vscode/README.md This JavaScript example demonstrates how to create a custom transpiler plugin for Civet using Hera. It specifies the file extension, target output, and the compilation logic. ```javascript import Hera from "@danielx/hera" const { compile: heraCompile } = Hera export default { transpilers: [{ extension: ".hera", target: ".cjs", compile: function (path, source) { const code = heraCompile(source, { filename: path, }) return { code } } }], } ``` -------------------------------- ### Static Block Initialization in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates the use of a static block for asynchronous initialization or setup within a class. ```civet class Civet @ try this.colors = getCivetColors() ``` -------------------------------- ### Compile Civet files with Gulp Source: https://github.com/danielxmoore/civet/blob/main/integration/gulp/README.md This snippet shows the basic setup for compiling .civet files to JavaScript using gulp-civet. Ensure you have gulp-civet and Civet installed. ```javascript const civet = require('gulp-civet'); gulp.task('civet', () => { gulp.src('./src/*.civet') .pipe(civet({ extension: '.js', js: true, }) .pipe(gulp.dest('./dist')); }); ``` -------------------------------- ### Install Civet Tree-sitter Grammar in Neovim Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/integrations.md After registering the Civet tree-sitter grammar, install it using the Neovim tree-sitter plugin command. ```vim :TSInstall civet ``` -------------------------------- ### JSON Configuration for Parse Options Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Example of a JSON configuration file specifying parse options for Civet. ```json { "parseOptions": { "objectIs": true, "implicitReturns": false, "tab": 2 } } ``` -------------------------------- ### JSON Configuration with tsConfig Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Example of a JSON configuration file including tsConfig for compiler options. ```json { "tsConfig": { "compilerOptions": { "target": "es2020", "strict": true }, "include": ["src"], "exclude": ["dist"] } } ``` -------------------------------- ### Civet Plugin Configuration Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Example of configuring the Civet unplugin with parse options. ```javascript civetPlugin({ parseOptions: { objectIs: true, implicitReturns: false, tab: 2, }, }) ``` -------------------------------- ### Getters and Setters in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Provides examples of defining getter and setter methods for class properties. ```civet class C get x @coords?.x ?? 0 set x(newX) @moveTo newX, @coords.y ``` -------------------------------- ### JSON Configuration for Array Options Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Example of a JSON configuration file specifying array-based parse options like globals and operators. ```json { "parseOptions": { "globals": ["React", "JSX"], "operators": ["min", "max"] } } ``` -------------------------------- ### Civet Compile API Configuration Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Example of using the Civet compile API with parse options. ```javascript import {compile} from "@danielx/civet" const code = await compile(civetCode, { parseOptions: { objectIs: true, implicitReturns: false, tab: 2, }, }) ``` -------------------------------- ### Get Help with Astro CLI Source: https://github.com/danielxmoore/civet/blob/main/integration/unplugin-examples/astro/README.md Displays help information for using the Astro CLI and its various commands. ```bash npm run astro -- --help ``` -------------------------------- ### CoffeeHereCommentStart Syntax Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/public/railroad.html Defines the syntax for the start of a 'here-comment' in CoffeeScript. ```regex /###(?!#)/ ``` -------------------------------- ### Build Civet project with esbuild Source: https://github.com/danielxmoore/civet/blob/main/README.md Integrate the Civet esbuild plugin to build your Civet project. This example shows how to import esbuild and the Civet plugin, and configure the build process. ```javascript import esbuild from 'esbuild' import civetPlugin from '@danielx/civet/esbuild' esbuild.build({ ..., plugins: [ civetPlugin({ ts: 'preserve' }) ] }).catch(() => process.exit(1)) ``` -------------------------------- ### Rule with Reference Body Source: https://github.com/danielxmoore/civet/blob/main/lsp/tree-sitter-hera/test/corpus/tokens.txt Defines a rule 'Start' that references another rule 'Greeting' and shows its parsed structure. ```Hera Start Greeting ``` ```Hera (program (newline) (identifier) (newline) (identifier) (newline)) ``` -------------------------------- ### JSON Configuration for Operator Object Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Example of a JSON configuration file specifying operator behavior using an object. ```json { "parseOptions": { "operators": { "dot": "looser (*)", "mult": "arguments tighter (+)", "normal": "" } } } ``` -------------------------------- ### Civet CLI Configuration Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Examples of using the Civet CLI to specify directives, config files, or disable config files. ```bash # Specify a directive civet --civet "objectIs -implicit-returns tab=2" ... # Specify a config file civet --config custom-config.civet ... # Disable config files civet --no-config ... ``` -------------------------------- ### Class Extension in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Basic example of class inheritance using the 'extends' keyword. ```civet class Civet < Animal ``` -------------------------------- ### Custom Civet LSP Provider Client Implementation Source: https://github.com/danielxmoore/civet/blob/main/lsp/monaco/README.md This example shows how to manually implement the client adapter for `registerCivetLspProviders` when you have an existing JSON-RPC client. This provides explicit control over each LSP request. ```typescript const uri = model.uri.toString() registerCivetLspProviders(monaco, { uri, model, client: { semanticTokensFull: () => jsonRpc.sendRequest('textDocument/semanticTokens/full', { textDocument: { uri }, }), hover: (position) => jsonRpc.sendRequest('textDocument/hover', { textDocument: { uri }, position, }), definition: (position) => jsonRpc.sendRequest('textDocument/definition', { textDocument: { uri }, position, }), completion: (params) => jsonRpc.sendRequest('textDocument/completion', { textDocument: { uri }, ...params, }), completionResolve: (item) => jsonRpc.sendRequest('completionItem/resolve', item), }, }) ``` -------------------------------- ### Verify Civet Setup in Helix Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/integrations.md Check the Civet integration with Helix to ensure that syntax highlighting and LSP features are working correctly. ```shell hx --health civet ``` -------------------------------- ### Dynamic Import without Parentheses Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Shows how dynamic imports can be used without parentheses when not at the start of a statement. ```civet {x} = await import url ``` -------------------------------- ### Standard JavaScript/TypeScript Operators Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Provides examples of common arithmetic, assignment, and type-checking operators. ```civet center := min + length / 2 name := user?.name ?? defaultName typeof x === "string" && x += "!" result! as string | number ``` -------------------------------- ### Implicit Element Syntax Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Shows how to define elements implicitly using shorthand for IDs or classes. Requires '#' or '.' at the start. ```civet <.foo>Civet ``` ```civet "civet defaultElement=span" <.foo>Civet ``` -------------------------------- ### Civet Config Module API Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Examples of using the Civet config module to find and load configuration files. ```javascript import { findInDir, findConfig, loadConfig } from "@danielx/civet/config" // Look for standard name for config file in specified directory const path1 = await findInDir(process.cwd()) // Look for standard name for config file in specified directory or ancestors const path2 = await findConfig(process.cwd()) // Load config file from specified path const config = await loadConfig(path) // Pass config to compile const code = await compile(civetCode, config) ``` -------------------------------- ### Build and Publish Civet Packages Source: https://github.com/danielxmoore/civet/blob/main/CONTRIBUTING.md The build workflow triggers the publish workflow, which installs dependencies, builds the project, and conditionally publishes packages based on version checks. ```sh pnpm install --frozen-lockfile && pnpm build ``` ```sh bash build/autorelease.sh . lsp/server lsp/monaco ``` -------------------------------- ### Run Civet REPL Interactively Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/getting-started.md Use this command to start an interactive command-line REPL for transpiling Civet code. ```sh npx @danielx/civet -c ``` -------------------------------- ### Configure Civet with Directives Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/config.md Use a "civet" directive at the top of a file to specify configurations. This example disables implicit returns and sets tab width to 2 spaces. ```javascript "civet objectIs -implicit-returns tab=2" ``` -------------------------------- ### Mixin Application in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Example of applying a mixin function to a base class using the 'with' keyword. ```civet function Movable(C) class extends C move(@x, @y) class Civet extends Animal with Movable @() @move 0, 0 ``` -------------------------------- ### Install Civet as a Dev Dependency Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/getting-started.md Add the Civet package as a development dependency to your project using npm. ```sh npm i -D @danielx/civet ``` -------------------------------- ### Integrate Civet with esbuild Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/getting-started.md Configure esbuild to use the Civet plugin for transpiling Civet files. This example shows basic integration and comments on available options for the plugin. ```js import esbuild from 'esbuild' import civetPlugin from '@danielx/civet/esbuild' esbuild.build({ // ... // sourcemap: true, // build and link sourcemap files plugins: [ civetPlugin({ // Options and their defaults: // emitDeclaration: false, // generate .d.ts files? // declarationExtension: '.civet.d.ts', // extension for .d.ts files // implicitExtension: true, // import "./x" checks for x.civet // outputExtension: '.tsx', // appended to .civet internally // ts: 'civet', // TS -> JS transpilation mode // typecheck: false, // check types via tsc // cache: true, // cache compilation results based on mtime, useful for watch // config: null, // Civet config filename; null to skip // parseOptions: { // directives to apply globally // comptime: false, // evaluate comptime blocks // }, }) ] }).catch(() => process.exit(1)) ``` -------------------------------- ### Using Control Flow in Pipelines Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates how to incorporate `await`, `throw`, `yield`, `yield*`, or `return` directly within a pipeline. ```civet fetch url |> await |> .json() |> await |> return ``` -------------------------------- ### Simple Usage with ESLint and JavaScript (CJS) Source: https://github.com/danielxmoore/civet/blob/main/integration/eslint/README.md Configure ESLint to lint Civet files as JavaScript using CJS. This setup enables ESLint's recommended rules. ```js module.exports = [ ...require("eslint-plugin-civet").configs.recommended ] ``` -------------------------------- ### Build Civet Language Server from Source Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/integrations.md Build the Civet language server from its source code repository. This is necessary if you are using a local copy of the Civet repository. ```bash cd lsp/server && pnpm build ``` -------------------------------- ### TypeScript Configuration for Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/getting-started.md Example tsconfig.json for enabling TypeScript type checking with Civet, including specific compiler and ts-node options. ```json { "compilerOptions": { "strict": true, "jsx": "preserve", "lib": ["es2021"], "moduleResolution": "bundler", "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "esModuleInterop": true }, "ts-node": { "transpileOnly": true, "compilerOptions": { "module": "nodenext" } } } ``` -------------------------------- ### Simple Usage with ESLint and JavaScript (ESM) Source: https://github.com/danielxmoore/civet/blob/main/integration/eslint/README.md Configure ESLint to lint Civet files as JavaScript using ESM. This setup enables ESLint's recommended rules. ```js import civetPlugin from "eslint-plugin-civet" export default [ ...civetPlugin.configs.recommended ] ``` -------------------------------- ### Building Functions with '&' Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Shows how to construct functions using the '&' prefix for use within pipelines, allowing for inline function definitions. ```civet & |> .toString |> console.log ``` ```civet &: number |> (+ 1) |> (* 2) |> Math.round ``` -------------------------------- ### CoffeeScript Range Literals Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Illustrates range literals `[start...end]` and `[start..end]` in CoffeeScript for creating sequences, supported in Civet. ```coffeescript [0...10] ``` ```coffeescript [a..b] ``` ```coffeescript [x - 2 .. x + 2] ``` -------------------------------- ### Generate tree-sitter-hera Parser Source: https://github.com/danielxmoore/civet/blob/main/lsp/tree-sitter-hera/README.md Commands to install dependencies and generate the parser for the tree-sitter-hera grammar. The generated parser file is committed alongside the grammar definition. ```bash cd lsp/tree-sitter-hera pnpm install pnpm run generate ``` -------------------------------- ### Create Astro Project Source: https://github.com/danielxmoore/civet/blob/main/integration/unplugin-examples/astro/README.md Use this command to create a new Astro project with the minimal template. ```bash npm create astro@latest -- --template minimal ``` -------------------------------- ### Display Civet CLI Help Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/getting-started.md Show all available command-line options for the Civet transpiler. ```sh civet --help ``` -------------------------------- ### Implicit Return Examples in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/comparison.md Demonstrates Civet's implicit return feature for functions. The last statement's value is returned unless a semicolon, void return type, or explicit return is used. ```typescript function more(x) { x+1 } ``` ```typescript function hello() { console.log("Hello world!") } ``` ```typescript function hello() { console.log("Hello world!"); } ``` ```typescript function hello(): void { console.log("Hello world!") } ``` ```typescript function hello() { console.log("Hello world!") return } ``` -------------------------------- ### Multi Assignment Operators Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Shows examples of incrementing, decrementing, and multiplying with late assignment. ```civet (count[key] ?= 0)++ (count[key] ?= 0) += 1 ++count *= 2 ``` -------------------------------- ### Class Implementation in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates implementing interfaces or multiple base classes using '<:' syntax. ```civet class Civet < Animal <: Named class Civet <: Animal, Named ``` -------------------------------- ### CoffeeMultiLineComment Syntax Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/public/railroad.html Defines the syntax for multi-line comments in CoffeeScript style, including 'here-comment' start. ```regex CoffeeHereCommentStart ! CoffeeHereCommentStart \*/ . CoffeeHereCommentStart ``` -------------------------------- ### Build Production Site Source: https://github.com/danielxmoore/civet/blob/main/integration/unplugin-examples/astro/README.md Builds your Astro project for production, outputting the static site to the ./dist/ directory. ```bash npm run build ``` -------------------------------- ### Add In-Repo Civet LSP Binary to PATH Source: https://github.com/danielxmoore/civet/blob/main/lsp/sublime/README.md Adds the in-repo Civet language server binary to the system's PATH for use with Sublime Text. ```bash # ~/.bashrc / ~/.zshrc export PATH="/path/to/Civet/lsp/server/bin:$PATH" ``` -------------------------------- ### Preview Production Build Source: https://github.com/danielxmoore/civet/blob/main/integration/unplugin-examples/astro/README.md Locally previews the production build of your Astro site before deploying it. ```bash npm run preview ``` -------------------------------- ### Await All with For Loop Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates `await.all` used with a for loop to fetch multiple URLs concurrently. ```civet await.all for url of urls fetch url ``` -------------------------------- ### Delayed Type Assertion Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates type assertions that can start on later lines, chained with dot notation. ```civet "Hello, world!" .split /\s+/ as [string, string] ``` -------------------------------- ### Astro Project Structure Overview Source: https://github.com/danielxmoore/civet/blob/main/integration/unplugin-examples/astro/README.md Illustrates the basic directory and file structure of an Astro project, including public assets, source files, and the package.json. ```bash / ├── public/ ├── src/ │ └── pages/ │ └── index.astro └── package.json ``` -------------------------------- ### Return Value Preparation with `return.=` Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Prepares the return value of a function using `return.=` to avoid implicit returns and accumulate a sum. ```civet function sum(list: number[]) return .= 0 for item of list return += item ``` -------------------------------- ### Loop expressions listing iterated items Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Examples of loop expressions that simply list the items being iterated over. ```civet array := for item of iterable coordinates := for {x, y} of objects keys := for key in object ``` -------------------------------- ### Placeholder for Function Shorthand Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/cheatsheet.md The `&` symbol acts as a placeholder in function shorthand syntax, for example `&[x]+1`. ```civet &[x]+1 ``` -------------------------------- ### Build and Test Civet Language Server (Repository Development) Source: https://github.com/danielxmoore/civet/blob/main/lsp/server/README.md Builds and tests the Civet Language Server within a repository development context using pnpm. These commands are for developers working on the server's source code. ```bash pnpm -C lsp/server build pnpm -C lsp/server test ``` -------------------------------- ### Configure In-Repo Civet LSP on Windows Source: https://github.com/danielxmoore/civet/blob/main/lsp/sublime/README.md Configures Sublime Text to use the in-repo Civet LSP binary on Windows by explicitly pointing to the Node.js executable. ```json "command": ["node", "C:\\path\\to\\Civet\\lsp\\server\\bin\\civet-lsp.js", "--stdio"] ``` -------------------------------- ### Function Shorthand Comparison (& vs .) Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates the difference in lifting behavior between '&' and '.' placeholders. '.' requires a function call and lifts beyond it, while '&' does not. ```civet f a, & f a, . ``` -------------------------------- ### Import Declarations as Expressions Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates using import declarations as expressions, serving as a shorthand for awaiting and destructuring a dynamic import. ```civet urlPath := import { fileURLToPath, pathToFileURL } from url url := import * from url Foo := import default from Foo ``` -------------------------------- ### Run Tests Source: https://github.com/danielxmoore/civet/blob/main/lsp/tree-sitter/README.md Execute the test suite for the tree-sitter parser using pnpm. ```bash pnpm test ``` -------------------------------- ### Heregex Body Syntax Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/public/railroad.html Defines the body of a Heregex, starting with an exclamation mark, followed by triple slashes and Heregex parts. ```civet [HeregexBody](#HeregexBody "HeregexBody")          ::= '!' [TripleSlash](#TripleSlash "TripleSlash") [HeregexPart](#HeregexPart "HeregexPart")* ``` -------------------------------- ### Attach to Node Process (VSCode) Source: https://github.com/danielxmoore/civet/blob/main/CONTRIBUTING.md Instructions for attaching the VSCode debugger to a running Node.js process started with the inspect flag. ```sh pnpm test --inspect ``` -------------------------------- ### Class Syntax with Attributes Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates defining HTML elements with classes using dot notation. Supports dynamic class names via expressions. ```civet
Civet ``` ```civet
Civet ``` ```civet
Civet ``` ```civet
``` -------------------------------- ### Array and String Slicing Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates various ways to slice arrays and strings using inclusive and exclusive ranges, omitting endpoints, and reversing slices. ```civet start := numbers[..2] mid := numbers[3...-2] end := numbers[-2..] numbers[1...-1] = [] ``` ```civet strict := numbers[first<..=] ``` ```civet [left, right] = [x[<=i], x[>i]] [left, right] = [x[=i]] ``` -------------------------------- ### Range Loop with Inclusive Endpoints Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Iterates through a range of numbers, including both the start and end points. Useful when the endpoint value is critical. ```Civet for i of [first..<=last] console.log array[i] ``` -------------------------------- ### Comments and Regular Expressions Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/cheatsheet.md The `/` symbol starts single-line comments (`// x`) and is used in regular expression literals (`/x/`, `///x///`). ```civet // x ``` ```civet /x/ ``` ```civet ///x/// ``` -------------------------------- ### Civet Compatibility Directive: coffeeComment Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet coffeeComment"` directive prologue to re-enable `#` for single-line comments. ```civet "civet coffeeComment" ``` -------------------------------- ### Civet Compatibility Directive: coffeePrototype Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet coffeePrototype"` directive prologue to re-enable the `::` prototype shorthand. ```civet "civet coffeePrototype" ``` -------------------------------- ### Webpack Configuration with unplugin-civet Source: https://github.com/danielxmoore/civet/blob/main/source/unplugin/README.md Add the civetWebpackPlugin to your Webpack configuration to process Civet files. This snippet demonstrates the basic setup for Webpack. ```javascript const civetWebpackPlugin = require('@danielx/civet/webpack').default; module.exports = { // ... plugins: [ civetWebpackPlugin({ // options }), ], }; ``` -------------------------------- ### Partial Function Application with '.' Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Use '.' as a placeholder for a single argument in function calls for partial application. This placeholder can be used multiple times and lifts beyond unary operations. ```civet console.log "result:", . ``` ```civet compute ., . + 1, . * 2, (.).toString() ``` -------------------------------- ### Basic Postfix Loop Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Iterates over an array and logs each item. This is a simple postfix loop structure. ```civet console.log item for item of array ``` -------------------------------- ### Concatenating Strings (`for join`) Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Concatenates body values as strings, starting from an empty string. Useful for building formatted output from loop elements. ```civet all := for join item of array `[${item.type}] ${item.title}\n` ``` -------------------------------- ### Template Substitution Syntax Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/public/railroad.html Defines the structure for template substitutions within template literals. It includes the start, an extended expression, and the closing brace. ```civet [TemplateSubstitution](#TemplateSubstitution "TemplateSubstitution") ::= [SubstitutionStart](#SubstitutionStart "SubstitutionStart") [ExtendedExpression](#ExtendedExpression "ExtendedExpression") [__](#__ "__") [CloseBrace](#CloseBrace "CloseBrace") ``` -------------------------------- ### Execute Civet Source File Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/getting-started.md Run a .civet source file directly using the 'civet' command, passing any necessary arguments. ```sh civet source.civet ...args... ``` -------------------------------- ### Regular Expression Body Syntax Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/public/railroad.html Defines the body of a regular expression, starting with an exclamation mark followed by specific characters and RegExp characters. ```civet [RegularExpressionBody](#RegularExpressionBody "RegularExpressionBody")          ::= '!' '[*\/\r\n]' [RegExpCharacter](#RegExpCharacter "RegExpCharacter")* ``` -------------------------------- ### Module Imports and Exports Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates how to import and export values in Civet, including aliasing and named exports. ```civet import { 😊 } from "mod" import { 😊 as x } from "mod" export { 😊 } export 😊 := 3 ``` -------------------------------- ### CoffeeScript Array Slices Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Demonstrates array slicing syntax `list[start...end]` in CoffeeScript, which maps to `slice()` in JavaScript and Civet. ```coffeescript list[0...2] ``` -------------------------------- ### Import Shorthand Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Shows the 'from' shorthand for imports, allowing omission of 'import' and quotes around filenames. ```civet fs from fs/promises {basename, dirname} from path metadata from ./package.json with type: 'json' ``` -------------------------------- ### Custom Operator Precedence and Associativity Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Define operators with custom precedence and associativity. This example shows operators with 'same' precedence and 'arguments' associativity. ```civet operator { plus same (+), times same (*) } from ops a times b plus c times d ``` -------------------------------- ### Decorator Syntax Source: https://github.com/danielxmoore/civet/blob/main/lsp/tree-sitter/test/corpus/tokens.txt Illustrates the parse tree for a decorator, specifically @@injectable. ```civet @@injectable ``` ```tree-sitter (program (decorator (identifier))) ``` -------------------------------- ### Civet Compatibility Directive: coffeeOf Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet coffeeOf"` directive prologue to re-enable `a of b` and `a not of b` operators. ```civet "civet coffeeOf" ``` -------------------------------- ### Civet Compatibility Directive: coffeeBinaryExistential Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet coffeeBinaryExistential"` directive prologue to re-enable the `a ? b` existential operator. ```civet "civet coffeeBinaryExistential" ``` -------------------------------- ### Civet Language Features Source: https://github.com/danielxmoore/civet/blob/main/lsp/tree-sitter/test/corpus/tokens.txt Demonstrates standard imports, constants, type aliases, interfaces, and class definitions with decorators and shorthand syntax in Civet. ```civet // Standard imports import { readFile } from 'fs/promises' import type { PathLike } from 'fs' // Simple constants PI := 3.14159 MAX_RETRIES := 5 DEBUG := false // Type alias type Callback = (err: Error | null, result: T) => void type FilePath = string | PathLike // Interface interface Config host: string port: number debug?: boolean // Class with decorator and @ shorthand @@injectable class HttpClient #baseUrl: string constructor(@baseUrl: string, private config: Config) {} get url(): string @baseUrl async fetch(path: string): Promise url := `${@baseUrl}/${path}` response := await globalThis.fetch(url) unless (response.ok) throw new Error(`HTTP ${response.status}`) response.json() as T // Pipe operator double := (x: number) -> x * 2 square := (x: number) -> x ** 2 transform := (values: number[]) -> values |> .filter((x) -> x > 0) |> .map(double) |> .map(square) // Range expressions range := [1..10] exclusiveRange := [0...5] // unless / until count .= 0 until (count >= MAX_RETRIES) count++ validate := (x: number) -> unless (x > 0) throw new Error('Expected positive number') x // Template literals greet := (name: string) -> `Hello, ${name}! PI ≈ ${PI.toFixed(2)}.` // Destructuring { host, port = 8080 } := config [first, ...rest] := [1, 2, 3, 4, 5] // Private class fields class Counter #count = 0 increment(): void @#count++ get value(): number @#count export { HttpClient, Counter, transform } ``` -------------------------------- ### Shorthand Getters and Setters in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates shorthand syntax for getters and setters, including private fields and destructuring. ```civet class C get #secret set #secret get @coords.{x,y} return 0 unless @coords? set @coords.{x,y} @coords ?= {} ``` -------------------------------- ### Civet Compatibility Directive: coffeeDo Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet coffeeDo"` directive prologue to re-enable the `do` keyword for function expressions. ```civet "civet coffeeDo" ``` -------------------------------- ### Civet Compatibility Directive: coffeeBooleans Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet coffeeBooleans"` directive prologue to re-enable `on/yes/off/no` boolean literals. ```civet "civet coffeeBooleans" ``` -------------------------------- ### Basic Variable Declarations Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates basic variable declaration using Civet's shorthand assignment operators. ```civet a := 10 b .= 10 c: number | string .= 0 let d: boolean var v: any ``` -------------------------------- ### Bind Method with Prepending Arguments Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Prepend arguments to a bound method using an immediate function call syntax with '@'. ```Civet message := console@log "[MSG] " ``` -------------------------------- ### Run Unit Tests Source: https://github.com/danielxmoore/civet/blob/main/lsp/vscode/CONTRIBUTING.md Executes unit tests for the lsp/server package. ```bash cd lsp/server && pnpm test ``` -------------------------------- ### Summing Values (`for sum`) Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Calculates the sum of body values, starting from 0. If no body is specified, it sums the iterated items. Useful for numerical aggregation. ```civet sumOfSquares := for sum item of array item * item ``` ```civet sum := for sum item of array ``` -------------------------------- ### Pipe Operator with Function Shorthand Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates using the pipe operator with single-argument function shorthand and binary operator sections for concise expression building. ```civet x.length |> & + 1 |> .toString() ``` ```civet x.length |> (+ 1) |> .toString() ``` -------------------------------- ### Property Access Shorthand (.) Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Omit '&' when starting with a '.' or '?' property access for concise property access within functions. This shorthand can also be used for assigning properties. ```civet x.map .name x.map ?.profile?.name[0...3] x.map `${.firstName} ${.lastName}` ``` ```civet x.map .name = "Civet" + i++ ``` -------------------------------- ### Civet Compatibility Directive: coffeeForLoops Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet coffeeForLoops"` directive prologue to re-enable CoffeeScript's `for from`, `for in`, and `for own of` loop syntaxes. ```civet "civet coffeeForLoops" ``` -------------------------------- ### Postfix Loop with Destructuring and Spread Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates a postfix loop that uses destructuring to extract multiple items and a spread operator. Note that parentheses may be required in certain contexts. ```civet coords := x, y for {x, y} of points ``` ```civet function flat(array) ...item for item of array ``` -------------------------------- ### Add Civet LSP to PATH Source: https://github.com/danielxmoore/civet/blob/main/lsp/zed/README.md Add the Civet LSP server's binary directory to your system's PATH environment variable. This is typically done in your shell's configuration file like ~/.bashrc or ~/.zshrc. ```bash # Add to ~/.bashrc / ~/.zshrc export PATH="/path/to/Civet/lsp/server/bin:$PATH" ``` -------------------------------- ### Astro Configuration with unplugin-civet Source: https://github.com/danielxmoore/civet/blob/main/source/unplugin/README.md Add the civet integration to your Astro configuration to process Civet files. This snippet shows the basic setup for Astro projects. ```typescript // astro.config.ts import { defineConfig } from 'astro/config' import civet from '@danielx/civet/astro' // https://astro.build/config export default defineConfig({ // ... integrations: [ civet({ // options }), ], }) ``` -------------------------------- ### Samedent Rule Definition Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/public/railroad.html Defines the 'Samedent' rule, which signifies the end of a statement and the start of an indented block. It's referenced by various delimiter and clause types. ```plaintext [Samedent](#Samedent "Samedent") ::= [EOS](#EOS "EOS") [Indent](#Indent "Indent") ``` -------------------------------- ### Constructor Shorthand in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates the shorthand syntax for constructors where '@' is used for both the constructor and typed fields. ```civet class Rectangle @(@width: number, @height: number) ``` -------------------------------- ### Class Definition with Methods Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Define a class with properties and methods. Methods can access instance properties using '@'. ```Civet class Animal sound = "Woof!" bark(): void console.log @sound wiki() fetch 'https://en.wikipedia.org/wiki/Animal' ``` -------------------------------- ### Tuple Type Assertion for Array Literals Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Asserts an array literal to have a tuple type using 'as tuple'. Includes examples with and without 'as const'. ```civet [1, "hello"] as tuple // type [number, string] [1, "hello"] as const as tuple // type [1, "hello"] [1, "hello"] as const // type readonly [1, "hello"] ``` -------------------------------- ### Civet Compatibility Directive: autoVar Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet autoVar"` directive prologue to re-enable implicit `var` declarations, similar to CoffeeScript. ```civet "civet autoVar" ``` -------------------------------- ### Run Civet Language Server via StdIO Source: https://github.com/danielxmoore/civet/blob/main/lsp/server/README.md Launches the Civet Language Server using stdio for communication. This is the command-line interface for editors and tools that support standard LSP server processes. ```bash civet-lsp --stdio ``` -------------------------------- ### CommonJS Import and Export Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Shows how to import CommonJS modules using 'require' and export a value using 'export ='. ```civet import fs = require 'fs' export = fs.readFileSync 'example' ``` -------------------------------- ### Civet Compatibility Directive: coffeeRange Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Example of using the `"civet coffeeRange"` directive prologue to enable decreasing range literals `[a..b]` where `a > b`. ```civet "civet coffeeRange" ``` -------------------------------- ### Export Default Shorthand Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates exporting a declaration as the default export using a shorthand syntax. ```civet export default x := 5 ``` -------------------------------- ### Simple Usage with typescript-eslint (CJS) Source: https://github.com/danielxmoore/civet/blob/main/integration/eslint/README.md Configure ESLint to use the Civet plugin with TypeScript's recommended and strict rules. This setup is for projects using CommonJS Modules. ```js const civetPlugin = require("eslint-plugin-civet/ts") module.exports = [ // Rules from eslint.configs.recommended ...civetPlugin.configs.jsRecommended, // Rules from tseslint.configs.strict ...civetPlugin.configs.strict, ] ``` -------------------------------- ### Build Helix Grammars Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/integrations.md Instruct Helix to build the necessary grammars, including the Civet grammar, after configuration. ```shell hx -g build ``` -------------------------------- ### Simple Usage with typescript-eslint (ESM) Source: https://github.com/danielxmoore/civet/blob/main/integration/eslint/README.md Configure ESLint to use the Civet plugin with TypeScript's recommended and strict rules. This setup is for projects using ECMAScript Modules. ```js import civetPlugin from "eslint-plugin-civet/ts" export default [ // Rules from eslint.configs.recommended ...civetPlugin.configs.jsRecommended, // Rules from tseslint.configs.strict ...civetPlugin.configs.strict, // Rules from tseslint.configs.stylistic ...civetPlugin.configs.stylistic, ] ``` -------------------------------- ### Variable Declarations with Walrus and Mutable Assignment Source: https://github.com/danielxmoore/civet/blob/main/lsp/tree-sitter/test/corpus/kitchen_sink.txt Shows how to declare constants using ':=' and mutable variables using '.='. ```Civet MAX_RETRIES := 3 timeout .= 5000 label := 'loading' ``` -------------------------------- ### Shebang Line Preservation in Civet Scripts Source: https://github.com/danielxmoore/civet/blob/main/README.md Illustrates how Civet preserves the shebang line in script files, ensuring that the output script can be executed directly. This example uses `ts-node`. ```civet #!./node_modules/.bin/ts-node console.log "hi" ``` -------------------------------- ### CoffeeScript Optional Chain Shorthand Source: https://github.com/danielxmoore/civet/blob/main/notes/Comparison-to-CoffeeScript.md Demonstrates the optional chaining shorthand for index and function application in CoffeeScript, similar to Civet's syntax. ```coffeescript a?[b] ``` ```coffeescript a?(b) ``` -------------------------------- ### Automatic Semicolon Insertion Examples Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/comparison.md Shows how Civet handles line breaks for binary operators and member access, differing from JavaScript's automatic semicolon insertion rules. ```civet x + y - z -negative [array] .length {name: value} ``` -------------------------------- ### Import Shorthand Source: https://github.com/danielxmoore/civet/blob/main/README.md Simplifies the import statement syntax for modules. ```javascript x from ./x ``` ```javascript import x from "./x" ``` -------------------------------- ### Zero-Argument Arrow Functions in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/comparison.md Civet allows zero-parameter functions to omit parentheses, simplifying syntax. This example shows a basic console log and a function creating a signal. ```civet => console.log("Hello") ``` ```typescript createEffect => console.log(signal()) ``` -------------------------------- ### Object Comprehension with Do-While Loop Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Builds an object using a do-while loop, where each iteration adds a key-value pair. Suitable for scenarios where the loop must execute at least once. ```Civet i .= 1 squares := { do [i]: i * i while i++ < 10 } ``` -------------------------------- ### Complex Usage with ESLint and JavaScript (ESM) Source: https://github.com/danielxmoore/civet/blob/main/integration/eslint/README.md Configure ESLint with explicit rules for `.civet` files and general JavaScript rules. This setup allows for more granular control over linting behavior. ```js import civetPlugin from "eslint-plugin-civet" import js from "@eslint/js" export default [ // Enable recommended rules for all files js.configs.recommended, // Load plugin and enable processor for .civet files { files: ["**/*.civet"], plugins: { civet: civetPlugin, }, processor: "civet/civet", // Here is where you would override specific rules. // We provide an `overrides` rule set that disables rules that // don't work well with Civet output. ...civetPlugin.configs.overrides, }, ] ``` -------------------------------- ### Class Declaration with Private Fields and Methods Source: https://github.com/danielxmoore/civet/blob/main/lsp/tree-sitter/test/corpus/kitchen_sink.txt Shows the syntax for defining classes, including private fields, constructors, and methods with decorators. ```Civet class FileCache #data : Map @( ) @#data = new Map get ( key : string ) @#data . get key ``` -------------------------------- ### Civet Range and Slice Literals Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/cheatsheet.md Covers Civet's syntax for creating range literals (e.g., 1..10) and for slicing arrays using start and end indices. ```ts // Range literals letters := ['a'..'f'] numbers := [1..10] reversed := [10..1] indices := [0...array.length] // slicing and splicing start := numbers[..2] mid := numbers[3...-2] end := numbers[-2..] numbers[1...-1] = [] ``` -------------------------------- ### Implicit Function Application with Indentation Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates implicit function application using indentation, with optional commas before newlines. ```civet console.log "Hello" name "!" JSON.stringify id: getId() date: new Date ``` -------------------------------- ### Comment Syntax in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/comparison.md Explains Civet's comment syntax, particularly the avoidance of triple-slash comments (///) unless they are at the start of the file, to prevent conflicts with regular expression literals. ```civet /// A comment because at the top of file if s /// not a comment ///.exec s ``` -------------------------------- ### Symbol Definition and Usage Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates defining and using symbols, including well-known symbols and custom symbols. ```civet magicSymbol := :magic iterable = { :iterator() yield 1 yield 2 yield 3 :isConcatSpreadable: true } iterable.:iterator() ``` -------------------------------- ### Run Coverage Commands Source: https://github.com/danielxmoore/civet/blob/main/CONTRIBUTING.md Execute various coverage-related tasks using pnpm. Use 'coverage:check' to gate at 100% and 'coverage:show' to inspect uncovered regions. ```sh pnpm coverage # run all suites (root + lsp/server + lsp/vscode e2e) # and emit a unified report at coverage/ pnpm coverage:check # gate at 100% — exits non-zero with details if not pnpm coverage:show

# show uncovered regions for files matching

# add --branches for per-arm hit counts pnpm coverage:merge # re-merge existing temp data without re-running tests # (fast iteration when editing exclude patterns) ``` -------------------------------- ### Symbol Definition with Compiler Directive Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Shows how to set well-known symbols using a compiler directive for specific environments. ```civet "civet symbols=magic" magicSymbol := :magic iteratorSymbol := :iterator ``` -------------------------------- ### Example of Current Comment Behavior in Hera AST Source: https://github.com/danielxmoore/civet/blob/main/notes/hera-ast-comments.md Illustrates how leading comments are currently absorbed into whitespace or preceding statement nodes in the Hera AST, rather than being directly associated with the rule they precede. ```plaintext # doc for Greeting <- in Statement[0].EOS (first rule: leading) Greeting "hi" # doc for Name <- swallowed by Greeting's trailing whitespace, Name NOT Name's Statement "world" ``` -------------------------------- ### Conditional Return and Resource Cleanup Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Demonstrates conditional return and explicit return of a value, along with resource cleanup. ```civet function search(list: T[]): T | undefined return unless list for item of list if match item return = item return++ if return.value list.destroy() ``` -------------------------------- ### Build and Typecheck Commands Source: https://github.com/danielxmoore/civet/blob/main/notes/parser-types-guide.md Commands to build the Civet parser and perform a full typecheck, logging all errors. Avoid clearing the cache unless necessary. ```sh pnpm build CIVET_TYPECHECK_MAX_ERRORS=99999 pnpm typecheck &>/tmp/after.log ``` -------------------------------- ### Register Civet Language and LSP Providers in Monaco Source: https://github.com/danielxmoore/civet/blob/main/lsp/monaco/README.md This snippet demonstrates the complete setup for integrating Civet LSP with Monaco Editor. It registers the language, optional monarch tokens for syntax highlighting, creates a Civet LSP worker, and registers all necessary LSP providers. ```typescript import * as monaco from 'monaco-editor' import { registerCivetLanguage, registerCivetLspProviders, registerCivetMonarchTokens, } from '@danielx/civet-monaco' import { createCivetLspWorker, createCivetLspWorkerClient, } from '@danielx/civet-language-server/worker' registerCivetLanguage(monaco) // Optional lightweight syntax highlighting. Use this if you do not already // provide TextMate/Shiki or another Monaco tokens provider for Civet. registerCivetMonarchTokens(monaco) const model = monaco.editor.createModel( "console.log 'Hello Civet!'", 'civet', monaco.Uri.parse('file:///workspace/index.civet'), ) const worker = createCivetLspWorker({ civetUrl: new URL('@danielx/civet/browser.min', import.meta.url), serverUrl: new URL('@danielx/civet-language-server/browser', import.meta.url), }) const uri = model.uri.toString() const client = createCivetLspWorkerClient({ worker, uri }) await client.start(model.getValue()) registerCivetLspProviders(monaco, { uri, model, client, }) ``` -------------------------------- ### Type Assertions Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates various type assertion syntaxes, including non-null, property access, and casting with 'as'. ```civet data! data!prop elt as HTMLInputElement elt as! HTMLInputElement ``` -------------------------------- ### Civet Function Application Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/cheatsheet.md Illustrates how to apply functions in Civet, including nested calls, variadic arguments, and implicit function application syntax. ```ts // Function application f(x) f(a, g(x)) f(...args, cb) // Implicit application f x // f(x) f a, b, c // f(a, b, c) f g x // f(g(x)) f a, b c // f(a, b(c)) ``` -------------------------------- ### Static Fields in Civet Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates the declaration of static fields within a class using the '@' prefix. ```civet class A @a = 'civet' ``` -------------------------------- ### Implicit Returns with Different Syntaxes Source: https://github.com/danielxmoore/civet/blob/main/civet.dev/reference.md Illustrates implicit return behavior for arrow functions ('=>'), explicit return for arrow functions ('->'), and regular functions in Civet. ```civet "civet -implicitReturns" => "returned" -> "not returned" function() "not returned" ```