Skip to content

Commit

Permalink
What they write \f in the spec actually means \n.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mbodin committed Dec 4, 2023
1 parent 6dff852 commit 5796920
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions syntax/attribute_value.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ let list
|> Common.list loc
|> fun e -> Some e

let spaces = list (Re_str.regexp "[ \t\r\f]+") "space"
let commas = list (Re_str.regexp "[ \t\r\f]*,[ \t\r\f]*") "comma"
let semicolons = list (Re_str.regexp "[ \t\r\f]*;[ \t\r\f]*") "semicolon"
let spaces = list (Re_str.regexp "[ \t\r\n]+") "space"
let commas = list (Re_str.regexp "[ \t\r\n]*,[ \t\r\n]*") "comma"
let semicolons = list (Re_str.regexp "[ \t\r\n]*;[ \t\r\n]*") "semicolon"

let spaces_or_commas_regexp = Re_str.regexp "\\([ \t\r\f]*,[ \t\r\f]*\\)\\|[ \t\r\f]+"
let spaces_or_commas_regexp = Re_str.regexp "\\([ \t\r\n]*,[ \t\r\n]*\\)\\|[ \t\r\n]+"
let spaces_or_commas_ = exp_list spaces_or_commas_regexp "space- or comma"
let spaces_or_commas = list spaces_or_commas_regexp "space- or comma"

Expand Down Expand Up @@ -348,7 +348,7 @@ let offset =
end [@metaloc loc]

let transform_item =
let regexp = Re_str.regexp "\\([a-zA-Z]+\\)[ \t\r\f]*(\\([^)]*\\))" in
let regexp = Re_str.regexp "\\([a-zA-Z]+\\)[ \t\r\n]*(\\([^)]*\\))" in

fun ?separated_by:_ ?default:_ loc name s ->
if not @@ does_match regexp s then
Expand Down Expand Up @@ -409,8 +409,8 @@ let transform_item =
Some e

let rec transform =
let regexp_wsp = Re_str.regexp "[ \t\r\f]*" in
let regexp = Re_str.regexp "[ \t\r\f]*\\([a-zA-Z]+[ \t\r\f]*([^)]*)\\)\\(.*\\)" in
let regexp_wsp = Re_str.regexp "[ \t\r\n]*" in
let regexp = Re_str.regexp "[ \t\r\n]*\\([a-zA-Z]+[ \t\r\n]*([^)]*)\\)\\(.*\\)" in

fun ?separated_by:_ ?default:_ loc name s ->
if does_match regexp_wsp s then
Expand All @@ -419,9 +419,9 @@ let rec transform =
begin
let item = Re_str.matched_group 1 s in
let rest = Re_str.matched_group 2 s in
Option.bind (transform_item ~separated_by ~default loc name item) (fun item ->
Option.bind (transform ~separated_by ~default loc name rest) (fun l ->
Some (item :: l)))
Option.bind (transform_item loc name item) (fun item ->
Option.bind (transform loc name rest) (fun l ->
Some [%expr [%e item] :: [%e l]]))
end
else
Common.error loc "Value of %s is not a list of SVG transform" name
Expand Down

0 comments on commit 5796920

Please sign in to comment.