<glimmer-definition>
   <settings>
      <language>JavaScript</language>
      <compiler></compiler>
      <debugger></debugger>
      <execution></execution>
      <auto-indent>1</auto-indent>
      <use-spaces>0</use-spaces>
      <tab-stop>4</tab-stop>
   </settings>

   <mime-types>
      <extension>js</extension>
   </mime-types>

   <syntax-items>
      <syntax-item>
         <name>string</name>
         <start-regex>&quot;</start-regex>
         <end-regex>\(&quot;\|\n\)</end-regex>
         <style>string</style>
      </syntax-item>
      <syntax-item>
         <name>chars</name>
         <start-regex>&apos;</start-regex>
         <end-regex>\(&apos;\|\n\)</end-regex>
         <style>char_string</style>
      </syntax-item>
      <syntax-item>
         <name>cpps_comment</name>
         <start-regex>//</start-regex>
         <end-regex>\n</end-regex>
         <style>comment</style>
      </syntax-item>
      <syntax-item>
         <name>cs_comment</name>
         <start-regex>/\*</start-regex>
         <end-regex>\*/</end-regex>
         <style>comment</style>
      </syntax-item>
   </syntax-items>

   <pattern-items>
      <pattern-item>
         <name>numeric_constant</name>
         <regex>&lt;(?i0[X][\\dA-F]+|\\d+(\\.\\d*)?(?:E[+-]?[\\d]+)?F?|\\.\\d+(?:E[+-]?[\\d]+)?F?|[\\d]+[LF]?))</regex>
         <style>character</style>
      </pattern-item>
      <pattern-item>
         <name>string_escape</name>
         <regex>(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr&apos;\"\"\\\\])</regex>
         <style>character</style>
      </pattern-item>
      <pattern-item>
         <name>primitive</name>
         <regex>\b\(var\)\b</regex>
         <style>keyword</style>
      </pattern-item>
      <pattern-item>
         <name>flow</name>
         <regex>\b\(break\|case\|catch\|continue\|default\|do\|else\|for\|if\|return\|for\|goto\|if\|return\|switch\|switch\|while\)\b</regex>
         <style>keyword</style>
      </pattern-item>
      <pattern-item>
         <name>modifiers</name>
         <regex>\b\(finally\|private\|protected\|public\|static\)\b</regex>
         <style>keyword</style>
      </pattern-item>
      <pattern-item>
         <name>memory</name>
         <regex>\b\(new\|null\|super\this\|void\)\b</regex>
         <style>keyword</style>
      </pattern-item>
      <pattern-item>
         <name>unused</name>
         <regex>\b\(const\|gotol\|transient\)\b</regex>
         <style>keyword</style>
      </pattern-item>
      <pattern-item>
         <name>operators</name>
         <regex>\(\*\|-)\|::\|&lt;&lt;\|&lt;\|&gt;&gt;\|&gt;\|=\|==\|!=\|&lt;=\|&gt;=\|)=\|++\|--\|%\|+\|-\|||\|&amp;&amp;\|!\|+=\|-=\|\*=\|/=\|%=\)</regex>
         <style>operator</style>
      </pattern-item>
   </pattern-items>
</glimmer-definition>

<python-definition>
import glimmer
import string

def js_enter_callback():
    insert = "\n"
    extralen = 0
    slen = 0
    file = glimmer.get_file_number()
    tstart = glimmer.line_start()
    tend = glimmer.current_position()
    if (tend-tstart) > 0:
        chars = glimmer.get_text(tstart, tend)
        slen = len(chars)
        if slen > 0:
            index = 0
            while index < slen:
                c = chars[index]
                if c == '\t' or c == ' ':
                    insert = insert + chars[index]
                    index = index+1
                else:
                    break
            c = chars[slen-1]
            if c == '{':
                extralen = glimmer.get_file_tab_width(file)
                if glimmer.get_file_use_spaces(file):
                    while extralen > 0:
                        insert = insert + " "
                        extralen = extralen-1
                else:
                    insert = insert + '\t'
    glimmer.insert(insert)

glimmer.register_signal_hook("enter-pressed", js_enter_callback)

def js_tab_callback():
   tablen = 0
   insertchars = ""
   file = glimmer.get_file_number()
   if glimmer.get_file_use_spaces(file):
      tablen = glimmer.get_file_tab_width(file)
      pos = glimmer.current_position()
      lstart = glimmer.line_start()
      if pos - lstart > 0:
         str1 = glimmer.get_text(lstart, pos)
      else:
         str1 = ""
      if glimmer.get_tab_stops():
         str1 = string.expandtabs(str1, tablen)
         len1 = len(str1)
         del str1
         tablen = tablen - (len1 % tablen)
      while tablen > 0:
         insertchars = insertchars + " "
         tablen = tablen-1
   else:
      insertchars = insertchars + "\t"
   glimmer.insert(insertchars)

glimmer.register_signal_hook("tab-pressed", js_tab_callback)
</python-definition>
