Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes | Static Private Attributes
MoinMoin.support.pygments.lexers.compiled.ObjectiveCLexer Class Reference
Inheritance diagram for MoinMoin.support.pygments.lexers.compiled.ObjectiveCLexer:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.pygments.lexers.compiled.ObjectiveCLexer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def analyse_text

Static Public Attributes

string name = 'Objective-C'
list aliases = ['objective-c', 'objectivec', 'obj-c', 'objc']
list filenames = ['*.m']
list mimetypes = ['text/x-objective-c']
dictionary tokens

Static Private Attributes

string _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'

Detailed Description

For Objective-C source code with preprocessor directives.

Definition at line 1075 of file compiled.py.


Member Function Documentation

Definition at line 1201 of file compiled.py.

01201 
01202     def analyse_text(text):
01203         if '@"' in text: # strings
01204             return True
01205         if re.match(r'\[[a-zA-Z0-9.]:', text): # message
01206             return True
01207         return False


Member Data Documentation

string MoinMoin.support.pygments.lexers.compiled.ObjectiveCLexer._ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+' [static, private]

Definition at line 1087 of file compiled.py.

list MoinMoin.support.pygments.lexers.compiled.ObjectiveCLexer.aliases = ['objective-c', 'objectivec', 'obj-c', 'objc'] [static]

Definition at line 1081 of file compiled.py.

Definition at line 1083 of file compiled.py.

Definition at line 1084 of file compiled.py.

Definition at line 1080 of file compiled.py.

Initial value:
{
        'whitespace': [
            (r'^(\s*)(#if\s+0)', bygroups(Text, Comment.Preproc), 'if0'),
            (r'^(\s*)(#)', bygroups(Text, Comment.Preproc), 'macro'),
            (r'\n', Text),
            (r'\s+', Text),
            (r'\\\n', Text), # line continuation
            (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single),
            (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
        ],
        'statements': [
            (r'(L|@)?"', String, 'string'),            (r"(L|@)?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",             String.Char),            (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),            (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),            (r'0x[0-9a-fA-F]+[Ll]?', Number.Hex),            (r'0[0-7]+[Ll]?', Number.Oct),            (r'\d+[Ll]?', Number.Integer),            (r'[~!%^&*+=|?:<>/-]', Operator),            (r'[()\[\],.]', Punctuation),            (r'(auto|break|case|const|continue|default|do|else|enum|extern|'             r'for|goto|if|register|restricted|return|sizeof|static|struct|'             r'switch|typedef|union|volatile|virtual|while|in|@selector|'             r'@private|@protected|@public|@encode|'             r'@synchronized|@try|@throw|@catch|@finally|@end|@property|'             r'@synthesize|@dynamic)\b', Keyword),            (r'(int|long|float|short|double|char|unsigned|signed|void|'             r'id|BOOL|IBOutlet|IBAction|SEL)\b', Keyword.Type),            (r'(_{0,2}inline|naked|restrict|thread|typename)\b',             Keyword.Reserved),            (r'__(asm|int8|based|except|int16|stdcall|cdecl|fastcall|int32|'             r'declspec|finally|int64|try|leave)\b', Keyword.Reserved),            (r'(TRUE|FALSE|nil|NULL)\b', Name.Builtin),            ('[a-zA-Z_][a-zA-Z0-9_]*:(?!:)', Name.Label),            ('[a-zA-Z_][a-zA-Z0-9_]*', Name),        ],        'root': [            include('whitespace'),            # functions            (r'((?:[a-zA-Z0-9_*\s])+?(?:\s|[*]))'    # return arguments             r'([a-zA-Z_][a-zA-Z0-9_]*)'             # method name             r'(\s*\([^;]*?\))'                      # signature             r'(' + _ws + r')({)',             bygroups(using(this), Name.Function,                      using(this), Text, Punctuation),             'function'),            # function declarations            (r'((?:[a-zA-Z0-9_*\s])+?(?:\s|[*]))'    # return arguments             r'([a-zA-Z_][a-zA-Z0-9_]*)'             # method name             r'(\s*\([^;]*?\))'                      # signature             r'(' + _ws + r')(;)',             bygroups(using(this), Name.Function,                      using(this), Text, Punctuation)),            (r'(@interface|@implementation)(\s+)', bygroups(Keyword, Text),             'classname'),            (r'(@class|@protocol)(\s+)', bygroups(Keyword, Text),             'forward_classname'),            (r'(\s*)(@end)(\s*)', bygroups(Text, Keyword, Text)),            ('', Text, 'statement'),        ],        'classname' : [            # interface definition that inherits            ('([a-zA-Z_][a-zA-Z0-9_]*)(\s*:\s*)([a-zA-Z_][a-zA-Z0-9_]*)?',             bygroups(Name.Class, Text, Name.Class), '#pop'),            # interface definition for a category            ('([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(\([a-zA-Z_][a-zA-Z0-9_]*\))',             bygroups(Name.Class, Text, Name.Label), '#pop'),            # simple interface / implementation            ('([a-zA-Z_][a-zA-Z0-9_]*)', Name.Class, '#pop')        ],        'forward_classname' : [          ('([a-zA-Z_][a-zA-Z0-9_]*)(\s*,\s*)',           bygroups(Name.Class, Text), 'forward_classname'),          ('([a-zA-Z_][a-zA-Z0-9_]*)(\s*;?)',           bygroups(Name.Class, Text), '#pop')        ],        'statement' : [            include('whitespace'),            include('statements'),            ('[{}]', Punctuation),            (';', Punctuation, '#pop'),        ],        'function': [            include('whitespace'),            include('statements'),            (';', Punctuation),            ('{', Punctuation, '#push'),            ('}', Punctuation, '#pop'),        ],        'string': [            (r'"', String, '#pop'),
            (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),            (r'[^\\"\n]+', String), # all other characters
            (r'\\\n', String), # line continuation
            (r'\\', String), # stray backslash
        ],
        'macro': [
            (r'[^/\n]+', Comment.Preproc),
            (r'/[*](.|\n)*?[*]/', Comment.Multiline),
            (r'//.*?\n', Comment.Single, '#pop'),
            (r'/', Comment.Preproc),
            (r'(?<=\\)\n', Comment.Preproc),
            (r'\n', Comment.Preproc, '#pop'),
        ],
        'if0': [
            (r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
            (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
            (r'.*?\n', Comment),
        ]
    }

Definition at line 1089 of file compiled.py.


The documentation for this class was generated from the following file: