mirror of
https://github.com/Shopify/liquid.git
synced 2025-12-03 00:00:35 -05:00
15 lines
325 B
Ruby
15 lines
325 B
Ruby
module Liquid
|
|
# This class is used by tags to parse themselves
|
|
# it provides helpers and encapsulates state
|
|
class Parser
|
|
def initialize(input)
|
|
@tokens = tokenize(input)
|
|
@p = 0 # pointer to current location
|
|
end
|
|
|
|
def tokenize(input)
|
|
input.split(/\b/).map {|tok| tok.strip}
|
|
end
|
|
end
|
|
end
|