roman number II interpreted as I

Issue #1 resolved
Kyle Cartmell
repo owner created an issue

The roman numeral "II" is being parsed as "I".

For example, building the following program...

{{{ A test program.

Romeo, foo. Juliet, foo.

            ACT I: foo.
            SCENE I: foo.

[Enter Romeo and Juliet]

Romeo: You are nothing.

Juliet: You are nothing.

            SCENE II: foo.

Romeo: You are nothing.

[Exeunt] }}}

... results in some warnings ...

{{{ kyle@debby:~/marlowe$ ./spl2c < tests/actTwo.spl > tests/actTwo.c Warning at line 17: comment expected Warning at line 17: comment expected Warning at line 17: comment expected Warning at line 17: colon expected 4 warnings found. Code may be defective. kyle@debby:~/marlowe$ }}}

... and the following C code ... (code edited for brevity)

{{{ int main(void) {

CHARACTER romeo; / foo / CHARACTER juliet; / foo /

int comp1, comp2;

global_initialize();

romeo = initialize_character("Romeo"); juliet = initialize_character("Juliet");

act_i: / foo /

act_i_scene_i: / foo /

enter_scene(9, romeo); enter_scene(9, juliet);

activate_character(14, romeo); assign(12, second_person, 0);

activate_character(17, juliet); assign(15, second_person, 0);

act_i_scene_i: / NO COMMENT FOUND /

activate_character(22, romeo); assign(20, second_person, 0);

exit_scene_all(22);

return 0; } }}}

Notice that the act_i_scene_i label occurs twice. The second label should have been act_i_scene_ii.

Comments (2)

  1. Kyle Cartmell reporter
    • changed status to resolved
    • removed assignee

    542364f215a4 There seems to have been a precedence issue in the regular expression that was parsing roman numerals. Replaced with a particularly wicked expression provided by paxdiablo over at stackoverflow. (http://stackoverflow.com/questions/267399/how-do-you-match-only-valid-roman-numerals-with-a-regular-expression)

    This seems to correct the issue, but it's not been extensively tested. Anyone relying heavily on the correct interpretation of this language should conduct further testing and have their head examined.

  2. Log in to comment