mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
don't add a breaking change to Parser constructor
This commit is contained in:
@@ -30,7 +30,8 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new_parser(input)
|
def new_parser(input)
|
||||||
Parser.new(input, @string_scanner)
|
@string_scanner.string = input
|
||||||
|
Parser.new(@string_scanner)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_tokenizer(source, start_line_number: nil, for_liquid_tag: false)
|
def new_tokenizer(source, start_line_number: nil, for_liquid_tag: false)
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
module Liquid
|
module Liquid
|
||||||
class Parser
|
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)
|
@tokens = Lexer.tokenize(input, string_scanner)
|
||||||
@p = 0 # pointer to current location
|
@p = 0 # pointer to current location
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user