Hi

I am trying to understand how to create a new QLexer for a new language.

Looking at all existing lexers they have an anonymous enum which links some integers 0, 1 to symbolic names.

Example:

    //! This enum defines the meanings of the different styles used by the
    //! Lua lexer.
    enum {
        //! The default.
        Default = 0,

        //! A block comment.
        Comment = 1,

        //! A line comment.
        LineComment = 2,

        //! A number.
        Number = 4,

The problem I have is that I cannot understand how the interface uses these private values to call functions like

QColor QsciLexerLua::defaultColor(int style) const
{
    switch (style)
    {
    case Default:
        return QColor(0x00,0x00,0x00);

    case Comment:
    case LineComment:
        return QColor(0x00,0x7f,0x00);

    case Number:
        return QColor(0x00,0x7f,0x7f);

How does the scidocument know that we have decided that a Number is 4?
Or that a Comment is 1?

Not all lexers share the same ids for the common values.
In other words, I can reassign the numbers in the enum and I do not see how the 
"caller" could be aware.
I was expecting that some of the interface functions returned these values, but 
I could not find any.

Cheers

Reply via email to