aboutsummaryrefslogtreecommitdiff
path: root/src/parser.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-08-11 19:25:17 +0530
committerAkshay Nair <phenax5@gmail.com>2023-08-11 19:25:17 +0530
commit6aec6197fbd916c2930813b46b07e726803993f0 (patch)
tree2166acaa80cc3ae358b4abb4e20d51546f2438af /src/parser.ts
parent952256ae8bf5514a246db8f33bef207f5747b138 (diff)
downloadcss-everything-6aec6197fbd916c2930813b46b07e726803993f0.tar.gz
css-everything-6aec6197fbd916c2930813b46b07e726803993f0.zip
refactor: minor refactor
Diffstat (limited to '')
-rw-r--r--src/parser.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/parser.ts b/src/parser.ts
index 8230825..9cb0405 100644
--- a/src/parser.ts
+++ b/src/parser.ts
@@ -1,14 +1,14 @@
import { Enum, constructors, match } from './utils/adt'
import * as P from './utils/parser-comb'
-type Unit = '' | 's' | 'ms'
+export type CSSUnit = '' | 's' | 'ms'
export type Expr = Enum<{
Call: { name: string; args: Expr[] }
Identifier: string
VarIdentifier: string
LiteralString: string
- LiteralNumber: { value: number, unit: Unit }
+ LiteralNumber: { value: number, unit: CSSUnit }
}>
export const Expr = constructors<Expr>()
@@ -48,7 +48,7 @@ const numberParser = P.regex(/^[-+]?((\d*\.\d+)|\d+)/)
const numberExprParser: P.Parser<Expr> = P.map(
P.zip2(numberParser, P.optional(P.regex(/^(s|ms)/i))),
- ([value, unit]) => Expr.LiteralNumber({ value: Number(value), unit: (unit ?? '') as Unit }),
+ ([value, unit]) => Expr.LiteralNumber({ value: Number(value), unit: (unit ?? '') as CSSUnit }),
)
const exprParser: P.Parser<Expr> = P.or([