%{
open FslexFsyacc
open FslexFsyacc.Fslex
open FslexFsyacc.Fslex.FslexTokenUtils
type token = PositionWith<FslexToken>
%}

<last>  = [")" "*" "+" "?" HOLE ID LITERAL "]"]
<first> = ["(" HOLE ID LITERAL "["]
<any>   = ["%%" "&" "(" ")" "*" "+" "/" "=" "?" CAP HEADER HOLE ID LITERAL REDUCER "[" "]" "|"]

%%

HEADER "%%"+     { [lexbuf.Head] }
<last> / <first> { appendAMP lexbuf }
<any>            { lexbuf }