numere-org / NumeRe

Framework for numerical computations, data analysis and visualisation
https://www.numere.org
GNU General Public License v3.0
20 stars 7 forks source link

Possibility to declare an enumeration #72

Closed numeredev closed 1 year ago

numeredev commented 1 year ago

DESCRIPTION

What does your feature request improve on? Please describe. It is possible to create a enumeration-like structure with declare but keeping order and numbers unique is kind of tedious, especially if the values are used for layout IDs. A direct enumeration feature would improve on this.

Describe the solution you'd like Add a possibility to declare an enumeration like one of the following examples:

declare enum(VAL1,VAL2,VAL3)
declare enum := {VAL1,VAL2,VAL3}
declare enum -> {VAL1,VAL2,VAL3}

Additional context Add any other context or screenshots about the feature request here.

(Do not write below this line)


DEVS' SECTION

ANALYSIS

We'll use the third syntax declare enum -> {VAL1,VAL2,VAL,..}, where we also enable defining value starting points, i.e. {VAL1=10,VAL2,VAL3=2,...}. This can quite easily be implemented within void SymDefManager::createSymbol(const std::string& sCommandLine), where we proably will need an additional parser function to handle the value increments between each defined symbol. Careful: declare enum -> {} shall also be possible and simply declare nothing.

Add enum as specialval to enable the same syntax colour highlighting than true. Add it also to the documentation.

IMPLEMENTATION STEPS

(see also our Wiki for implementation guidelines)

DOCUMENTATION STEPS

(see also our Wiki for further information)

PULL REQUEST