I am using latest version of YaccLexTools (0.2.2) which include GPLEX 1.2.1.
I am trying to define a token which would be case-insensitive.
However it does not seem to be an easy task. None of the default solutions work: 1. Putting %option caseless - GPLEX does not understand it. 2. Using Regex ?i: option does not work either. Eg Second (?i:(s|sec|second) Seconds (?i:seconds)
At the moment I am using a really mundane workaround:
Seconds ([sS][eE][cC][oO][nN][dD][sS])
But long-term this seems to be not feasible or rather not practical solution.
Is there any proper way to make GPLEX case insensitive either globally or per token?
Thanks, Radek
I found one solution that works. It applies case insensitivity globally. It is a bit hacky but so far that's the only that works.
You need to edit your csproj file manually.
Find the lines that start with:
<Exec Command="$(GplexTool) "/out:
Add string "/caseInsensitive"
right after $(GplexTool)
as follows:
<Exec Command="$(GplexTool) "/caseInsensitive" "/out:
Repeat it for all occurrences.
That should do the trick.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.