syndata.py :  » GUI » wxPython » wxPython-src-2.8.11.0 » wxPython » wx » tools » Editra » src » syntax » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » GUI » wxPython 
wxPython » wxPython src 2.8.11.0 » wxPython » wx » tools » Editra » src » syntax » syndata.py
 #-*- coding: utf-8 -*-
###############################################################################
# Name: syndata.py                                                            #
# Purpose: Syntax Data Base                                                   #
# Author: Cody Precord <cprecord@editra.org>                                  #
# Copyright: (c) 2009 Cody Precord <staff@editra.org>                         #
# License: wxWindows License                                                  #
###############################################################################

""" Interface definition for syntax data

@summary: Editra Syntax Data Interface Definition

"""

__author__ = "Cody Precord <cprecord@editra.org>"
__svnid__ = "$Id: syndata.py 63843 2010-04-03 16:19:09Z CJP $"
__revision__ = "$Revision: 63843 $"

__all__ = ['SyntaxDataBase',]

#-----------------------------------------------------------------------------#
# Imports
import wx.stc as stc

# Local Imports
import synglob

#-----------------------------------------------------------------------------#

class SyntaxDataBase(object):
    """Syntax data container object base class"""
    def __init__(self, langid=synglob.ID_LANG_TXT):
        object.__init__(self)

        # Attributes
        self._langid = langid
        self._lexer = stc.STC_LEX_NULL
        self._features = dict()

    @property
    def CommentPattern(self):
        return self.GetCommentPattern()

    @property
    def Keywords(self):
        return self.GetKeywords()

    @property
    def LangId(self):
        return self.GetLangId()

    @property
    def Lexer(self):
        return self.GetLexer()

    @property
    def Properties(self):
        return self.GetProperties()

    @property
    def SyntaxSpec(self):
        return self.GetSyntaxSpec()

    #---- Interface Methods ----#

    def GetCommentPattern(self):
        """Get the comment pattern
        @return: list of strings ['/*', '*/']

        """
        return list()

    def GetKeywords(self):
        """Get the Keyword List(s)
        @return: list of tuples [(1, ['kw1', kw2']),]

        """
        return list()

    def GetLangId(self):
        """Get the language id
        @return: int

        """
        return self._langid

    def GetLexer(self):
        """Get the lexer id
        @return: wx.stc.STC_LEX_

        """
        return self._lexer

    def GetProperties(self):
        """Get the Properties List
        @return: list of tuples [('fold', '1'),]

        """
        return list()

    def GetSyntaxSpec(self):
        """Get the the syntax specification list
        @return: list of tuples [(int, 'style_tag'),]

        """
        raise NotImplementedError

    #---- End Interface Methods ----#

    def GetFeature(self, name):
        """Get a registered features callable
        @param name: feature name
        @return: callable or None

        """
        return self._features.get(name, None)

    def RegisterFeature(self, name, funct):
        """Register an extension feature with the factory
        @param name: feature name
        @param funct: callable

        """
        assert callable(funct), "funct must be callable object"
        self._features[name] = funct

    def SetLexer(self, lex):
        """Set the lexer object for this data object"""
        self._lexer = lex

    def SetLangId(self, lid):
        """Set the language identifier
        @param lid: int

        """
        self._langid = lid

#-----------------------------------------------------------------------------#
w__w_w.j_a___v___a2_s___._c___o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.