-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for 6502 assembly #1245
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for contributing! Can you take a look at my comments please?
Also, would you mind adding an example file (see https://github.com/PrismJS/prism/tree/gh-pages/examples) and some tests for the different patterns (see https://github.com/PrismJS/prism/tree/gh-pages/tests/languages and the Test suite page)?
components/prism-asm6502.js
Outdated
@@ -0,0 +1,28 @@ | |||
Prism.languages.asm6502 = { | |||
'comment': /;[^\n]*/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to explicitely allow \r
here? Can't you use ;.*
?
components/prism-asm6502.js
Outdated
Prism.languages.asm6502 = { | ||
'comment': /;[^\n]*/, | ||
'directive': { | ||
pattern: /\.\w+ /, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intended to consume the final space here? If not, you might want to consider using a positive look-ahead assertion instead (?= )
.
components/prism-asm6502.js
Outdated
}, | ||
'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/, | ||
'opcode': { | ||
pattern: /\b(adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya|ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\b/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make the group non-capturing her, since you don't need the capture.
components/prism-asm6502.js
Outdated
alias: 'string' | ||
}, | ||
'decimalnumber': { | ||
pattern: /#?[\d]+/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[\d]
can be simplified to \d
.
Thanks for the feedback, I think I've addressed everything. |
LGTM, thanks! |
* gh-pages: (326 commits) Add C++ platform-independent types (PrismJS#1271) Release 1.10.0 Unescaped markup plugin: Make it work with any language (PrismJS#1265) Previewers: New plugin combining previous plugins Previewer: Base, Previewer: Angle, Previewer: Color, Previewer: Easing, Previewer: Gradient and Previewer: Time. Fix PrismJS#913 (PrismJS#1244) Add Elm (elm-lang.org) support (PrismJS#1174) IchigoJam: Remove unneeded escape Run gulp add Io syntax (PrismJS#1251) package.json: add attribute `style` (PrismJS#1256) Add the C++11 raw string feature to the cpp language IchigoJam: Make strings greedy BASIC: Make strings greedy Run gulp Add support for IchigoJam BASIC (PrismJS#1246) Add support for 6502 assembly (PrismJS#1245) fix for autoloader plugin Run gulp and reorder components alphabetically Xeora Language implementation (PrismJS#1239) upgrade autoloader Release 1.9.0 ...
This PR adds basic support for 6502 assembly highlighting as
asm6502
.