Added comment support
This commit is contained in:
parent
e78371e26a
commit
f83c23b831
3 changed files with 42 additions and 18 deletions
3
README
3
README
|
|
@ -124,4 +124,5 @@ x single value x
|
|||
* all possible values
|
||||
|
||||
|
||||
Comments can be written inside {} by doing //=<COMMENT>
|
||||
Comments can be done with //
|
||||
note: // in value lines will not be ignored
|
||||
|
|
|
|||
26
example.mim
26
example.mim
|
|
@ -1,26 +1,29 @@
|
|||
[
|
||||
|
||||
// LAUNCH CONTROL
|
||||
{
|
||||
name=Launch Control
|
||||
commands=[
|
||||
// KNOBS HIGH
|
||||
{
|
||||
//=KNOB HA
|
||||
//=displays value 0:127 for knobs 21-28
|
||||
//KNOB HA
|
||||
//displays value 0:127 for knobs 21-28
|
||||
type=controller
|
||||
id=21:28
|
||||
shell=echo "Knob #$id ch$channel:$value"
|
||||
},
|
||||
// KNOBS LOW
|
||||
{
|
||||
//=KNOB L1
|
||||
//=displays value 0:127 for knob 41 from any channel
|
||||
//KNOB L1
|
||||
//displays value 0:127 for knob 41 from any channel
|
||||
type=controller
|
||||
id=41
|
||||
channel=*
|
||||
shell=echo "Knob #$id ch$channel:$value"
|
||||
},
|
||||
{
|
||||
//=KNOB L2
|
||||
//=displays value -100:100 for knob 42 on channel 0
|
||||
//KNOB L2
|
||||
//displays value -100:100 for knob 42 on channel 0
|
||||
type=controller
|
||||
id=42
|
||||
channel=0
|
||||
|
|
@ -28,8 +31,8 @@
|
|||
shell=echo "Knob #$id ch$channel:$value r:$rawvalue"
|
||||
},
|
||||
{
|
||||
//=KNOB L3 H1
|
||||
//=displays value 0:1:0 for knob 42 on channel 1 (first half)
|
||||
//KNOB L3 H1
|
||||
//displays value 0:1:0 for knob 42 on channel 1 (first half)
|
||||
type=controller
|
||||
id=42
|
||||
channel=1
|
||||
|
|
@ -39,8 +42,8 @@
|
|||
shell=echo "Knob #$id ch$channel:$value"
|
||||
},
|
||||
{
|
||||
//=KNOB L3 H2
|
||||
//=displays value 0:1:0 for knob 42 on channel 1 (second half)
|
||||
//KNOB L3 H2
|
||||
//displays value 0:1:0 for knob 42 on channel 1 (second half)
|
||||
type=controller
|
||||
id=42
|
||||
channel=1
|
||||
|
|
@ -52,15 +55,18 @@
|
|||
]
|
||||
}
|
||||
,
|
||||
// LAUNCHPAD
|
||||
{
|
||||
name=Launchpad S
|
||||
commands=[
|
||||
{
|
||||
// ANY NOTE ON
|
||||
type=note
|
||||
id=*
|
||||
shell=echo "Note $id on velocity:$velocity"
|
||||
},
|
||||
{
|
||||
// ANY NOTE OFF
|
||||
type=note
|
||||
id=*
|
||||
trigger=0
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ std::pair<std::string,std::string> readValue(std::string const& in, unsigned int
|
|||
unsigned int i=0,j=0,reading=0;
|
||||
while(i<in.size())
|
||||
{
|
||||
while(!isRead(in[i])) /*Lire jusqu'à un caractère lu (ingorer les espaces etc...)*/
|
||||
while(!isRead(in[i])) //read till read char
|
||||
i++;
|
||||
if(i>=in.size())
|
||||
{
|
||||
|
|
@ -407,17 +407,26 @@ std::pair<std::string,std::string> readValue(std::string const& in, unsigned int
|
|||
*rank=-1;
|
||||
return std::make_pair("","");
|
||||
}
|
||||
while(in[i]!='=' && in[i]!=':') //lire le nom
|
||||
if(i+1 < in.size() && in[i]=='/' && in[i+1]=='/') //ignore // comment
|
||||
{
|
||||
i+=2;
|
||||
while(i<in.size() && in[i] !='\n' )
|
||||
i++;
|
||||
i++;
|
||||
while(!isRead(in[i]))
|
||||
i++;
|
||||
}
|
||||
while(in[i]!='=' && in[i]!=':') //read name
|
||||
{
|
||||
name += in[i];
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
if(occurence==reading) /*Si c'est l'occurence que l'on veut*/
|
||||
if(occurence==reading) //this is the correct occurence
|
||||
{
|
||||
unsigned int counter=0;
|
||||
j=i;
|
||||
if(in[i]=='{') /*Valeur encapsulée*/
|
||||
if(in[i]=='{') //encapsulated
|
||||
{
|
||||
i++;
|
||||
while(i<in.size() && !(in[i]=='}' && counter==0))
|
||||
|
|
@ -441,7 +450,7 @@ std::pair<std::string,std::string> readValue(std::string const& in, unsigned int
|
|||
*rank=i;
|
||||
return std::make_pair(name, in.substr(j,i-j));
|
||||
}
|
||||
else if(in[i]=='[') /*Valeur encapsulée*/
|
||||
else if(in[i]=='[') //encapsulated
|
||||
{
|
||||
i++;
|
||||
while(i<in.size() && !(in[i]==']' && counter==0))
|
||||
|
|
@ -555,9 +564,17 @@ std::vector<std::string> readList(std::string const& in)
|
|||
j=i;
|
||||
while(i<in.size() && !(in[i]==',' && counter==0) && !(in[i]==']' && counter==0) )
|
||||
{
|
||||
if(i+1 < in.size() && in[i]=='/' && in [i+1]=='/') //ignore // comments
|
||||
{
|
||||
i+=2;
|
||||
while(i<in.size() && in[i] !='\n' )
|
||||
i++;
|
||||
i++;
|
||||
j=i;
|
||||
}
|
||||
if(in[i]=='\\')
|
||||
i++;
|
||||
else if(in[i]=='{')
|
||||
else if(in[i]=='{') // start of chunk
|
||||
{
|
||||
i++;
|
||||
unsigned int counter2=0;
|
||||
|
|
@ -572,7 +589,7 @@ std::vector<std::string> readList(std::string const& in)
|
|||
i++;
|
||||
}
|
||||
}
|
||||
else if(in[i]=='\"')
|
||||
else if(in[i]=='\"') //quote value
|
||||
{
|
||||
i++;
|
||||
while(in[i]!='\"')
|
||||
|
|
|
|||
Loading…
Reference in a new issue