forked from extern/bruno
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 newline = regex(/^\r?\n/);
|
||||||
const newLineOrEndOfInput = choice([newline, endOfInput]);
|
const newLineOrEndOfInput = choice([newline, endOfInput]);
|
||||||
|
|
||||||
const begin = sequenceOf([
|
|
||||||
regex(/^headers[^\S\r\n]*/),
|
|
||||||
newline
|
|
||||||
]);
|
|
||||||
|
|
||||||
const end = sequenceOf([
|
const begin = regex(/^headers\s*\r?\n/);
|
||||||
regex(/^\/headers[^\S\r\n]*/),
|
const end = regex(/^[\r?\n]*\/headers\s*[\r?\n]*/);
|
||||||
newLineOrEndOfInput
|
const word = regex(/^[^\s\t\n]+/g);
|
||||||
]);
|
|
||||||
const key = everyCharUntil(whitespace);
|
|
||||||
const value = everyCharUntil(whitespace);
|
|
||||||
|
|
||||||
const line = sequenceOf([
|
const line = sequenceOf([
|
||||||
optionalWhitespace,
|
optionalWhitespace,
|
||||||
digit,
|
digit,
|
||||||
whitespace,
|
whitespace,
|
||||||
key,
|
word,
|
||||||
whitespace,
|
whitespace,
|
||||||
value,
|
word,
|
||||||
newLineOrEndOfInput
|
newLineOrEndOfInput
|
||||||
]).map(([_, enabled, __, key, ___, value]) => {
|
]).map(([_, enabled, __, key, ___, value]) => {
|
||||||
return {
|
return {
|
||||||
|
@ -15,25 +15,17 @@ const {
|
|||||||
const newline = regex(/^\r?\n/);
|
const newline = regex(/^\r?\n/);
|
||||||
const newLineOrEndOfInput = choice([newline, endOfInput]);
|
const newLineOrEndOfInput = choice([newline, endOfInput]);
|
||||||
|
|
||||||
const begin = sequenceOf([
|
const begin = regex(/^params\s*\r?\n/);
|
||||||
regex(/^params[^\S\r\n]*/),
|
const end = regex(/^[\r?\n]*\/params\s*[\r?\n]*/);
|
||||||
newline
|
const word = regex(/^[^\s\t\n]+/g);
|
||||||
]);
|
|
||||||
|
|
||||||
const end = sequenceOf([
|
|
||||||
regex(/^\/params[^\S\r\n]*/),
|
|
||||||
newLineOrEndOfInput
|
|
||||||
]);
|
|
||||||
const key = everyCharUntil(whitespace);
|
|
||||||
const value = everyCharUntil(whitespace);
|
|
||||||
|
|
||||||
const line = sequenceOf([
|
const line = sequenceOf([
|
||||||
optionalWhitespace,
|
optionalWhitespace,
|
||||||
digit,
|
digit,
|
||||||
whitespace,
|
whitespace,
|
||||||
key,
|
word,
|
||||||
whitespace,
|
whitespace,
|
||||||
value,
|
word,
|
||||||
newLineOrEndOfInput
|
newLineOrEndOfInput
|
||||||
]).map(([_, enabled, __, key, ___, value]) => {
|
]).map(([_, enabled, __, key, ___, value]) => {
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user