Skip to content

Commit 15cb6cf

Browse files
committed
Switch technical words to Am. English
Freedom rahh 🦅 🦅
1 parent 88e40bc commit 15cb6cf

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Kalkki is a modern web-based scientific calculator designed as an replacement fo
2020
- History (up and down arrow)
2121
- Progressive Web App for offline usage
2222
- Super fast math evaluation powered by [GMP and WASM](https://github.com/Daninet/gmp-wasm)
23-
- Tokeniser based math parser (forked from Abicus)
23+
- Tokenizer based math parser (forked from Abicus)
2424

2525
## Usage
2626

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "kalkki",
33
"private": true,
4-
"version": "0.2.4",
4+
"version": "0.2.5-nightly",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src/math/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import evaluate, {
88
type EvalValue,
99
type UserObject,
1010
} from "./internal/evaluator";
11-
import tokenise, { type LexicalError } from "./internal/tokeniser";
11+
import tokenize, { type LexicalError } from "./internal/tokenizer";
1212

13-
export type { Token, TokenId } from "./internal/tokeniser";
14-
export { tokenise, evaluate };
13+
export type { Token, TokenId } from "./internal/tokenizer";
14+
export { tokenize, evaluate };
1515

1616
export type AngleUnit = "deg" | "rad";
1717

@@ -25,7 +25,7 @@ export function calculate(
2525
): Result<EvalValue, EvaluationError | LexicalError> {
2626
// This could be a one-liner with neverthrow's `andThen` but we want to
2727
// jump out of neverthrow-land for React anyhow soon
28-
const tokens = tokenise(expression);
28+
const tokens = tokenize(expression);
2929
if (tokens.isErr()) return err(tokens.error);
3030
try {
3131
let cacheKey = `${angleUnit}:${JSON.stringify(userSpace)}:${expression}`;

src/math/internal/evaluator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { P, type Pattern, isMatching, match } from "ts-pattern";
77

88
import type { AngleUnit } from "..";
99
import { factorial, functions } from "./functions";
10-
import type { Token } from "./tokeniser";
10+
import type { Token } from "./tokenizer";
1111

1212
export type EvalResult = Result<LargeNumber, EvaluationError>;
1313
export type EvalValue = {
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { match } from "ts-pattern";
44
import type { functions } from "./functions";
55

66
/**
7-
* Represents an error where the tokeniser couldn't match the input to any token.
7+
* Represents an error where the tokenizer couldn't match the input to any token.
88
* The `idx` field points to the start of the unknown part in the input.
99
*/
1010
export type LexicalError = { type: "UNKNOWN_TOKEN"; idx: number };
@@ -124,17 +124,17 @@ const tokenMatchers = [
124124

125125
/**
126126
* Reads an input expression and returns a `Result<Token[], LexicalError>` where
127-
* - `Token[]` is the tokenised expression, or
127+
* - `Token[]` is the tokenized expression, or
128128
* - `LexicalError.idx` is the starting index of the *first lexical error* (i.e. unrecognised word) in the input expression.
129129
*
130130
* @see {@link Token}
131131
* @example
132132
* ```typescript
133-
* tokenise("1 + 2") // => Ok([{ type: "litr", value: Decimal(1) }, { type: "oper", name: "+" }, ...])
134-
* tokenise("1 ö 2") // => Err({ type: "UNKNOWN_TOKEN", idx: 2 }) // 2 === "1 ö 2".indexOf("ö")
133+
* tokenize("1 + 2") // => Ok([{ type: "litr", value: Decimal(1) }, { type: "oper", name: "+" }, ...])
134+
* tokenize("1 ö 2") // => Err({ type: "UNKNOWN_TOKEN", idx: 2 }) // 2 === "1 ö 2".indexOf("ö")
135135
* ```
136136
*/
137-
export default function tokenise(
137+
export default function tokenize(
138138
expression: string,
139139
): Result<Token[], LexicalError> {
140140
return Result.combine([...tokens(expression)]);
@@ -149,7 +149,7 @@ export default function tokenise(
149149
* The generator stops on the first lexical error.
150150
* I.e. if an error is encountered, it will be the last value output by the generator.
151151
*
152-
* @see {@link tokenise}
152+
* @see {@link tokenize}
153153
* @see {@link Token}
154154
*/
155155
function* tokens(

src/math/prettify.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { P, match } from "ts-pattern";
2-
import { type Token, tokenise } from ".";
2+
import { type Token, tokenize } from ".";
33

44
/**
55
* Takes in an unformatted expression (e.g. `1+2*(cos(2)/sqrt(pi))`) and gives out a "prettified"
@@ -10,7 +10,7 @@ import { type Token, tokenise } from ".";
1010
export default function prettify(expression: string | Token[]) {
1111
let tokens: Token[];
1212
if (typeof expression === "string") {
13-
const result = tokenise(expression);
13+
const result = tokenize(expression);
1414
if (result.isErr()) return expression;
1515

1616
tokens = result.value;

src/math/syntax-highlighter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { LexicalError } from "@/math/internal/tokeniser";
1+
import type { LexicalError } from "@/math/internal/tokenizer";
22
import { Result, err, ok } from "neverthrow";
33

44
type TokenMatcher = (typeof tokenMatchers)[number];

src/util/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type Language, translate } from "@/lang";
22
import { LargeNumber } from "@/math/internal/large-number";
33
import type { EvaluationError, UserObject } from "../math/internal/evaluator";
4-
import type { LexicalError } from "../math/internal/tokeniser";
4+
import type { LexicalError } from "../math/internal/tokenizer";
55

66
export type MathError = EvaluationError | LexicalError;
77
export function parseError(error: MathError, lang: Language) {

0 commit comments

Comments
 (0)