1""" 
    2    pygments.lexers.amdgpu 
    3    ~~~~~~~~~~~~~~~~~~~~~~ 
    4 
    5    Lexers for the AMDGPU ISA assembly. 
    6 
    7    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. 
    8    :license: BSD, see LICENSE for details. 
    9""" 
    10 
    11from pygments.lexer import RegexLexer, words 
    12from pygments.token import Name, Text, Keyword, Whitespace, Number, Comment 
    13 
    14import re 
    15 
    16__all__ = ['AMDGPULexer'] 
    17 
    18 
    19class AMDGPULexer(RegexLexer): 
    20    """ 
    21    For AMD GPU assembly. 
    22    """ 
    23    name = 'AMDGPU' 
    24    aliases = ['amdgpu'] 
    25    filenames = ['*.isa'] 
    26    url = 'https://gpuopen.com/amd-isa-documentation' 
    27    version_added = '2.8' 
    28 
    29    flags = re.IGNORECASE 
    30 
    31    tokens = { 
    32        'root': [ 
    33            (r'\s+', Whitespace), 
    34            (r'[\r\n]+', Text), 
    35            (r'(([a-z_0-9])*:([a-z_0-9])*)', Name.Attribute), 
    36            (r'(\[|\]|\(|\)|,|\:|\&)', Text), 
    37            (r'([;#]|//).*?\n', Comment.Single), 
    38            (r'((s_)?(scratch|ds|buffer|flat|image)_[a-z0-9_]+)', Keyword.Reserved), 
    39            (r'(_lo|_hi)', Name.Variable), 
    40            (r'(vmcnt|lgkmcnt|expcnt)', Name.Attribute), 
    41            (r'(attr[0-9].[a-z])', Name.Attribute), 
    42            (words(( 
    43                'op', 'vaddr', 'vdata', 'off', 'soffset', 'srsrc', 'format', 
    44                'offset', 'offen', 'idxen', 'glc', 'dlc', 'slc', 'tfe', 'lds', 
    45                'lit', 'unorm'), suffix=r'\b'), Name.Attribute), 
    46            (r'(label_[a-z0-9]+)', Keyword), 
    47            (r'(_L[0-9]*)', Name.Variable), 
    48            (r'(s|v)_[a-z0-9_]+', Keyword), 
    49            (r'(v[0-9.]+|vcc|exec|v)', Name.Variable), 
    50            (r's[0-9.]+|s', Name.Variable), 
    51            (r'[0-9]+\.[^0-9]+', Number.Float), 
    52            (r'(0[xX][a-z0-9]+)|([0-9]+)', Number.Integer) 
    53        ] 
    54    }