| Ocalt Query Language
Pricing Dashboard ocalt.com v1.0

Editor Verbs

OQL has a built-in document editor model. An editor document is a plain OqlValue object — open a file into a variable, manipulate it with editor verbs, save it back. No sessions, no WebSockets, no special runtime state.

Document types

TypeModelUse for
EDITOR TEXT OPENFlat lines, line/col operationsPlain text files (.txt, .md, .csv)
EDITOR CODE OPENFlat lines, line/col operations, language detectionSource files (.js, .py, .rs, .oql, .html, .css, .sql…)

The language is auto-detected from the file extension and stored in the lang field of the document object. Rich text (.rtf) with full layout, typography, and export to PDF/DOCX/PPTX is a separate planned verb set.

Document object structure

{ "type": "text" | "code", "lang": "javascript" | "python" | "rust" | "oql" | ..., "path": "/root/file.js", "lines": ["line 1", "line 2", ...], "cursor": { "line": 1, "col": 1 }, "selection": { "from_line": 1, "from_col": 1, "to_line": 2, "to_col": 10 } | null, "clipboard": ["item1", "item2", ...] }

All line and column numbers are 1-based. The document is immutable — every verb returns a new document object. Mutate with SET ?doc to update the variable.

Quick reference

VerbKey modifiers / Returns
EDITOR TEXT OPEN "path"Open or create a text file → document object
EDITOR CODE OPEN "path"Open or create a code file, auto-detect language → document object
EDITOR READ ?doc→ full content as a single string
EDITOR SAVE ?docINTO "/root/path" — saves to original path or specified path. → document object
EDITOR INSERT AFTER ?docWITH "content" AT "line" — insert after line n. → document object
EDITOR INSERT BEFORE ?docWITH "content" AT "line" — insert before line n. → document object
EDITOR REPLACE LINE ?docAT "line" WITH "content" — replace entire line. → document object
EDITOR REPLACE RANGE ?docFROM "line" TO "line" AT "col" USING "col" WITH "content" — replace col range. → document object
EDITOR ERASE ?docAT "line" — remove line n entirely. → document object
EDITOR GOTO ?docAT "line" USING "col" — move cursor. → document object
EDITOR SELECT ?docFROM "line" TO "line" AT "col" USING "col" — set selection. → document object
EDITOR FIND ?docWITH "pattern" — case-insensitive substring search. → array of {line, col, text}
EDITOR COPY ?docCopy selection or current line to clipboard[0]. → document object
EDITOR CUT ?docCopy and remove selection or current line. → document object
EDITOR PASTE ?docAT "line" — insert clipboard[0] after line n. → document object
EDITOR CLIPBOARD LIST ?doc→ array of clipboard strings (max 50)
EDITOR UNDO ?doc→ document object (undo stack coming soon)
EDITOR REDO ?doc→ document object (redo stack coming soon)

Open and read

EDITOR TEXT OPEN "/root/notes.txt" SET ?doc AFTER EDITOR READ ?doc SET ?content AFTER EMIT ?content
Try it ›

Insert, replace, erase

EDITOR CODE OPEN "/root/app.js" SET ?doc AFTER EDITOR INSERT AFTER ?doc WITH "// inserted comment" AT "1" SET ?doc AFTER EDITOR REPLACE LINE ?doc AT "3" WITH "const x = 42;" SET ?doc AFTER EDITOR ERASE ?doc AT "5" SET ?doc AFTER EDITOR SAVE ?doc SET ?doc AFTER EMIT ?doc(lines)
Try it ›

Find

EDITOR CODE OPEN "/root/app.js" SET ?doc AFTER EDITOR FIND ?doc WITH "TODO" SET ?matches AFTER EMIT ?matches

Returns an array of {line, col, text} objects — one per match occurrence. Case-insensitive.

Try it ›

Copy, cut, paste

EDITOR TEXT OPEN "/root/notes.txt" SET ?doc AFTER EDITOR COPY ?doc SET ?doc (* copies cursor line to clipboard *) AFTER EDITOR PASTE ?doc AT "5" SET ?doc (* pastes after line 5 *) AFTER EDITOR CLIPBOARD LIST ?doc SET ?clips AFTER EMIT ?clips
Try it ›

Insert before

EDITOR TEXT OPEN "/root/notes.txt" SET ?doc AFTER EDITOR INSERT BEFORE ?doc WITH "# Header" AT "1" SET ?doc AFTER EMIT ?doc(lines)
Try it ›

Replace range (col-level)

Replace a character range within a line. FROM and TO are line numbers, AT is start column, USING is end column.

(* Replace columns 5 to 8 on line 2 *) EDITOR TEXT OPEN "/root/notes.txt" SET ?doc AFTER EDITOR REPLACE RANGE ?doc FROM "2" TO "2" AT "5" USING "8" WITH "REPLACED" SET ?doc AFTER EMIT ?doc(lines)
Try it ›

Goto and select

EDITOR GOTO moves the cursor. EDITOR SELECT sets a selection range used by COPY and CUT.

EDITOR TEXT OPEN "/root/notes.txt" SET ?doc AFTER EDITOR GOTO ?doc AT "3" USING "1" SET ?doc (* move cursor to line 3, col 1 *) AFTER EDITOR SELECT ?doc FROM "2" TO "4" AT "1" USING "10" SET ?doc AFTER EDITOR COPY ?doc SET ?doc (* copies the selection *) AFTER EDITOR CLIPBOARD LIST ?doc SET ?clips AFTER EMIT ?clips
Try it ›

Cut

EDITOR TEXT OPEN "/root/notes.txt" SET ?doc AFTER EDITOR GOTO ?doc AT "2" SET ?doc AFTER EDITOR CUT ?doc SET ?doc (* cuts cursor line into clipboard *) AFTER EMIT ?doc(lines)
Try it ›

Save to a different path

EDITOR CODE OPEN "/root/app.js" SET ?doc AFTER EDITOR REPLACE LINE ?doc AT "1" WITH "// Modified" SET ?doc AFTER EDITOR SAVE ?doc INTO "/root/app_modified.js" SET ?doc AFTER EMIT ?doc(path)
Try it ›

Code editor with language detection

The language is auto-detected from the file extension and stored in the lang field.

EDITOR CODE OPEN "/root/script.py" SET ?doc AFTER EMIT ?doc(lang)

Returns "python". Supported: jsjavascript, tstypescript, pypython, rsrust, phpphp, htmlhtml, csscss, sqlsql, oqloql, and more.

Try it ›

OQL manipulating its own source

Because the editor state is a plain variable, OQL scripts can read, modify, and save other OQL scripts — meta-programming.

EDITOR CODE OPEN "/root/sites/mysite/index.oql" SET ?src AFTER EDITOR FIND ?src WITH "EMIT" SET ?emits AFTER EMIT "Found " & LENGTH ?emits & " EMIT statements"
Try it ›