pistoletpierre / language-systemverilog

Atom SystemVerilog language support
MIT License
5 stars 2 forks source link

Syntax Highlighting bug related to typedef of multidimensional arrays #3

Closed Tharaqon closed 5 years ago

Tharaqon commented 5 years ago

Current package version: 0.10.0 Atom version: 1.31.2 x64

I am currently working on an AES encryptor/decryptor in systemverilog, when I wrote the following section of code. I noticed that the code breaks the syntax highlighting; only 'typedef', 'class' and 'protected' keywords remain highlighted, as well as the parametrization arguments of the class. The syntax highlighting breaks up until the last line in the snippet of code.

I also noticed that if I only comment out the typedef of data_block, that the 'byte' keyword in the typedef of key_t gets highlighted again.

So it seems to me that it breaks when I try to typedef a multidimensional array. The actual systemverilog code compiles just fine, so it is just the highlighting that breaks.

 typedef byte data_block[0:3][0:3];
 typedef byte key_t [4][];

 class AES_calculator #(type_t MODE = encrypt, int KEY_SIZE = 128); //
     protected byte[0:255] s_box_lut;
     protected byte[0:255] s_box_inv_lut;
pistoletpierre commented 5 years ago

That should do it. Try updating and giving it a go @Tharaqon

Tharaqon commented 5 years ago

Apologies for late response; I was away for the weekend. I just updated to 0.12.1 and restarted atom. The issue still persists.

pistoletpierre commented 5 years ago

Hmm...could you provide more code that yields broken syntax highlighting? The example you gave in the first post seems fine to me:

Screen Shot 2019-04-23 at 08 20 03
Tharaqon commented 5 years ago

Ah, in my zeal in trying to make a MWE, I had removed a `define macro, as it seemed to make no difference. However, apparently there were two issues stacked on top of each other; without the `define it now works (whereas it did not before). With the `define it does not. Below you will find the full code (not trying to make it MWE). All lines above this section is a commented block with information about the script.

image

Note: By replacing `NB-1 in line 38 with 3, it now does highlight properly.

Apologies for the inconvenience.

pistoletpierre commented 5 years ago

@Tharaqon I'm surprised these weren't brought up before. This grammar came from language-verilog, which is significantly older and has since been abandoned, which in turn got its grammar from an even older SublimeText Verilog grammar. You're really stress testing this thing. Ok, now update & give it a go.

Tharaqon commented 5 years ago

@pistoletpierre , I just updated to 0.12.2, and it now works as I would expect. Thanks for the quick support!