简体   繁体   中英

YaccLexTools: Gplex - how to make it case insensitive

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.

  1. Find the lines that start with:

    <Exec Command="$(GplexTool) &quot;/out:

  2. Add string &quot;/caseInsensitive&quot; right after $(GplexTool) as follows:

    <Exec Command="$(GplexTool) &quot;/caseInsensitive&quot; &quot;/out:

  3. Repeat it for all occurrences.

  4. Rebuild the project.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM