From 7c94ae1500f6911defec2689fa7b0c4625e13222 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 7 Feb 2025 00:55:39 +0900 Subject: [PATCH] feat: use escaped_uUx in parse_escape_sequence --- include/toml11/parser.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/toml11/parser.hpp b/include/toml11/parser.hpp index fc88a30..83ef3d0 100644 --- a/include/toml11/parser.hpp +++ b/include/toml11/parser.hpp @@ -1246,8 +1246,7 @@ parse_escape_sequence(location& loc, const context& ctx) } else if(spec.v1_1_0_add_escape_sequence_x && loc.current() == 'x') { - auto scanner = sequence(character('x'), repeat_exact(2, syntax::hexdig(spec))); - const auto reg = scanner.scan(loc); + const auto reg = syntax::escaped_x2(spec).scan(loc); if( ! reg.is_ok()) { auto src = source_location(region(loc)); @@ -1264,8 +1263,7 @@ parse_escape_sequence(location& loc, const context& ctx) } else if(loc.current() == 'u') { - auto scanner = sequence(character('u'), repeat_exact(4, syntax::hexdig(spec))); - const auto reg = scanner.scan(loc); + const auto reg = syntax::escaped_u4(spec).scan(loc); if( ! reg.is_ok()) { auto src = source_location(region(loc)); @@ -1282,8 +1280,7 @@ parse_escape_sequence(location& loc, const context& ctx) } else if(loc.current() == 'U') { - auto scanner = sequence(character('U'), repeat_exact(8, syntax::hexdig(spec))); - const auto reg = scanner.scan(loc); + const auto reg = syntax::escaped_U8(spec).scan(loc); if( ! reg.is_ok()) { auto src = source_location(region(loc));