I /believe/ the problem with the 'nasm' pygments lexer (I'm using Sphinx
1.1.3, and Pygments 1.5 is that it doesn't recognize
@DATA
as a legal identifier (commenting out the line with that identifier makes
the nasm lexer pretty-print both forms, and checking the code for the nasm
lexer indicates that it requires identifiers to start with a lower or upper
alpha, dollar, period, underbar, or question mark:
identifier = r'[a-zA-Z$._?][a-zA-Z0-9$._?#@~]*'
The 'gas' lexer doesn't recognize @ as a valid initial character for an
identifier either: either an identifier must start with an alpha, dollar or
underbar (and in this case, it can be a single character), OR it must start
with a period (and in this case be followed by at least one other valid
identifier character (including the @ character).
I'm not saying that @DATA is not a legal identifier for your assembly -- I
don't know assembly. But the pygments lexers don't seem to think so...
The 'llvm' lexer does admit that @DATA could be a valid identifier, but
there could be other issues in the code there -- characterizing the blocks
as llvm code doesn't pretty-print either of them. (Actually, characterizing
them as 'gas' doesn't pretty-print either of them either.)
To test these, I used a ".. code-block:: nasm" (and so on) directive to
explicitly characterize the code. As far as I can tell (as of pygments
1.5), there are there are three assembly dialects supported: nasm, gas, and
llvm.
--
V.
On Tuesday, 22 May 2012 07:29:11 UTC-4, Craig Barnes wrote:
>
> On Monday, 21 November 2011 08:53:58 UTC, Rishi wrote:
>>
>> Hi All,
>>
>>
>> I am using Sphinx for writing a document on assembly level programming
>> and I must say that its the best tool for writing any documentation.
>>
>> I am facing a small issue here
>>
>>
>> I have one piece of code which is as follows. This code is not getting
>> highlighted.
>> ---------------------
>> *; Printing 'A'*
>>
>> *.model small
>>
>> .data
>>
>> .code
>>
>> ; Set the data segment.
>> MOV AX, @DATA
>> MOV DS, AX
>>
>>
>> ; We will move the ASCII value of 'A' in the DL register.
>> MOV DL, 41H
>>
>> ; We will move 02H in the AH register, this will ask int 21h to print a
>> single character.
>> MOV AH, 02H
>> INT 21H
>>
>>
>> MOV AX, 4C00H
>> INT 21H
>>
>> END**
>> *-----------------------
>> While when I changed the code to the following its getting highlighted
>> properly. I am not getting why is this happening. The only difference is
>> the bolded part.
>> --------------------------
>> *; Printing 'A'
>>
>> .model small
>>
>> DATA SEGMENT
>>
>> DATA ENDS
>>
>>
>> CODE SEGMENT
>>
>> ; Set the data segment.
>> assume cs:code, ds: data
>>
>> ; We will move the ASCII value of 'A' in the DL register.
>> MOV DL, 41H
>>
>> ; We will move 02H in the AH register, this will ask int 21h to print a
>> single character.
>> MOV AH, 02H
>> INT 21H
>>
>>
>> MOV AX, 4C00H
>> INT 21H
>>
>> CODE ENDS
>> END **
>> *----------------------------
>>
>> I tried uploading the code on the website http://pygments.org/ and found
>> that both the code are getting highlighted properly.
>>
>> The version of pygments on the system is
>>
>> * $ pygmentize -V
>> Pygments version 1.3.1, (c) 2006-2008 by Georg Brandl.
>> *
>>
>> Hello,
>
> I am getting the same issue.
>
> Has anyone found a solution to this?
>
> Thanks
>
> Craig
>
>
--
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sphinx-dev/-/Ow9QgYrHyq8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en.