Skip to content

Commit

Permalink
Keep Combinator.re as a module name
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Jul 10, 2024
1 parent 4b28c93 commit 89d0546
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 17 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/css-property-parser/lib/Css_property_parser.re
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Parser = Parser;
module Rule = Rule;
module Standard = Standard;
module Combine = Combine;
module Combinator = Combinator;
module Modifier = Modifier;
9 changes: 4 additions & 5 deletions packages/css-property-parser/lib/Standard.re
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ let ident =

// https://drafts.csswg.org/css-values-4/#textual-values
let css_wide_keywords =
Combine.xor([
Combinator.xor([
value(`Initial, keyword("initial")),
value(`Inherit, keyword("inherit")),
value(`Unset, keyword("unset")),
Expand Down Expand Up @@ -201,12 +201,11 @@ let url = {
| _ => Error(["expected a url"]),
);
let url_fun = function_call("url", string);
Combine.xor([url_token, url_fun]);
Combinator.xor([url_token, url_fun]);
};

// TODO: <url-modifier>
// https://drafts.csswg.org/css-values-4/#urls
let var = function_call("var", dashed_ident);
// https://drafts.csswg.org/css-variables-2/#funcdef-var
/* let var = function_call("var", dashed_ident); */

// css-color-4
// https://drafts.csswg.org/css-color-4/#hex-notation
Expand Down
2 changes: 1 addition & 1 deletion packages/css-property-parser/lib/Standard.rei
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ let string: Rule.rule(string);

let url: Rule.rule(string);

let var: Rule.rule(string);
/* let var: Rule.rule(string); */

let hex_color: Rule.rule(string);

Expand Down
8 changes: 4 additions & 4 deletions packages/css-property-parser/ppx/Generate.re
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,10 @@ module Make = (Builder: Ppxlib.Ast_builder.S) => {
};
let op_ident =
fun
| Static => evar("Combine.static")
| Xor => evar("Combine.xor")
| And => evar("Combine.and_")
| Or => evar("Combine.or_");
| Static => evar("Combinator.static")
| Xor => evar("Combinator.xor")
| And => evar("Combinator.and_")
| Or => evar("Combinator.or_");

let map_value = (content, (name, value)) => {
let variant = pexp_variant(name, content ? Some(evar("v")) : None);
Expand Down
8 changes: 4 additions & 4 deletions packages/css-property-parser/test/snapshots/Spec.expected.re
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ let rec _legacy_gradient:
list(Tokens.token),
) =
tokens =>
Combine.xor(
Combinator.xor(
[
map(function__webkit_gradient, v => `Function__webkit_gradient(v)),
map(_legacy_linear_gradient, v => `_legacy_linear_gradient(v)),
Expand All @@ -119,7 +119,7 @@ and _legacy_linear_gradient:
list(Tokens.token),
) =
tokens =>
Combine.xor(
Combinator.xor(
[
map(
function_call(
Expand Down Expand Up @@ -155,7 +155,7 @@ and property_height:
list(Tokens.token),
) =
tokens =>
Combine.xor(
Combinator.xor(
[
map(keyword("auto"), _v => `Auto),
map(extended_length, v => `Extended_length(v)),
Expand All @@ -166,7 +166,7 @@ and property_height:
map(
function_call(
"fit-content",
Combine.xor([
Combinator.xor([
map(extended_length, v => `Extended_length(v)),
map(extended_percentage, v => `Extended_percentage(v)),
]),
Expand Down
2 changes: 1 addition & 1 deletion packages/ppx/src/Property_to_runtime.re
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ let render_variable = (~loc, name) =>
let transform_with_variable = (parser, mapper, value_to_expr) => {
Css_property_parser.(
emit(
Combine.xor([
Combinator.xor([
/* If the entire CSS value is interpolated, we treat it as a `Variable */
Rule.Match.map(Standard.interpolation, data => `Variable(data)),
/* Otherwise it's a regular CSS `Value and match the parser */
Expand Down
2 changes: 1 addition & 1 deletion packages/ppx/src/Property_to_string.re
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ let found = ({ast_of_string, string_to_expr, _}) => {

let transform_with_variable = (parser, mapper, value_to_expr) =>
emit(
Combine.xor([
Combinator.xor([
/* If the CSS value is an interpolation, we treat as one `
ariable */
Rule.Match.map(Standard.interpolation, data => `Variable(data)),
Expand Down

0 comments on commit 89d0546

Please sign in to comment.