   return ret
 
 module.exports = (sami, options) ->
-  errors = []
-  definedLangs = {
-    KRCC: {
-      lang: 'ko'
-      reClassName: new RegExp("class[^=]*?=[\"'\S]*(KRCC)['\"\S]?", 'i')
-    },
-    ENCC: {
-      lang: 'en'
-      reClassName: new RegExp("class[^=]*?=[\"'\S]*(ENCC)['\"\S]?", 'i')
-    },
-    JPCC: {
-      lang: 'ja'
-      reClassName: new RegExp("class[^=]*?=[\"'\S]*(JPCC)['\"\S]?", 'i')
-    }
-  }
 
   parse = () ->
+    error = (error) ->
+      e = new Error(error)
+      e.line = lineNum
+      e.context = element
+      errors.push(e)
+
     lineNum = 1
     ret = []
     tempRet = {}

      else
        element = str.slice(startTagIdx)

      elementLineNum = lineNum += str.slice(0, startTagIdx).match(reLineEnding)?.length or 0 
      if isBroken = reBrokenTag.test(element)
        e = new Error('ERROR_BROKEN_TAGS')
        e.line = elementLineNum
        e.context = element
        errors.push(e)

      str = str.slice(startTagIdx+nextStartTagIdx)

      startTime = +element.match(reStartTime)?[1]

      if startTime is null or startTime < 0
        e = new Error('ERROR_INVALID_TIME')
        e.line = elementLineNum
        e.context = element
        errors.push(e)
      
      lang = getLanguage(element)
      if !lang
        e = new Error('ERROR_INVALID_LANGUAGE')
        e.line = elementLineNum
        e.context = element
        errors.push(e)

      lineNum += element.match(reLineEnding)?.length or 0
      element = element.replace(reLineEnding, '')

cssParse = require 'css-parse'
langCodes = require './lang_codes.js'

reOpenSync = /<sync/i
reCloseSync = /<sync|<\/body|<\/sami/i
reLineEnding = /\r\n?|\n/g
reBrokenTag = /<[a-z]*[^>]*<[a-z]*/g
reStartTime = /<sync[^>]+?start[^=]*=[^0-9]*([0-9]*)["^0-9"]*/i
reBr = /<br[^>]*>/ig
reStyle = /<style[^>]*>([\s\S]*?)<\/style[^>]*>/i
reComment = /(<!--|-->)/g

# from http://coffeescriptcookbook.com/chapters/classes_and_objects/cloning
clone = (obj) ->
  if not obj? or typeof obj isnt 'object'
