prism-matlab.js 617 B

1234567891011121314151617
  1. Prism.languages.matlab = {
  2. // We put string before comment, because of printf() patterns that contain "%"
  3. 'string': {
  4. pattern: /(^|\W)'(?:''|[^'\n])*'/,
  5. lookbehind: true
  6. },
  7. 'comment': [
  8. /%\{[\s\S]*?\}%/,
  9. /%.+/
  10. ],
  11. // FIXME We could handle imaginary numbers as a whole
  12. 'number': /\b-?(?:\d*\.?\d+(?:[eE][+-]?\d+)?(?:[ij])?|[ij])\b/,
  13. 'keyword': /\b(?:break|case|catch|continue|else|elseif|end|for|function|if|inf|NaN|otherwise|parfor|pause|pi|return|switch|try|while)\b/,
  14. 'function': /(?!\d)\w+(?=\s*\()/,
  15. 'operator': /\.?[*^\/\\']|[+\-:@]|[<>=~]=?|&&?|\|\|?/,
  16. 'punctuation': /\.{3}|[.,;\[\](){}!]/
  17. };