Update infrastructure that handles parsing switching:

* Remove development helpers from parse context
* Simplify strict_parse_with_error_mode_fallback and update
  documentation
* Add unit tests for `Liquid::Expression` and `Liquid::ParseContext`
* Update test helpers to work better with the `:rigid` mode
This commit is contained in:
Guilherme Carreiro
2025-10-27 16:33:31 +01:00
committed by Guilherme Carreiro
parent 4cd367d971
commit 738540a601
5 changed files with 170 additions and 17 deletions
+5 -7
View File
@@ -6,16 +6,14 @@ module Liquid
#
# It's basically doing the same thing the {#parse_with_selected_parser},
# except this will try the strict parser regardless of the error mode,
# and fall back to the lax parser if the error mode is lax or warn.
# and fall back to the lax parser if the error mode is lax or warn,
# except when in rigid mode where it uses the rigid parser.
#
# @deprecated Use {#parse_with_selected_parser} instead.
def strict_parse_with_error_mode_fallback(markup)
case parse_context.error_mode
when :rigid
rigid_parse_with_error_context(markup)
else
strict_parse_with_error_context(markup)
end
return rigid_parse_with_error_context(markup) if rigid_mode?
strict_parse_with_error_context(markup)
rescue SyntaxError => e
case parse_context.error_mode
when :rigid