adrian-thurston / ragel

Ragel State Machine Compiler
MIT License
532 stars 46 forks source link

Commented statements inside actions #106

Open bottle2 opened 4 months ago

bottle2 commented 4 months ago

I dunno what is bug and what needs to be clarified in documentation.

I'll just share some experiments. here follows a MSYS2 session:

Nero@DESKTOP-QIBT7ND CLANG64 ~
$ ragel -v
Ragel State Machine Compiler version 6.10 March 2017
Copyright (c) 2001-2009 by Adrian Thurston

Nero@DESKTOP-QIBT7ND CLANG64 ~
$ for i in comment-action-mre*.rl; do echo "Analyzing $i:"; cat "$i"; ragel "$i"; echo "Ragel returned $?"; done;
Analyzing comment-action-mre1.rl:
%%{
    machine mre1;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            fgoto error; // We DO expect an error here!
    }
    main := "Hello, world!" $debug;
}%%
comment-action-mre1.rl:6:1: could not resolve state reference error
Ragel returned 1
Analyzing comment-action-mre2.rl:
%%{
    machine mre2;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            ;
            #fgoto error; Should we expect an error here?
    }
    main := "Hello, world!" $debug;
}%%
comment-action-mre2.rl:7: could not resolve state reference error
Ragel returned 1
Analyzing comment-action-mre3.rl:
%%{
    machine mre2;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            ;
            //fgoto error; Should we expect an error here?
    }
    main := "Hello, world!" $debug;
}%%
Ragel returned 0
Analyzing comment-action-mre4.rl:
%%{
    machine mre2;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            ;
            /*fgoto error; Should we expect an error here?*/
    }
    main := "Hello, world!" $debug;
}%%
Ragel returned 0
Analyzing comment-action-mre5.rl:
%%{
    machine mre2;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            ;
#if 0
            fgoto error; Should we expect an error here?
#endif
    }
    main := "Hello, world!" $debug;
}%%
comment-action-mre5.rl:8:9: could not resolve state reference error
Ragel returned 1

Nero@DESKTOP-QIBT7ND CLANG64 ~
$

here follows the same session on Android:

~/downloads $ ragel -v
Ragel State Machine Compiler version 7.0.4 February 2021
Copyright (c) 2001-2021 by Dr. Adrian D. Thurston et al.
~/downloads $ for i in comment-action-mre*.rl; do echo "Analyzing $i:"; cat "$i"; ragel "$i"; echo "Ragel returned $?"; done;
Analyzing comment-action-mre1.rl:
%%{
    machine mre1;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            fgoto error; // We DO expect an error here!
    }
    main := "Hello, world!" $debug;
}%%
comment-action-mre1.rl:6:13: could not resolve state reference error
Ragel returned 0
Analyzing comment-action-mre2.rl:
%%{
    machine mre2;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            ;
            #fgoto error; Should we expect an error here?
    }
    main := "Hello, world!" $debug;
}%%
comment-action-mre2.rl:7:14: could not resolve state reference error
Ragel returned 0
Analyzing comment-action-mre3.rl:
%%{
    machine mre2;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            ;
            //fgoto error; Should we expect an error here?
    }
    main := "Hello, world!" $debug;
}%%
Ragel returned 0
Analyzing comment-action-mre4.rl:
%%{
    machine mre2;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            ;
            /*fgoto error; Should we expect an error here?*/
    }
    main := "Hello, world!" $debug;
}%%
Ragel returned 0
Analyzing comment-action-mre5.rl:
%%{
    machine mre2;
    action debug {
        printf("I got %c!\n", fc);
        if ('@' == fc)
            ;
#if 0
            fgoto error; Should we expect an error here?
#endif
    }
    main := "Hello, world!" $debug;
}%%
comment-action-mre5.rl:8:13: could not resolve state reference error
Ragel returned 0
~/downloads $

haha "Android". I mean specifically Termux:

~/downloads $ uname -a
Linux localhost 4.19.191-g7dd98df8b4b4 #1 SMP PREEMPT Fri Mar 29 17:48:13 CST 2024 aarch64 Android

anyway, I don't really expect anything from this issue, just fixing funny warnings because I wrote a lot of Ragel before trying to compile for the first time