ActiveState Community

Adding new languages ..

Posted by dragonfly on 2007-02-08 12:49

I'm just starting to test Komodo 4.0 Beta Editor with a view to using as an IDE for developing OpenLaszlo apps.

http://www.openlaszlo.org .. (similar to Macromedia Flex)

New file extension to add .. *.lzx

DTD file .. http://www.openlaszlo.org/lps/tools/lzx.dtd

Other file types to use in project development .. *.php, *.svg
_________________________________

Some initial newbie questions (links to newbie tutorials/references would help):

Q1. How is an XML file (*.lzx) validated against local DTD file?

Q2. How is a new (XML based) language added? In this case *.lzx.

Q3. How is a new Toolbox created for this new language, with code snippets and auto-code completion?

Q4. If UDL is used for creating Tools / Extensions, where is the UDL Editor / Toolbox Wizard?

Q5. Similarly, how are SVG files validated?

Q6. Can Actionscript 2.0 and 3.0 be added as new Flash development language (linked to Flash compiler via Commands) ?
_________________________________

I have searched the forum and I see that Documentation on Extensions / Toolbox is coming? I've read the threads on adding Firefox and Komodo extensions, but I can't see where/how these files are created. And Toolbox?

Thanks

ericp | Thu, 2007-02-08 18:26

First, you're going to need to spend some time getting familiar with
UDL, as you mentioned. See the Komodo help, Komodo Reference >
User-Defined Languages and Luddite Reference. Also see my tutorial
at http://blogs.activestate.com/ericp where I walk through creating
a syntax highlighter for a Python-based HTML template language.

Q1. How is an XML file (*.lzx) validated against local DTD file?

When you write a UDL spec for Laszlo, you specify an extension for
".lzx" on the command-line. This will tell Komodo all it needs to
know.

As for validation, see Help|Komodo Reference|XML Catalogs|Creating XML Catalogs and Preferences|XML|XML Catalogs.

> Q2. How is a new (XML based) language added? In this case *.lzx.

Via Luddite and UDL. You'll also most likely use the Luddite
keywords namespace, public_id, and/or system_id.

> Q3. How is a new Toolbox created for this new language, with code snippets and auto-code completion?

Toolbox items are language-independent. See Help|Toolbox as a starting point.

> Q4. If UDL is used for creating Tools / Extensions, where is the UDL Editor / Toolbox Wizard?

Komodo is a UDL editor -- load a .udl file for syntax-coloring. We probably should
provide a couple of for making it easier to build and package the components.

> Q5. Similarly, how are SVG files validated?

See my answer to Q1.

Q6. Can Actionscript 2.0 and 3.0 be added as new Flash development language (linked to Flash compiler via Commands) ?

We've been talking about adding ActionScript support here, but all the tools are in place.

Hope that helps.

dragonfly | Fri, 2007-02-09 05:41

Thanks .. this certainly helps .. I will now study Luddite (I found luddite.zip) and other references, including your blog.

dragonfly | Sat, 2007-02-10 14:05

Before trying to build a new Extension for OpenLaszlo, I understand that I need to define an XML Catalog file, for editing OpenLaszlo *.lzx code. Correct?

...

I have read Komodo Help > XML Catalogs .. but I'm still not sure how to build an XML Catalog file from OpenLaszlo Schema and DTD, so that OpenLaszlo code is interpreted in Komodo editor.

Creating an XML Catalog

If the DTD or RelaxNG Schema for the dialect does not have a catalog file, you can create one by mapping the external identifiers and URI references in the document's namespace declaration to a local filesystem URI.

Here is the link to OpenLaszlo reference files ..

http://www.openlaszlo.org/lps-latest/tools/index.html

DTD, RELAXNG Schema, XML schema

How do I apply one of these files? XML Schema or DTD?
And where is the built OpenLaszlo catalog.xml placed?

I have already associated file extension *.lzx with XML, and OpenLaszlo files are recognised as raw XML files in editor window.

Again, I've read this in Help ..

XML AutoComplete and CallTips

Support for additional XML dialects can be configured by adding an XML Catalog for the dialect in the SGML/XML Catalogs section of the Code Intelligence Preferences.

But exactly what is typed in there?

I now need to add the *.lzx syntax coloring (and auto-complete).

dragonfly | Sun, 2007-02-11 07:36

I now see that I was looking in the wrong preference section ..

"XML Catalogs" is located under Languages ..

But also there is reference to "API Catalogs" under "Code Intelligence"
so I added this path to OpenLaszlo\catalog.xml in "XML Catalogs"

C:\Program Files\ActiveState Komodo Edit 4.0\lib\support\catalogs\openlaszlo\catalog.xml

The catalog.xml (below) I built by hacking an exiting catalog.xml file in Komodo. And placing lzx.dtd in same directory. Is this correct?

...

But back to understanding Code Intelligence entries .. when I try to Add a "new API Catalog" (for OpenLaszlo), the prompt looks for a file with a *.cix extension.

Now I can see in %KOMODO_HOME%\lib\mozilla\python\komodo\codeintel2\catalogs\

six files with *.cix extensions (which are the "API Catalogs" as listed under "API Catalogs")

but I do not have any idea how to create an OpenLaszlo API Catalog.

My new question is .. how is this API Catalog (*.cix extension) produced?

______________________________________________________

p.s.

After just browsing the forum I see that I am not alone in looking for an "API Catalog Wizard" for a new language.

Creating API Catalogs

Another puzzle .. why does a search for "API Catalog" in this forum show no hits? In fact, I found the above thread through a google search.

quote .. return from forum search .. API Catalog

Validation error, please try again. If this error persists, please contact the site administrator.

....

And here is another thread found by google ..

komodo-python-and-pysqlite

quote ... 2007-02-02

I'm not aware of anyone who has build an API Catalog for pysqlite yet, but I hope that it won't be too long.

I need to write an intro doc to creating API Catalogs. Basically they are just XML files (the schema is called "CIX") that describe the API of a module (or set of modules). We have some (relatively hacky) internal scripts for quickly cobbling together CIX files using introspection that I want to whip into shape and release into the wild.

When I do get these together I'll put it up on the community site here and be sure to post about it on my blog.

Trent

______________________________________________________

catalog.xml

<?xml version='1.0'?>

-->

<?xml version='1.0'?>








-->

Cort | Sun, 2007-02-11 14:45

Hi,

I just want to voice some support for dragonfly's and anybody else's efforts in this area.

Lzx would be a great language to add to komodo's capabilities.

-Cort

toddw | Sun, 2007-02-11 16:05

Yes, your catalog.xml is correct.

I had to use the following xml headers before completion would work though, example.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE canvas PUBLIC "-//Laszlo Systems, Inc.//DTD LZX 2003/05//EN" "http://laszlosystems.com/lps/tools/lzx.dtd">
<canvas>
    ...
</canvas>

toddw | Sun, 2007-02-11 16:27

You will not need CIX modules just to have xml completions, such as:

<canvas>
  <...
</canvas>

use XML Catalogs for this (as described above).

The cix api catalogs are used for code completion and calltips for the codeintel languages inside of Komodo (they are Python, Perl, PHP, Tcl, Ruby or Javascript).

These cix files define the programming API for these languages, so for example Python has elements for the stdlib library modules "os, os.path, os.path.isDir()" etc... Thus when in a python file and I type "os." I will then get completions for "os.path, ..." as they are defined in the cix python API.

The API Catalogs are meant to be so users can add codeintel support for additional modules by simply adding a cix file (that defines the modules they want completion on). An example is pysqlite (which contains binary modules), so after I type import pysqlite I can then get completions and calltips for specific parts of the pysqlite module that the Komodo python codeintel system would normally not pickup (due to it being a binary module).

dvpamp | Tue, 2009-11-10 11:55

I'm new to editing XML files, I've worked with HTML without a problem. But I'm stumped with XML, I'm trying to add an event to my XML file along with the time, location, hosted by, guest and directions to the location.

I've done a search for tutorials so I can add the proper tags to type but haven't had any luck Can u assist with my issue?

Thanks in advance.

dragonfly | Wed, 2009-11-11 02:21

Here are some basic XML tutorials ...

http://www.w3schools.com/

and a free XML editor ...

http://xml-copy-editor.sourceforge.net/