csharp.js 1.3 KB

12345678910111213141516171819202122232425
  1. /*
  2. * CodePress regular expressions for C# syntax highlighting
  3. * By Edwin de Jonge
  4. */
  5. Language.syntax = [ // C#
  6. { input : /\"(.*?)(\"|<br>|<\/P>)/g, output : '<s>"$1$2</s>' }, // strings double quote
  7. { input : /\'(.?)(\'|<br>|<\/P>)/g, output : '<s>\'$1$2</s>' }, // strings single quote
  8. { input : /\b(abstract|as|base|break|case|catch|checked|continue|default|delegate|do|else|event|explicit|extern|false|finally|fixed|for|foreach|get|goto|if|implicit|in|interface|internal|is|lock|namespace|new|null|object|operator|out|override|params|partial|private|protected|public|readonly|ref|return|set|sealed|sizeof|static|stackalloc|switch|this|throw|true|try|typeof|unchecked|unsafe|using|value|virtual|while)\b/g, output : '<b>$1</b>' }, // reserved words
  9. { input : /\b(bool|byte|char|class|double|float|int|interface|long|string|struct|void)\b/g, output : '<a>$1</a>' }, // types
  10. { input : /([^:]|^)\/\/(.*?)(<br|<\/P)/g, output : '$1<i>//$2</i>$3' }, // comments //
  11. { input : /\/\*(.*?)\*\//g, output : '<i>/*$1*/</i>' } // comments /* */
  12. ];
  13. Language.snippets = [];
  14. Language.complete = [ // Auto complete only for 1 character
  15. {input : '\'',output : '\'$0\'' },
  16. {input : '"', output : '"$0"' },
  17. {input : '(', output : '\($0\)' },
  18. {input : '[', output : '\[$0\]' },
  19. {input : '{', output : '{\n\t$0\n}' }
  20. ];
  21. Language.shortcuts = [];