How to implement path validation using PLY

27 Views Asked by At

I would like to know how to implement such a parser using PLY

An example of implementing such a parser using FLEX

%option noyywrap
%x USER END
%%
<INITIAL>{
^(C:\/Users)BEGIN(USER);
\n return 0;
.;
}
<USER>{
(?:\/[a-z]+)/(?i:\/[a-z]+?)*$\n{BEGIN(END); return 1;}
.BEGIN(INITIAL);
\n{BEGIN(INITIAL); return 0;}
}
<END>
{
.;
\n BEGIN(INITIAL);
}
0

There are 0 best solutions below