Skip to content
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

Merged
merged 2 commits into from Dec 16, 2017
Merged

Add support for 6502 assembly #1245

merged 2 commits into from Dec 16, 2017

Conversation

kzurawel
Copy link
Contributor

This PR adds basic support for 6502 assembly highlighting as asm6502.

Copy link
Contributor

@Golmote Golmote left a 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)?

@@ -0,0 +1,28 @@
Prism.languages.asm6502 = {
'comment': /;[^\n]*/,
Copy link
Contributor

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 ;.*?

Prism.languages.asm6502 = {
'comment': /;[^\n]*/,
'directive': {
pattern: /\.\w+ /,
Copy link
Contributor

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 (?= ).

},
'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/,
Copy link
Contributor

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.

alias: 'string'
},
'decimalnumber': {
pattern: /#?[\d]+/,
Copy link
Contributor

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.

@kzurawel
Copy link
Contributor Author

Thanks for the feedback, I think I've addressed everything.

@Golmote Golmote merged commit 2ece18b into PrismJS:gh-pages Dec 16, 2017
@Golmote
Copy link
Contributor

Golmote commented Dec 16, 2017

LGTM, thanks!

papandreou added a commit to papandreou/prism that referenced this pull request Jan 29, 2018
* 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
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants