Search code examples
loopsconditional-statementsuimaruta

Can we specifically annotate a line within given range or ask line annotator to run for n times post this keyword in Ruta?


BLOCK(structure) Line{}{
    Line{-> TestLine};
}

This code will annotate all lines with TestLine. Is this possible to annotate first 10 lines or say n number of lines? Or Can we ask it to stop further annotation if it encounters any specific keyword or start annotation once keyword is encountered?


Solution

  • You can use variables to store the number of times you want to match and then annotate based on that. Please refer to documentation, section variables.

    As simple example to annotate the first 4 lines would be:

    DECLARE TestLine;
    
    INT counter;
    Line{counter<4 -> TestLine, counter = counter+1};