setInfo(array( parent::NAME => 'Generic', parent::VERSION => '0.1', parent::AUTHOR => array( parent::NAME => 'Nathan Sweet', // based Konrad Rudolph's csharp.php! parent::WEBSITE => 'esotericsoftware.com', parent::EMAIL => 'misc@n4te.com' ) )); $this->setExtensions(array('java', 'cs', 'js', 'as', 'c', 'cpp', 'lua')); $this->setCaseInsensitive(false); $this->addStates(array( 'init' => array( 'string', 'char', 'number', 'comment', 'keyword' => array('', 'preprocessor'), 'method', 'ctor', 'function', 'operator', 'type', 'identifier', 'whitespace', ), )); $this->addRules(array( 'whitespace' => Rule::ALL_WHITESPACE, 'operator' => '/[-+*\/%&|^!~=<>?{}()\[\].,:;]|&&|\|\||<<|>>|[-=!<>+*\/%&|^]=|<<=|>>=|->/', 'string' => Rule::C_DOUBLEQUOTESTRING, 'char' => Rule::C_SINGLEQUOTESTRING, 'number' => Rule::C_NUMBER, 'comment' => '#(//|--)(?:[^/].*?)?(\n|\z)|/\*.*?\*/#s', 'keyword' => array( array( // C# 'abstract', 'break', 'case', 'catch', 'checked', 'class', 'const', 'continue', 'default', 'delegate', 'do', 'else', 'enum', 'explicit', 'extern', 'finally', 'fixed', 'for', 'foreach', 'goto', 'if', 'implicit', 'in', 'interface', 'internal', 'lock', 'namespace', 'operator', 'out', 'override', 'params', 'private', 'protected', 'public', 'readonly', 'ref', 'return', 'sealed', 'static', 'struct', 'switch', 'throw', 'try', 'unchecked', 'unsafe', 'using', 'var', 'virtual', 'volatile', 'while', 'bool', 'byte', 'char', 'decimal', 'double', 'float', 'int', 'long', 'object', 'sbyte', 'short', 'string', 'uint', 'ulong', 'ushort', 'void', 'base', 'false', 'null', 'this', 'true', 'as', 'is', 'new', 'sizeof', 'stackallock', 'typeof', // Java 'extends', 'throws', 'implements', 'final', 'native', 'synchronized', 'transient', 'assert', 'package', 'strictfp', 'super', 'import', 'boolean', 'instanceof', // JavaScript 'function', // Lua 'local', 'not', 'then', 'end', 'nil', 'pairs', 'ipairs', 'and', 'or', // C 'typedef', 'auto', 'extern', 'goto', 'register', 'signed', 'sizeof', 'struct', 'union', 'unsigned', // C++ 'alignas', 'alignof', 'and_eq', 'asm', 'bitand', 'bitor', 'char16_t', 'char32_t', 'compl', 'constexpr', 'const_cast', 'decltype', 'delete', 'dynamic_cast', 'explicit', 'export', 'friend', 'inline', 'mutable', 'noexcept', 'not_eq', 'nullptr', 'or_eq', 'reinterpret_cast', 'static_assert', 'static_cast', 'template', 'thread_local', 'typeid', 'typename', 'wchar_t', 'xor', 'xor_eq', ), 'preprocessor' => '/#(?:if|else|elif|endif|define|undef|warning|error|line|region|endregion|include|import)[^\r\n]*/', ), 'method' => '/(?<=\.)\s*([a-zA-Z][^\s\.\(:]+)(?=\s*\()/', 'ctor' => '/(?<=new)\s+([a-zA-Z][^\s\(:]+)(?=\s*\()/', 'function' => '/([a-zA-Z][^\s\.\(:]+)(?=\s*\()/', 'type' => '/@?(sp)?[A-Z][a-z0-9_]*/', 'identifier' => '/@?[a-z_][a-z0-9_]*/i', )); $this->addMappings(array( 'whitespace' => '', )); } } ?>