Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dep version bumps #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "relude-parse",
"version": "0.8.0",
"version": "0.8.1",
"description": "Monadic parsing with Relude",
"main": "index.js",
"scripts": {
Expand All @@ -24,14 +24,14 @@
},
"homepage": "https://github.com/reazen/relude-parse#readme",
"peerDependencies": {
"bs-bastet": "^1.2.5",
"relude": "^0.59.0"
"bs-bastet": "*",
"relude": "trite/relude#dep-version-bumps"
},
"devDependencies": {
"@glennsl/bs-jest": "^0.5.1",
"bs-bastet": "^1.2.5",
"bs-platform": "^7.2.2",
"relude": "^0.59.0"
"bs-bastet": "*",
"bs-platform": "*",
"relude": "trite/relude#dep-version-bumps"
},
"jest": {
"verbose": false,
Expand Down
46 changes: 23 additions & 23 deletions src/ReludeParse_Parser.re
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ let rec timesMax: 'a. (int, t('a)) => t(list('a)) =
pure([]);
} else {
List.concat
<$> (pa <#> (a => [a]) <|> pure([]))
<$> (pa <$$> (a => [a]) <|> pure([]))
<*> timesMax(max - 1, pa);
};

Expand Down Expand Up @@ -534,7 +534,7 @@ and sepBy1: 'a 'sep. (t('sep), t('a)) => t(Nel.t('a)) =
pa
>>= (
h => {
many(ps *> pa) <#> (t => Nel.make(h, t));
many(ps *> pa) <$$> (t => Nel.make(h, t));
}
);
};
Expand All @@ -556,7 +556,7 @@ and sepByOptEnd1: 'a 'sep. (t('sep), t('a)) => t(Nel.t('a)) =
ps
>>= (
_ => {
sepByOptEnd(ps, pa) <#> (t => Nel.make(h, t));
sepByOptEnd(ps, pa) <$$> (t => Nel.make(h, t));
}
)
<|> pure(Nel.pure(h));
Expand Down Expand Up @@ -593,7 +593,7 @@ Parses 1 or more values separated by a right-associative operator.
*/
and chainr1': 'a. (t(('a, 'a) => 'a), 'a, t('a)) => t('a) =
(pf, a, pa) =>
pf >>= (f => chainr1(pf, pa) <#> (a2 => f(a, a2))) <|> pure(a);
pf >>= (f => chainr1(pf, pa) <$$> (a2 => f(a, a2))) <|> pure(a);

/**
Parses 0 or more values separated by a left-associative operator.
Expand Down Expand Up @@ -650,12 +650,12 @@ let getNonEmptyStr: t(string) => t(string) =
/**
* Converts a parser of a tuple2 into a parser of the first value.
*/
let getFst: 'a 'b. t(('a, 'b)) => t('a) = pab => pab <#> (((a, _)) => a);
let getFst: 'a 'b. t(('a, 'b)) => t('a) = pab => pab <$$> (((a, _)) => a);

/**
* Converts a parser of a tuple2 into a parser of the second value.
*/
let getSnd: 'a 'b. t(('a, 'b)) => t('b) = pab => pab <#> (((_, b)) => b);
let getSnd: 'a 'b. t(('a, 'b)) => t('b) = pab => pab <$$> (((_, b)) => b);

/**
Parses 0 or more values up until an end value, producing a list of values and the end value
Expand All @@ -669,7 +669,7 @@ let rec manyUntilWithEnd:
>>= (term => pure(([], term)))
<|> (
many1UntilWithEnd(pt, pa)
<#> (((nel, term)) => (Nel.toList(nel), term))
<$$> (((nel, term)) => (Nel.toList(nel), term))
)

/**
Expand All @@ -686,10 +686,10 @@ and many1UntilWithEnd:
>>= (
a => {
pt
<#> (term => (Nel.pure(a), term))
<$$> (term => (Nel.pure(a), term))
<|> (
many1UntilWithEnd(pt, pa)
<#> (((nel, term)) => (Nel.cons(a, nel), term))
<$$> (((nel, term)) => (Nel.cons(a, nel), term))
);
}
);
Expand All @@ -716,7 +716,7 @@ let rec manyUntilPeekWithEnd:
>>= (term => pure(([], term)))
<|> (
many1UntilPeekWithEnd(pt, pa)
<#> (
<$$> (
((nel, term)) => {
(Nel.toList(nel), term);
}
Expand All @@ -735,10 +735,10 @@ and many1UntilPeekWithEnd:
>>= (
a => {
lookAhead(pt)
<#> (term => (Nel.pure(a), term))
<$$> (term => (Nel.pure(a), term))
<|> (
many1UntilPeekWithEnd(pt, pa)
<#> (((nel, term)) => (Nel.cons(a, nel), term))
<$$> (((nel, term)) => (Nel.cons(a, nel), term))
);
}
);
Expand Down Expand Up @@ -878,19 +878,19 @@ let anyDigit: t(string) = string_of_int <$> anyDigitAsInt;
/**
Matches any string (warning: this will likely consume as much input as possible)
*/
let anyStr: t(string) = many(anyChar) <#> List.String.join;
let anyStr: t(string) = many(anyChar) <$$> List.String.join;

/**
Matches any non-empty string
*/
let anyNonEmptyStr: t(string) =
many1(anyChar) <#> (Nel.toList >> List.String.join);
many1(anyChar) <$$> (Nel.toList >> List.String.join);

/**
Matches any non-empty string of digits
*/
let anyNonEmptyDigits: t(string) =
many1(anyDigit) <#> (Nel.toList >> List.String.join);
many1(anyDigit) <$$> (Nel.toList >> List.String.join);

/**
Matches the given string (case-sensitive)
Expand Down Expand Up @@ -1039,21 +1039,21 @@ let anyNonZeroDigit: t(string) = anyCharInRange(49, 57);
/**
Matches any non-zero digit character as an int
*/
let anyNonZeroDigitAsInt: t(int) = anyNonZeroDigit <#> int_of_string;
let anyNonZeroDigitAsInt: t(int) = anyNonZeroDigit <$$> int_of_string;

/**
Matches a string of digits starting with a 0 or a digit 1-9 followed by any other digits
*/
let anyUnsignedInt: t(int) =
str("0")
<#> int_of_string
<$$> int_of_string
<|> (
anyNonZeroDigit
>>= (
nonZeroDigit =>
many(anyDigit)
<#> List.String.join
<#> (otherDigits => int_of_string(nonZeroDigit ++ otherDigits)) // int_of_string is unsafe, but we are relatively sure we have a valid int string here, so we'll allow it
<$$> List.String.join
<$$> (otherDigits => int_of_string(nonZeroDigit ++ otherDigits)) // int_of_string is unsafe, but we are relatively sure we have a valid int string here, so we'll allow it
)
);

Expand All @@ -1068,7 +1068,7 @@ Matches a "-" negative sign followed by a digit 1-9, followed by any other digit
let anyNegativeInt: t(int) =
str("-")
*> anyUnsignedInt
<#> (i => i * (-1))
<$$> (i => i * (-1))
<?> "Expected any negative int";

/**
Expand Down Expand Up @@ -1237,12 +1237,12 @@ let anyDecimal: t(string) =
/**
Matches a string "true" (case-insensitive)
*/
let boolTrue: t(bool) = strIgnoreCase("true") <#> (_ => true);
let boolTrue: t(bool) = strIgnoreCase("true") <$$> (_ => true);

/**
Matches a string "false" (case-insensitive)
*/
let boolFalse: t(bool) = strIgnoreCase("false") <#> (_ => false);
let boolFalse: t(bool) = strIgnoreCase("false") <$$> (_ => false);

/**
Matches true or false
Expand Down Expand Up @@ -1359,7 +1359,7 @@ let lf: t(string) = str("\n");
/**
* Matches a \r\n carriage return + line feed line ending
*/
let crlf: t(string) = cr <^> lf <#> (((a, b)) => a ++ b);
let crlf: t(string) = cr <^> lf <$$> (((a, b)) => a ++ b);

/**
* Matches any of the common line endings `\r\n`, `\n` or `\r`
Expand Down
20 changes: 10 additions & 10 deletions src/extras/ReludeParse_IPv6.re
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ let show: t => string =
|> List.map(Js.Int.toStringWithRadix(~radix=16))
|> List.String.joinWith(":");

let allZeroGroup: P.t(int) = timesMinMax(1, 4, str("0")) <#> (_ => 0);
let allZeroGroup: P.t(int) = timesMinMax(1, 4, str("0")) <$$> (_ => 0);

let threeZeroPadGroup =
times(3, str("0"))
*> anyHexDigit
<#> (hexDigit => int_of_string("0x" ++ hexDigit));
<$$> (hexDigit => int_of_string("0x" ++ hexDigit));

let twoZeroPadGroup =
times(2, str("0"))
*> timesMinMax(1, 2, anyHexDigit)
<#> List.String.join
<#> (hexDigits => int_of_string("0x" ++ hexDigits));
<$$> List.String.join
<$$> (hexDigits => int_of_string("0x" ++ hexDigits));

let oneZeroPadGroup =
str("0")
*> timesMinMax(1, 3, anyHexDigit)
<#> List.String.join
<#> (hexDigits => int_of_string("0x" ++ hexDigits));
<$$> List.String.join
<$$> (hexDigits => int_of_string("0x" ++ hexDigits));

let nonZeroPaddedGroup: P.t(int) =
(anyNonZeroHexDigit, timesMax(3, anyHexDigit) <#> List.String.join)
(anyNonZeroHexDigit, timesMax(3, anyHexDigit) <$$> List.String.join)
|> mapTuple2((first, rest) => first ++ rest)
<#> (hexDigits => int_of_string("0x" ++ hexDigits));
<$$> (hexDigits => int_of_string("0x" ++ hexDigits));

let emptyGroup: P.t(int) = str("") <#> (_ => 0);
let emptyGroup: P.t(int) = str("") <$$> (_ => 0);

let group: P.t(int) =
tries(threeZeroPadGroup)
Expand Down Expand Up @@ -96,7 +96,7 @@ let groups: P.t(t) = {
);
};

let loopbackAbbreviated = str("::1") <#> const(loopback);
let loopbackAbbreviated = str("::1") <$$> const(loopback);

let parser: P.t(t) = loopbackAbbreviated <|> groups;

Expand Down
2 changes: 1 addition & 1 deletion src/extras/ReludeParse_UUID.re
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let unsafeFromParts = (a, b, c, d, e) =>
let show: t => string = (UUID(str)) => str;

let hexDigits: int => Parser.t(string) =
count => Parser.(times(count, anyHexDigit) <#> List.String.join);
count => Parser.(times(count, anyHexDigit) <$$> List.String.join);

let hyphen = Parser.str("-");

Expand Down