Q:

Why can't lex recognize my regular expression definitions

I was doing it as:
    /* regular definitions */

    DECLARATIONS                declarations
    ENDDECLARATIONS         (enddeclarations)
    INT                     (int)
    METHOD                  (method)
    PROGRAM                 (program)

And 
    {DECLARATIONS}          {yycolumn+=yyleng;return (DECLARATIONSnum);}

to recognize it, but I found out that they were not recognized..... And if I do it like:
    "declarations"          {yycolumn+=yyleng;return (DECLARATIONSnum);}

It worked. I really can't understand why....
The sample input is like:
   program p2;
   class Test {
    method void main()
     declarations
        int x;

And currently it is like:
    program p2
    5       1         SEMInum
    class Test 
    6       1         LBRACEnum
    method void main
    7       1         LPARENnum

the program, class should be recognized as a Reserved word, but they are not recognized....

A:

DECLARATION             declarations

Singular
{DECLARATIONS}          {yycolumn+=yyleng;return (DECLARATIONSnum);}

Plural

