passlab / ompparser

ompparser: A Standalone and Unified OpenMP Parser
https://github.com/passlab/ompparser
Other
5 stars 1 forks source link

Another method in lexer to cut the type and variable in declare mapper directive #122

Open XinyaoYI opened 1 year ago

XinyaoYI commented 1 year ago

There may be an approach of splitting the type/var string in the lexer.

  1. using a buffer to save the string.
  2. cut the string from the end to the beginning
  3. using unput() to get the scanned characters.

Then we can return the type and var as two individual tokens to the parser.

It would be a better solution than this one because we can keep the ompparser grammar the same as OpenMP spec.