~ubuntu-branches/ubuntu/trusty/yelp-xsl/trusty

« back to all changes in this revision

Viewing changes to js/jquery.syntax.brush.clang.js

  • Committer: Bazaar Package Importer
  • Author(s): Michael Terry
  • Date: 2011-07-09 10:02:21 UTC
  • mto: (11.1.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20110709100221-27hsncxrd63leyx4
Tags: upstream-3.1.2
ImportĀ upstreamĀ versionĀ 3.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// brush: "clang" aliases: ["cpp", "c++", "c", "objective-c"]
2
2
 
3
 
//      This file is part of the "jQuery.Syntax" project, and is licensed under the GNU AGPLv3.
4
 
//      Copyright 2010 Samuel Williams. All rights reserved.
 
3
//      This file is part of the "jQuery.Syntax" project, and is distributed under the MIT License.
 
4
//      Copyright (c) 2011 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
5
5
//      See <jquery.syntax.js> for licensing details.
6
6
 
7
7
Syntax.register('clang', function(brush) {
8
 
        var keywords = ["@interface", "@implementation", "@protocol", "@end", "@try", "@throw", "@catch", "@finally", "@class", "@selector", "@encode", "@synchronized", "@property", "struct", "break", "continue", "else", "for", "switch", "case", "default", "enum", "goto", "register", "sizeof", "typedef", "volatile", "do", "extern", "if", "return", "static", "union", "while", "asm", "dynamic_cast", "namespace", "reinterpret_cast", "try", "explicit", "static_cast", "typeid", "catch", "operator", "template", "class", "const_cast", "inline", "throw", "virtual"];
 
8
        var keywords = ["@interface", "@implementation", "@protocol", "@end", "@try", "@throw", "@catch", "@finally", "@class", "@selector", "@encode", "@synchronized", "@property", "@synthesize", "@dynamic", "struct", "break", "continue", "else", "for", "switch", "case", "default", "enum", "goto", "register", "sizeof", "typedef", "volatile", "do", "extern", "if", "return", "static", "union", "while", "asm", "dynamic_cast", "namespace", "reinterpret_cast", "try", "explicit", "static_cast", "typeid", "catch", "operator", "template", "class", "const_cast", "inline", "throw", "virtual", "IBOutlet"];
9
9
        
10
 
        var access = ["@private", "@protected", "@public", "private", "protected", "public", "friend", "using"];
 
10
        var access = ["@private", "@protected", "@public", "@required", "@optional", "private", "protected", "public", "friend", "using"];
11
11
        
12
12
        var types = ["mutable", "auto", "const", "double", "float", "int", "short", "char", "long", "signed", "unsigned", "bool", "void", "typename", "id", "register", "wchar_t"];
13
13
        
14
 
        var operators = ["@", "+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">", "[", "]", "new", "delete"];
 
14
        var operators = ["+", "*", "/", "-", "&", "|", "~", "!", "%", "<", "=", ">", "[", "]", "new", "delete", "in"];
15
15
        
16
16
        var values = ["this", "true", "false", "NULL", "YES", "NO", "nil"];
17
17
        
21
21
        brush.push(operators, {klass: 'operator'});
22
22
        brush.push(access, {klass: 'access'});
23
23
        
 
24
        // Objective-C properties
 
25
        brush.push({
 
26
                pattern: /@property\((.*)\)[^;]+;/gmi,
 
27
                klass: 'objective-c-property',
 
28
                allow: '*'
 
29
        });
 
30
        
 
31
        var propertyAttributes = ["getter", "setter", "readwrite", "readonly", "assign", "retain", "copy", "nonatomic"];
 
32
        
 
33
        brush.push(propertyAttributes, {
 
34
                klass: 'keyword',
 
35
                only: ['objective-c-property']
 
36
        })
 
37
        
 
38
        // Objective-C strings
 
39
        
 
40
        brush.push({
 
41
                pattern: /@(?=")/g,
 
42
                klass: 'string'
 
43
        });
 
44
        
24
45
        // Objective-C classes
25
46
        brush.push(Syntax.lib.camelCaseType);
26
47
        
43
64
        });
44
65
        
45
66
        brush.push({
46
 
                pattern: /-\s*(\(.+?\))?\s*(\w+)\s*\{/g,
 
67
                pattern: /-\s*(\([^\)]+?\))?\s*(\w+)\s*\{/g,
47
68
                matches: Syntax.extractMatches({index: 2, klass: 'function'})
48
69
        });
49
70