Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/frontend/codemirror/mode/ada.ts
Views: 687
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import * as CodeMirror from "codemirror";67// Little first step for Ada89// This is redundant with the regexp's below, but we need this to do completions10// before the terms are ever used.11export const completions: string[] = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|body|private|then|if|procedure|type|case|in|protected|constant|interface|until|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor".split(12"|"13);14completions.sort();1516(CodeMirror as any).defineSimpleMode("ada", {17start: [18{ regex: /"(?:[^\\]|\\.)*?(?:"|$)/, token: "string" },19{ regex: /--.*/, token: "comment" },20{ regex: /[-+\/*=<>!:]+/, token: "operator" },21{22regex: /\b(abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|body|private|then|if|procedure|type|case|in|protected|constant|interface|until|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor)\b/,23token: "atom",24},25{26regex: /0x[a-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i,27token: "number",28},29{ regex: /(if|elseif|case|when|begin|while|loop)/, indent: true },30{ regex: /(end)/, dedent: true },31{32regex: /\b([A-Za-z_0-9]+)\b/,33token: "variable-3",34},35{ regex: /b?"/, token: "string", next: "string" },36],37string: [38{ regex: /"/, token: "string", next: "start" },39{ regex: /(?:[^\\"]|\\(?:.|$))*/, token: "string" },40],41meta: {42dontIndentStates: ["comment"],43lineComment: "--",44},45});464748