|
# -*- coding: utf-8 -*-
|
|
def test
|
|
replacements =
|
|
[
|
|
#broken highlighting starts here - REs are interpreted as non-RE Ruby code and the string highlighting breaks, too
|
|
[/<p>.*1.+CPUID clears the high 32 bits of.+<\/p>\n/, ''],
|
|
[' </p>', '</p>'],
|
|
[/<sect>.*<\/sect>/m, '', 'CPUID'],
|
|
[/<p>NOTES:<\/p>.+/m, '', ["FADD/FADDP/FIADD", "FMUL/FMULP/FIMUL", "FPATAN"]],
|
|
[/<p>NOTES:<\/p>.+?\n<\/p>\n/m, '', ["FDIV/FDIVP/FIDIV", "FDIVR/FDIVRP/FIDIVR", "FPREM", "FPREM1"]],
|
|
[/<p>NOTES:<\/p>.+?<p>This instruction/m, '<p>This instruction', ["FSUBR/FSUBRP/FISUBR"]],
|
|
[/<p>IA-32 Architecture Compatibility<\/p>.+/m, ''],
|
|
[/<p>FXCH.+?<\/p>/m, lambda { |x| x[0].gsub('p>', 'pre>').gsub("\n<", '<') }],
|
|
["<p>Figure 3-3. ADDSUBPD—Packed Double-FP Add/Subtract</p>\n", ''],
|
|
[" See Figure 3-4.</p>\n<p>Figure 3-4. ADDSUBPS—Packed Single-FP Add/Subtract</p>\n<p>3-50 Vol. 2A ADDSUBPS—Packed Single-FP Add/Subtract</p>", '</p>'],
|
|
[/<p>Table \d+-\d+. (.+?)<\/p>\n<table>/, lambda { |x| "<table>\n<caption>#{x[1]}</caption>" }],
|
|
["\n\n", "\n"],
|
|
#everything from this point on is highlighted as a string
|
|
]
|
|
x = 2
|
|
'This is a perfectly valid Ruby program, yet ruby-mode fails to highlight the RE parts properly.'
|
|
end
|
|
|
|
puts test
|