jeudi 18 août 2016

Regular expression for parsing array indexing expressions in C++

Am doing some semantic analysis on C++ source code. I have a regular expression to transform the array declarations from int [123] [1234] to int [number] [number].

But I want the expression also be able to match dimensions such as these int [i * x][ring_size][w + 6].

How do I tell it to match anything inside (symbols and spaces included) [ ]?

My regular expression so fas is: regex arrayDims("\\[[0-9]+\\]");. I am using C++11 regex header.

Thank you

Aucun commentaire:

Enregistrer un commentaire