prism-asmatmel.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Prism.languages.asmatmel = {
  2. 'comment': {
  3. pattern: /;.*/,
  4. greedy: true
  5. },
  6. 'string': {
  7. pattern: /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
  8. greedy: true
  9. },
  10. 'constant': /\b(?:PORT[A-Z]|DDR[A-Z]|(?:DD|P)[A-Z](?:\d|[0-2]\d|3[01]))\b/,
  11. 'directive': {
  12. pattern: /\.\w+(?= )/,
  13. alias: 'property'
  14. },
  15. 'r-register': {
  16. pattern: /\br(?:\d|[12]\d|3[01])\b/,
  17. alias: 'variable'
  18. },
  19. 'op-code': {
  20. pattern: /\b(?:ADC|ADD|ADIW|AND|ANDI|ASR|BCLR|BLD|BRBC|BRBS|BRCC|BRCS|BREAK|BREQ|BRGE|BRHC|BRHS|BRID|BRIE|BRLO|BRLT|BRMI|BRNE|BRPL|BRSH|BRTC|BRTS|BRVC|BRVS|BSET|BST|CALL|CBI|CBR|CLC|CLH|CLI|CLN|CLR|CLS|CLT|CLV|CLZ|COM|CP|CPC|CPI|CPSE|DEC|DES|EICALL|EIJMP|ELPM|EOR|FMUL|FMULS|FMULSU|ICALL|IJMP|IN|INC|JMP|LAC|LAS|LAT|LD|LD[A-Za-z0-9]|LPM|LSL|LSR|MOV|MOVW|MUL|MULS|MULSU|NEG|NOP|OR|ORI|OUT|POP|PUSH|RCALL|RET|RETI|RJMP|ROL|ROR|SBC|SBCI|SBI|SBIC|SBIS|SBIW|SBR|SBRC|SBRS|SEC|SEH|SEI|SEN|SER|SES|SET|SEV|SEZ|SLEEP|SPM|ST|ST[A-Z0-9]|SUB|SUBI|SWAP|TST|WDR|XCH|adc|add|adiw|and|andi|asr|bclr|bld|brbc|brbs|brcc|brcs|break|breq|brge|brhc|brhs|brid|brie|brlo|brlt|brmi|brne|brpl|brsh|brtc|brts|brvc|brvs|bset|bst|call|cbi|cbr|clc|clh|cli|cln|clr|cls|clt|clv|clz|com|cp|cpc|cpi|cpse|dec|des|eicall|eijmp|elpm|eor|fmul|fmuls|fmulsu|icall|ijmp|in|inc|jmp|lac|las|lat|ld|ld[a-z0-9]|lpm|lsl|lsr|mov|movw|mul|muls|mulsu|neg|nop|or|ori|out|pop|push|rcall|ret|reti|rjmp|rol|ror|sbc|sbci|sbi|sbic|sbis|sbiw|sbr|sbrc|sbrs|sec|seh|sei|sen|ser|ses|set|sev|sez|sleep|spm|st|st[a-zA-Z0-9]|sub|subi|swap|tst|wdr|xch)\b/,
  21. alias: 'keyword'
  22. },
  23. 'hex-number': {
  24. pattern: /#?\$[\da-f]{2,4}\b/i,
  25. alias: 'number'
  26. },
  27. 'binary-number': {
  28. pattern: /#?%[01]+\b/,
  29. alias: 'number'
  30. },
  31. 'decimal-number': {
  32. pattern: /#?\b\d+\b/,
  33. alias: 'number'
  34. },
  35. 'register': {
  36. pattern: /\b[acznvshtixy]\b/i,
  37. alias: 'variable'
  38. },
  39. 'operator': />>=?|<<=?|&[&=]?|\|[\|=]?|[-+*/%^!=<>?]=?/,
  40. 'punctuation': /[(),:]/
  41. };