Method: PSD::EngineData#parse_tokens

Defined in:
lib/psd/enginedata.rb

#parse_tokens(text) ⇒ Object

Go through each instruction until a token match is found, then parse the matches.

Raises:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/psd/enginedata.rb', line 76

def parse_tokens(text)
  INSTRUCTIONS.each do |inst|
    match = inst.match(text)
    return inst.new(self, text).execute! if match
  end

  # This is a hack for the Japanese character rules that the format embeds
  match = Instruction::String.match(text + @text.next)
  if match
    text += @text.next!
    return Instruction::String.new(self, text).execute!
  end

  raise TokenNotFound.new("Text = #{text.dump}, Line = #{@text.line + 1}")
end