From 70259f75bd1f4812d6cd2c0b29d634e1a4366efd Mon Sep 17 00:00:00 2001 From: Andrew Ray Date: Mon, 19 Jun 2023 19:27:50 -0700 Subject: [PATCH] Updating whitespace type to be consistent --- package.json | 2 +- src/ast/node.ts | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index becc61c..876300b 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "engines": { "node": ">=16" }, - "version": "1.4.1", + "version": "1.4.2", "description": "A GLSL ES 1.0 and 3.0 parser and preprocessor that can preserve whitespace and comments", "scripts": { "prepare": "npm run build && ./prepublish.sh", diff --git a/src/ast/node.ts b/src/ast/node.ts index dc833ad..6d41db7 100644 --- a/src/ast/node.ts +++ b/src/ast/node.ts @@ -15,22 +15,24 @@ export interface BaseNode { location?: LocationObject; } +type Whitespace = string | string[]; + export interface LiteralNode extends BaseNode { type: 'literal'; literal: string; - whitespace: string | string[]; + whitespace: Whitespace; } export interface KeywordNode extends BaseNode { type: 'keyword'; token: string; - whitespace: string | string[]; + whitespace: Whitespace; } export interface IdentifierNode extends BaseNode { type: 'identifier'; identifier: string; - whitespace: string; + whitespace: Whitespace; } export interface ArraySpecifierNode extends BaseNode { @@ -62,7 +64,7 @@ export interface BinaryNode extends BaseNode { export interface BoolConstantNode extends BaseNode { type: 'bool_constant'; token: string; - whitespace: string; + whitespace: Whitespace; } export interface BreakStatementNode extends BaseNode { @@ -140,7 +142,7 @@ export interface DoStatementNode extends BaseNode { export interface DoubleConstantNode extends BaseNode { type: 'double_constant'; token: string; - whitespace: string; + whitespace: Whitespace; } export interface ExpressionStatementNode extends BaseNode { @@ -158,7 +160,7 @@ export interface FieldSelectionNode extends BaseNode { export interface FloatConstantNode extends BaseNode { type: 'float_constant'; token: string; - whitespace: string; + whitespace: Whitespace; } export interface ForStatementNode extends BaseNode { @@ -237,7 +239,7 @@ export interface InitializerListNode extends BaseNode { export interface IntConstantNode extends BaseNode { type: 'int_constant'; token: string; - whitespace: string; + whitespace: Whitespace; } export interface InterfaceDeclaratorNode extends BaseNode { @@ -393,7 +395,7 @@ export interface TypeSpecifierNode extends BaseNode { export interface UintConstantNode extends BaseNode { type: 'uint_constant'; token: string; - whitespace: string; + whitespace: Whitespace; } export interface UnaryNode extends BaseNode {