Skip to content

Commit 59a586c

Browse files
committed
Improve code highlighting
1 parent 494f8ef commit 59a586c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/vortex/monaco-config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { CommandName } from "./types";
22

33
const bounded = (text: string) => `\\b${text}\\b`;
44

5-
const identifierStart = "[_a-zA-Z]";
6-
const identifierContinue = "[_a-zA-Z0-9]";
5+
const identifierStart = "[\\-a-zA-Z]";
6+
const identifierContinue = "[\\-a-zA-Z0-9]";
77
const identifier = bounded(`${identifierStart}${identifierContinue}*`);
88

99
const keywords = Object.values(CommandName);

src/vortex/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export enum CommandName {
1515
Subscription = "subscription",
1616
Claim = "claim",
1717
// Sub-commands
18+
PreApprove = "pre-approve",
1819
Approve = "approve",
1920
TransferFrom = "transfer-from",
2021
Upgrade = "upgrade",

src/vortex/vortex.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { CommandName } from "./types";
22

33
const bounded = (text: string) => `\\b${text}\\b`;
44

5-
const identifierStart = "[_a-zA-Z]";
6-
const identifierContinue = "[_a-zA-Z0-9]";
5+
const identifierStart = "[a-zA-Z]";
6+
const identifierContinue = "[\\-:a-zA-Z0-9]";
77
const identifier = bounded(`${identifierStart}${identifierContinue}*`);
88

99
const keywords = Object.values(CommandName);
@@ -12,11 +12,11 @@ const namedLiterals = ["true", "false"];
1212

1313
const nonCommentWs = `[ \\t\\r\\n]`;
1414

15-
const numericLiteral = `[0-9]+`;
15+
const numericLiteral = `0x([0-9a-fA-F]+)|([0-9]+(e[0-9]+)?(mo|[s|m|h|d|w|mo|y])?(/mo|[s|m|h|d|w|mo|y])?)`;
1616

1717
export const conf = {
1818
comments: {
19-
lineComment: "//",
19+
lineComment: ["//", "#"],
2020
},
2121
brackets: [
2222
["{", "}"],

0 commit comments

Comments
 (0)