tdauth / syntaxhighlightings

Syntax highlighting files mainly for Linux editors and Warcraft III file formats.
0 stars 0 forks source link

$A in JASS is not highlighted properly #10

Open tdauth opened 2 months ago

tdauth commented 2 months ago
elseif F6B==27 then
return(LKB((RZB),2))
endif
else
call DisplayTimedTextToPlayer(Player(0),0,0,$A,"Invalid Bonus Type")
endif
return-1.
endfunction

The formal definition says:

hex := '$'[0-9a-fA-F]+ | '0'[xX][0-9a-fA-F]+

from https://jass.sourceforge.net/doc/bnf.shtml

$A is valid hex.

tdauth commented 2 months ago
            <context attribute="Hex" lineEndContext="#pop" name="HexOrTextMacroArgument">
                <LineContinue attribute="Hex" context="#stay"/>
                <DetectChar attribute="Hex" context="#pop" char=" "/>
                <DetectChar attribute="Hex" context="#pop" char="$"/> <!-- is vJass text macro argument -> ends with $ -->
            </context>

We need a pop on any non hex character. So only the regex from above.