don't add a breaking change to Parser constructor

This commit is contained in:
Michael Go
2025-01-07 14:32:46 -04:00
parent e05719fb82
commit 253ec81b56
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -30,7 +30,8 @@ module Liquid
end
def new_parser(input)
Parser.new(input, @string_scanner)
@string_scanner.string = input
Parser.new(@string_scanner)
end
def new_tokenizer(source, start_line_number: nil, for_liquid_tag: false)
+2 -1
View File
@@ -2,7 +2,8 @@
module Liquid
class Parser
def initialize(input, string_scanner)
def initialize(input)
input = input.is_a?(StringScanner) ? input : StringScanner.new(input.to_s)
@tokens = Lexer.tokenize(input, string_scanner)
@p = 0 # pointer to current location
end