On Fri, Oct 21, 2011 at 5:22 AM, Edward K. Ream <[email protected]> wrote:

> At minimum, there should be entries in leoApp.py for all languages
> supported by Leo's colorizer.

Here is a script that produces the desired entries for
g.app.language_delims_dict.  It's not perfect (it doesn't know about
various comment hacks) but it eliminates most of the tedium associated
with bug::

keys = ("lineComment","commentStart","commentEnd",)
d = {}
    # Keys are language names.
    # Values are a list of comment delims, in keys order.
paths,modes_path = get_paths()
for path in paths:
    module_name = g.shortFileName(path)[:-3]
    module = import_module(module_name,modes_path)
    aList = []
    for key in keys:
        val = module.properties.get(key)
        if val: aList.append(val)
    d[module_name] = aList

print('-'* 20)
print('language_delims_dict')
for key in sorted(d):
    print('%16s: "%s"' % ('"%s"' % (key),' '.join(d.get(key))))

Note: Sources omitted for the two helper functions, get_paths and import_module.

The tedious part will be to associate file extensions with language names.

Edward

P.S.  And here is the output, untouched.  It looks best in a monospaced font.
--------------------
language_delims_dict
  "actionscript": "// /* */"
         "ada95": "--"
           "ahk": ";"
         "antlr": "// /* */"
    "apacheconf": "#"
          "apdl": "!"
   "applescript": "-- (* *)"
           "asp": "<!-- -->"
      "aspect_j": "// /* */"
"assembly_macro32": ";"
"assembly_mcs51": ";"
"assembly_parrot": "#"
"assembly_r2000": ""
  "assembly_x86": ";"
           "awk": "#"
             "b": "// /* */"
         "batch": "rem"
           "bbj": "/* */"
          "bcel": "// /* */"
        "bibtex": "%"
             "c": "// /* */"
         "chill": "/* */"
         "cobol": "*"
    "coldfusion": "<!-- -->"
     "cplusplus": "// /* */"
        "csharp": "// /* */"
           "css": "/* */"
    "cvs_commit": ""
        "cython": "#"
             "d": "// /* */"
       "doxygen": "#"
         "dsssl": "; <!-- -->"
        "eiffel": "--"
       "embperl": "<!-- -->"
        "erlang": "%"
        "factor": "! ( )"
         "forth": "\"
       "fortran": ""
     "fortran90": ""
        "foxpro": "&&"
    "freemarker": ""
       "gettext": "# "
        "groovy": "// /* */"
       "haskell": "-- {- -}"
          "haxe": "// /* */"
           "hex": ""
          "html": "<!-- -->"
          "i4gl": "-- { }"
          "icon": "#"
           "idl": "// /* */"
        "inform": "!"
           "ini": ";"
    "inno_setup": ";"
      "interlis": "/* */"
            "io": "// */"
          "java": "// /* */"
    "javascript": "// /* */"
           "jcl": ""
         "jhtml": "<!-- -->"
           "jmk": "#"
           "jsp": "<%-- --%>"
         "latex": "%"
      "lilypond": "% %{ %}"
          "lisp": "; #|   |#"
         "lotos": "(* *)"
           "lua": "-- --[[ ]]"
          "mail": ">"
      "makefile": "#"
         "maple": "//"
        "matlab": "%"
            "ml": "(* *)"
       "modula3": "(* *)"
          "moin": "##"
          "mqsc": "*"
       "netrexx": "-- /* */"
           "nqc": "// /* */"
           "nsi": ";"
         "nsis2": ";"
   "objective_c": "// /* */"
    "objectrexx": "-- /* */"
         "occam": "--"
      "omnimark": ";"
        "pascal": "// { }"
         "patch": ""
          "perl": "#"
           "php": "<!-- -->"
    "phpsection": "<!-- -->"
          "pike": "// /* */"
           "pl1": "/* */"
         "plain": ""
         "plsql": "-- /* */"
         "pop11": ";;; /* */"
    "postscript": "%"
        "povray": "// /* */"
   "powerdynamo": "// <!-- -->"
      "progress": "&scop cmt  /* */"
        "prolog": "% /* */"
         "props": "#"
   "pseudoplain": ""
           "psp": "<!-- -->"
           "ptl": "#"
        "pvwave": ";"
         "pyrex": "#"
        "python": "#"
             "r": "#"
         "rebol": "; comment { }"
       "redcode": ";"
"relax_ng_compact": "#"
          "rest": ".."
         "rhtml": "<%# %>"
           "rib": "#"
       "rpmspec": "#"
           "rtf": ""
          "ruby": "# =begin =end"
         "rview": "// /* */"
           "sas": ""
         "scala": "// /* */"
        "scheme": "; #| |#"
        "sdl_pr": "/* */"
          "sgml": "<!-- -->"
         "shell": "#"
   "shellscript": "#"
         "shtml": "<!-- -->"
     "smalltalk": "" ""
       "smi_mib": "--"
         "splus": "#"
           "sqr": "!"
     "squidconf": "#"
        "ssharp": "# " ""
    "svn_commit": ""
          "swig": "// /* */"
           "tcl": "#"
           "tex": "%"
       "texinfo": "@c"
          "text": ""
           "tpl": "<!-- -->"
          "tsql": "-- /* */"
       "uscript": "// /* */"
      "vbscript": "'"
      "velocity": "## #* *#"
       "verilog": "// /* */"
          "vhdl": "--"
           "xml": "<!-- -->"
           "xsl": "<!-- -->"
           "zpt": "<!-- -->"

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to