3 class CsharpLanguage extends HyperLanguage {
4 public function __construct() {
7 parent::VERSION => '0.3',
8 parent::AUTHOR => array(
9 parent::NAME => 'Konrad Rudolph',
10 parent::WEBSITE => 'madrat.net',
11 parent::EMAIL => 'konrad_rudolph@madrat.net'
15 $this->setExtensions(array('cs'));
17 $this->setCaseInsensitive(false);
19 $this->addStates(array(
24 'comment' => array('', 'doc'),
25 'keyword' => array('', 'type', 'literal', 'operator', 'preprocessor'),
30 'comment doc' => 'doc',
33 $this->addRules(array(
34 'whitespace' => Rule::ALL_WHITESPACE,
35 'operator' => '/[-+*\/%&|^!~=<>?{}()\[\].,:;]|&&|\|\||<<|>>|[-=!<>+*\/%&|^]=|<<=|>>=|->/',
36 'string' => Rule::C_DOUBLEQUOTESTRING,
37 'char' => Rule::C_SINGLEQUOTESTRING,
38 'number' => Rule::C_NUMBER,
40 '#//(?:[^/].*?)?\n|/\*.*?\*/#s',
41 'doc' => new Rule('#///#', '/$/m')
43 'doc' => '/<(?:".*?"|\'.*?\'|[^>])*>/',
46 'abstract', 'break', 'case', 'catch', 'checked', 'class',
47 'const', 'continue', 'default', 'delegate', 'do', 'else',
48 'enum', 'event', 'explicit', 'extern', 'finally', 'fixed',
49 'for', 'foreach', 'goto', 'if', 'implicit', 'in', 'interface',
50 'internal', 'lock', 'namespace', 'operator', 'out', 'override',
51 'params', 'private', 'protected', 'public', 'readonly', 'ref',
52 'return', 'sealed', 'static', 'struct', 'switch', 'throw',
53 'try', 'unchecked', 'unsafe', 'using', 'var', 'virtual',
57 'bool', 'byte', 'char', 'decimal', 'double', 'float', 'int',
58 'long', 'object', 'sbyte', 'short', 'string', 'uint', 'ulong',
62 'base', 'false', 'null', 'this', 'true',
65 'as', 'is', 'new', 'sizeof', 'stackallock', 'typeof',
67 'preprocessor' => '/#(?:if|else|elif|endif|define|undef|warning|error|line|region|endregion)/'
69 'identifier' => '/@?[a-z_][a-z0-9_]*/i',
72 $this->addMappings(array(