: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
})(function(CodeMirror) {
CodeMirror.defineMode("gas", function(_config, parserConfig) {
// If an architecture is specified, its initialization function may
// populate this array with custom parsing functions which will be
// tried in the event that the standard functions do not find a match.
// The symbol used to start a line comment changes based on the target
// If no architecture is pased in "parserConfig" then only multiline
// comments will have syntax support.
var lineCommentStartSymbol = "";
// These directives are architecture independent.
// Machine specific directives should go in their respective
// architecture initialization function.
// http://sourceware.org/binutils/docs/as/Pseudo-Ops.html#Pseudo-Ops
".bundle_align_mode" : "builtin",
".bundle_lock" : "builtin",
".bundle_unlock" : "builtin",
".cfi_startproc" : "builtin",
".gnu_attribute" : "builtin",
".loc_mark_labels" : "builtin",
".noaltmacro" : "builtin",
".popsection" : "builtin",
".protected" : "builtin",
".pushsection" : "builtin",
".subsection" : "builtin",
".vtable_entry" : "builtin",
".vtable_inherit" : "builtin",
function x86(_parserConfig) {
lineCommentStartSymbol = "#";
registers.ax = "variable";
registers.eax = "variable-2";
registers.rax = "variable-3";
registers.bx = "variable";
registers.ebx = "variable-2";
registers.rbx = "variable-3";
registers.cx = "variable";
registers.ecx = "variable-2";
registers.rcx = "variable-3";
registers.dx = "variable";
registers.edx = "variable-2";
registers.rdx = "variable-3";
registers.si = "variable";
registers.esi = "variable-2";
registers.rsi = "variable-3";
registers.di = "variable";
registers.edi = "variable-2";
registers.rdi = "variable-3";
registers.sp = "variable";
registers.esp = "variable-2";
registers.rsp = "variable-3";
registers.bp = "variable";
registers.ebp = "variable-2";
registers.rbp = "variable-3";
registers.ip = "variable";
registers.eip = "variable-2";
registers.rip = "variable-3";
registers.cs = "keyword";
registers.ds = "keyword";
registers.ss = "keyword";
registers.es = "keyword";
registers.fs = "keyword";
registers.gs = "keyword";
function armv6(_parserConfig) {
// http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf
// http://infocenter.arm.com/help/topic/com.arm.doc.ddi0301h/DDI0301H_arm1176jzfs_r0p7_trm.pdf
lineCommentStartSymbol = "@";
directives.syntax = "builtin";
registers.r0 = "variable";
registers.r1 = "variable";
registers.r2 = "variable";
registers.r3 = "variable";
registers.r4 = "variable";
registers.r5 = "variable";
registers.r6 = "variable";
registers.r7 = "variable";
registers.r8 = "variable";
registers.r9 = "variable";
registers.r10 = "variable";
registers.r11 = "variable";
registers.r12 = "variable";
registers.sp = "variable-2";
registers.lr = "variable-2";
registers.pc = "variable-2";
registers.r13 = registers.sp;
registers.r14 = registers.lr;
registers.r15 = registers.pc;
custom.push(function(ch, stream) {
var arch = (parserConfig.architecture || "x86").toLowerCase();
} else if (arch === "arm" || arch === "armv6") {
function nextUntilUnescaped(stream, end) {
var escaped = false, next;
while ((next = stream.next()) != null) {
if (next === end && !escaped) {
escaped = !escaped && next === "\\";
function clikeComment(stream, state) {
var maybeEnd = false, ch;
while ((ch = stream.next()) != null) {
if (ch === "/" && maybeEnd) {
token: function(stream, state) {
return state.tokenize(stream, state);
var style, cur, ch = stream.next();
state.tokenize = clikeComment;
return clikeComment(stream, state);
if (ch === lineCommentStartSymbol) {
nextUntilUnescaped(stream, '"');
cur = stream.current().toLowerCase();
if (ch === "0" && stream.eat("x")) {
stream.eatWhile(/[0-9a-fA-F]/);
cur = stream.current().toLowerCase();
for (var i = 0; i < custom.length; i++) {
style = custom[i](ch, stream, state);
lineComment: lineCommentStartSymbol,