Contents    Page-10    Prev    Next    Page+10    Index   

The Lookahead Operator[slide by John Werth.]

If r1 and r2 are patterns, then r1/r2 means match r1 only if it is followed by r2.

For example, Fortran has a DO statement, similar to the for statement; unfortunately, the DO statement could look very similar to an assignment statement:


    DO 10 I = 1,25      cf.  for (i=1; i<=25; i++)

    DO 10 I = 1.25           do10i = 1.25;


DO/({letter}|{digit})*=({letter}|{digit})*,
recognizes the keyword DO in the string DO5I=1,25