prism-warpscript.js 913 B

123456789101112131415161718192021
  1. Prism.languages.warpscript = {
  2. 'comment': /#.*|\/\/.*|\/\*[\s\S]*?\*\//,
  3. 'string': {
  4. pattern: /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'|<'(?:[^\\']|'(?!>)|\\.)*'>/,
  5. greedy: true
  6. },
  7. 'variable': /\$\S+/,
  8. 'macro': {
  9. pattern: /@\S+/,
  10. alias: 'property'
  11. },
  12. // WarpScript doesn't have any keywords, these are all functions under the control category
  13. // https://www.warp10.io/tags/control
  14. 'keyword': /\b(?:BREAK|CHECKMACRO|CONTINUE|CUDF|DEFINED|DEFINEDMACRO|EVAL|FAIL|FOR|FOREACH|FORSTEP|IFT|IFTE|MSGFAIL|NRETURN|RETHROW|RETURN|SWITCH|TRY|UDF|UNTIL|WHILE)\b/,
  15. 'number': /[+-]?\b(?:NaN|Infinity|\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+)\b/,
  16. 'boolean': /\b(?:F|T|false|true)\b/,
  17. 'punctuation': /<%|%>|[{}[\]()]/,
  18. // Some operators from the "operators" category
  19. // https://www.warp10.io/tags/operators
  20. 'operator': /==|&&?|\|\|?|\*\*?|>>>?|<<|[<>!~]=?|[-/%^]|\+!?|\b(?:AND|NOT|OR)\b/
  21. };