From 2e3b2960213d7d2751566f7fda4bc4aeb4f1dfcc Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Sun, 22 Jan 2023 00:38:10 +0530 Subject: [PATCH] feat: making regex in bruno lang support windows line endings --- packages/bruno-lang/src/body-tag.js | 4 ++-- packages/bruno-lang/src/env-vars-tag.js | 4 ++-- packages/bruno-lang/src/headers-tag.js | 2 +- packages/bruno-lang/src/params-tag.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/bruno-lang/src/body-tag.js b/packages/bruno-lang/src/body-tag.js index ccc1caece..2810e0863 100644 --- a/packages/bruno-lang/src/body-tag.js +++ b/packages/bruno-lang/src/body-tag.js @@ -63,8 +63,8 @@ const bodyXmlTag = between(bodyXmlBegin)(bodyEnd)(everyCharUntil(bodyEnd)).map(( // generic key value parser const newline = regex(/^\r?\n/); const newLineOrEndOfInput = choice([newline, endOfInput]); -const wordWithoutWhitespace = regex(/^[^\s\t\n]+/g); -const wordWithWhitespace = regex(/^[^\n]+/g); +const wordWithoutWhitespace = regex(/^[^\s\t\r?\n]+/g); +const wordWithWhitespace = regex(/^[^\r?\n]+/g); const line = sequenceOf([ optionalWhitespace, diff --git a/packages/bruno-lang/src/env-vars-tag.js b/packages/bruno-lang/src/env-vars-tag.js index 3b81cff77..d2192799e 100644 --- a/packages/bruno-lang/src/env-vars-tag.js +++ b/packages/bruno-lang/src/env-vars-tag.js @@ -16,8 +16,8 @@ const newLineOrEndOfInput = choice([newline, endOfInput]); const begin = regex(/^vars\s*\r?\n/); const end = regex(/^[\r?\n]*\/vars\s*[\r?\n]*/); -const wordWithoutWhitespace = regex(/^[^\s\t\n]+/g); -const wordWithWhitespace = regex(/^[^\n]+/g); +const wordWithoutWhitespace = regex(/^[^\s\r?\t\n]+/g); +const wordWithWhitespace = regex(/^[^\r?\n]+/g); const line = sequenceOf([ optionalWhitespace, diff --git a/packages/bruno-lang/src/headers-tag.js b/packages/bruno-lang/src/headers-tag.js index 825daf69d..8f28f8a08 100644 --- a/packages/bruno-lang/src/headers-tag.js +++ b/packages/bruno-lang/src/headers-tag.js @@ -17,7 +17,7 @@ const newLineOrEndOfInput = choice([newline, endOfInput]); const begin = regex(/^headers\s*\r?\n/); const end = regex(/^[\r?\n]*\/headers\s*[\r?\n]*/); const wordWithoutWhitespace = regex(/^[^\s\t\n]+/g); -const wordWithWhitespace = regex(/^[^\n]+/g); +const wordWithWhitespace = regex(/^[^\r?\n]+/g); const line = sequenceOf([ optionalWhitespace, diff --git a/packages/bruno-lang/src/params-tag.js b/packages/bruno-lang/src/params-tag.js index f5696262a..fa505a99a 100644 --- a/packages/bruno-lang/src/params-tag.js +++ b/packages/bruno-lang/src/params-tag.js @@ -17,8 +17,8 @@ const newLineOrEndOfInput = choice([newline, endOfInput]); const begin = regex(/^params\s*\r?\n/); const end = regex(/^[\r?\n]*\/params\s*[\r?\n]*/); -const wordWithoutWhitespace = regex(/^[^\s\t\n]+/g); -const wordWithWhitespace = regex(/^[^\n]+/g); +const wordWithoutWhitespace = regex(/^[^\s\t\r?\n]+/g); +const wordWithWhitespace = regex(/^[^\r?\n]+/g); const line = sequenceOf([ optionalWhitespace,