mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
chore: bruno lang improve parsing logic of headers and params
This commit is contained in:
parent
5e1d6cba4a
commit
c29ab50a3d
@ -15,25 +15,18 @@ const {
|
||||
const newline = regex(/^\r?\n/);
|
||||
const newLineOrEndOfInput = choice([newline, endOfInput]);
|
||||
|
||||
const begin = sequenceOf([
|
||||
regex(/^headers[^\S\r\n]*/),
|
||||
newline
|
||||
]);
|
||||
|
||||
const end = sequenceOf([
|
||||
regex(/^\/headers[^\S\r\n]*/),
|
||||
newLineOrEndOfInput
|
||||
]);
|
||||
const key = everyCharUntil(whitespace);
|
||||
const value = everyCharUntil(whitespace);
|
||||
const begin = regex(/^headers\s*\r?\n/);
|
||||
const end = regex(/^[\r?\n]*\/headers\s*[\r?\n]*/);
|
||||
const word = regex(/^[^\s\t\n]+/g);
|
||||
|
||||
const line = sequenceOf([
|
||||
optionalWhitespace,
|
||||
digit,
|
||||
whitespace,
|
||||
key,
|
||||
word,
|
||||
whitespace,
|
||||
value,
|
||||
word,
|
||||
newLineOrEndOfInput
|
||||
]).map(([_, enabled, __, key, ___, value]) => {
|
||||
return {
|
||||
|
@ -15,25 +15,17 @@ const {
|
||||
const newline = regex(/^\r?\n/);
|
||||
const newLineOrEndOfInput = choice([newline, endOfInput]);
|
||||
|
||||
const begin = sequenceOf([
|
||||
regex(/^params[^\S\r\n]*/),
|
||||
newline
|
||||
]);
|
||||
|
||||
const end = sequenceOf([
|
||||
regex(/^\/params[^\S\r\n]*/),
|
||||
newLineOrEndOfInput
|
||||
]);
|
||||
const key = everyCharUntil(whitespace);
|
||||
const value = everyCharUntil(whitespace);
|
||||
const begin = regex(/^params\s*\r?\n/);
|
||||
const end = regex(/^[\r?\n]*\/params\s*[\r?\n]*/);
|
||||
const word = regex(/^[^\s\t\n]+/g);
|
||||
|
||||
const line = sequenceOf([
|
||||
optionalWhitespace,
|
||||
digit,
|
||||
whitespace,
|
||||
key,
|
||||
word,
|
||||
whitespace,
|
||||
value,
|
||||
word,
|
||||
newLineOrEndOfInput
|
||||
]).map(([_, enabled, __, key, ___, value]) => {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user