mirror of
https://github.com/kemko/liquid.git
synced 2026-01-04 09:15:41 +03: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
|