# Objective-C++ syntax file for Diffuse
# Copyright (C) 2009 Derrick Moser <derrick_moser@yahoo.com>
syntax Objective-C++ normal text
syntax_files Objective-C++ '\.mm?$'

# colours
colour objc_comment 0.2 0.4 0.64
colour objc_fixme 1.0 0.5 0.0
colour objc_keyword 0.77 0.63 0.0
colour objc_type 0.3 0.6 0.02
colour objc_cpp 0.8 0.0 0.0
colour objc_cppkeyword 0.46 0.31 0.48
colour objc_literal 1.0 0.2 0.8
colour objc_string 0.8 0.0 0.0
colour objc_escapedchar 0.46 0.31 0.48
colour objc_punctuation 0.5 0.5 0.5

# preprocessor
syntax_pattern normal cpp objc_cppkeyword '^[ \t]*#[ \t]*(define|elif|else|endif|error|if|ifdef|ifndef|import|include|line|pragma|undef|warning)\b'
syntax_pattern cpp normal objc_cppkeyword '(\r\n|\r|\n)$'
syntax_pattern normal normal text '[ \t\r\n]+'

# C++ style comments
syntax_pattern normal cpp_comment objc_comment '//'
syntax_pattern cpp cpp_comment objc_comment '//'
syntax_pattern cpp_comment normal objc_comment '(\r\n|\r|\n)$'
syntax_pattern cpp_comment cpp_comment objc_comment '\\(\r\n|\r|\n)$'
syntax_pattern cpp_comment cpp_comment objc_fixme '\b(TODO|FIXME|XXX)\b'
syntax_pattern cpp_comment cpp_comment objc_comment '.[^\\TFX\r\n]*'

# C style comments
syntax_pattern normal comment objc_comment '/\*'
syntax_pattern comment normal objc_comment '\*/'
syntax_pattern comment comment objc_fixme '\b(TODO|FIXME|XXX)\b'
syntax_pattern comment comment objc_comment '.[^\*TFX]*'

syntax_pattern cpp comment_cpp objc_comment '/\*'
syntax_pattern comment_cpp cpp objc_comment '\*/'
syntax_pattern comment_cpp comment_cpp objc_fixme '\b(TODO|FIXME|XXX)\b'
syntax_pattern comment_cpp comment_cpp objc_comment '.[^\*TFX]*'

# preprocessor args
syntax_pattern cpp cpp objc_cpp '\\(\r\n|\r|\n)$'
syntax_pattern cpp cpp objc_cpp '.[^\\/\r\n]*'

# char
syntax_pattern normal char objc_string "L?'"
syntax_pattern char normal objc_string "'"
syntax_pattern char char objc_escapedchar '(\\([0-7]{1,3}|x[0-9a-f]{1,2}|.))+' ignorecase
syntax_pattern char char objc_string ".[^\\\\']*"

# string
syntax_pattern normal string objc_string '[L@]?"'
syntax_pattern string normal objc_string '"'
syntax_pattern string string objc_escapedchar '(\\([0-7]{1,3}|x[0-9a-f]{1,2}|.))+' ignorecase
syntax_pattern string string objc_string '.[^\\"]*'

# literals
syntax_pattern normal normal objc_literal '((([0-9]+\.[0-9]*|\.[0-9]+)(e[\+\-]?[0-9]+)?|[0-9]+e[\+\-]?[0-9]+)[fl]?|(0|[1-9][0-9]*)f|(0x[0-9a-f]+|0[0-7]*|[1-9][0-9]*)(ul?|lu?)?)' ignorecase
syntax_pattern normal normal objc_literal '\b(true|false|M_E|M_LOG2E|M_LOG10E|M_LN2|M_LN10|M_PI|M_PI_2|M_PI_4|M_1_PI|M_2_PI|M_2_SQRTPI|M_SQRT2|M_SQRT1_2|nil|Nil|NO|NULL|YES)\b'

# typing keywords
syntax_pattern normal normal objc_type '\b(auto|bool|BOOL|bycopy|byref|char|class|Class|const|double|enum|explicit|export|extern|float|id|IMP|in|inline|inout|int|long|mutable|namespace|oneway|out|register|SEL|short|signed|static|struct|STR|template|typedef|typename|union|unsigned|virtual|void|volatile|wchar_t)\b'

# keywords
syntax_pattern normal normal objc_keyword '@(catch|class|dynamic|encode|end|finally|implementation|interface|optional|package|private|property|protected|protocol|protocol|public|required|selector|synchronized|synthesize|throw|try)\b'
syntax_pattern normal normal objc_keyword '\b(_cmd|asm|break|case|catch|const_cast|continue|default|delete|do|dynamic_cast|else|for|friend|goto|if|new|operator|private|protected|public|reinterpret_cast|return|self|sizeof|static_cast|super|switch|this|throw|try|typeid|using|while)\b'

# punctuation
syntax_pattern normal normal objc_punctuation '[!~%\|\&\^\(\)\<\>\*\-\+=\{\}\[\]:;,\?]+'
syntax_pattern normal normal objc_punctuation '[/\.]'

# parsing optimisation
syntax_pattern normal normal text '[a-z_][a-z_0-9]*' ignorecase
