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 x86 assembly language. #486

wants to merge 1 commit into
base: master


Copy link

commented May 3, 2017

Adds a "lang-x86.js" lexer that enables syntax highlighting for Intel x86 assembly language.
(See commit description and/or comments in file for additional information.)

Although I am not an experienced JavaScript developer, nor do I have much experience with writing regular expressions, I did have this code reviewed by the Stack Exchange community ( and received positive feedback.

I have made a few changes since then, optimizing the code for performance, and I have been very happy with the results in my own personal use. I'd like to get this merged into the master repository so others can start using it, too!

I have a Google Individual Contributor License Agreement on file for this email address already. Please let me know if there's anything else I need to do or change.

@codygray codygray force-pushed the codygray:master branch 3 times, most recently from 3758cea to 0b0cd14 May 3, 2017
Adds a "lang-x86.js" lexer that enables syntax highlighting for
Intel x86 assembly language. This language handler supports
both Intel/MASM and AT&T/GAS syntax, and calls itself "x86"
(not the somewhat more obvious "asm", since there are
other architectures with their own assembly languages
that this library may eventually want to support, also).

Also added a few rudimentary tests. I have a more complete
test harness for this, but I didn't want to overload the standard
tests. Comprehensively testing this language module is
difficult, because it needs to support so many different styles
of syntax. (These could be broken up into different modules,
but I prefer having them all under one heading for the
convenience of the user at the expense of some difficulty
and/or complexity in the implementation.)

Note that the regexes have been heavily optimized, particularly
those for matching the vast array of instruction mnemonics.
Although this had the unfortunate effect of obfuscating the code,
the Safari web inspector shows it cut the render time in half.

This comment has been minimized.

Copy link

commented Jun 30, 2018

Any update for this pull request? If not, then I'll add @codygray 's code to my site manually.


hmenke approved these changes Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.