Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ompparser APIs #83

Open
yanyh15 opened this issue Nov 12, 2019 · 0 comments
Open

ompparser APIs #83

yanyh15 opened this issue Nov 12, 2019 · 0 comments

Comments

@yanyh15
Copy link
Member

yanyh15 commented Nov 12, 2019

We need two internal global variables for language: user_set_lang for storing user-specified language, auto_lang for storing parser detected language. Our only report errors that are incompatible.

Now we have three APIs:

  1. setLang: set the user_set_lang variable to the language user wants to parse in the future call to parseOpenMP

  2. getLang: return the value of the user_set_lang variable

  3. parseOpenMP: check the language for the string to be parsed (we can only detect C/C++ and Fortran, we cannot differentiate C and C++), if it is not compatible (C and C++ are compatible) with the user_set_lang that is already set, report error and return. If user_set_lang is not set, parser will use the detected language (stored in auto_lang variable) for the parsing and set the directive->lang field. In this case, auto_lang will be set at begining as Lang_C and then will be reset as Lang_C++. The directive->lang will be either user_set_lang or the detected 'auto_lang'.

For linear clause, detecting language needs to be done at the beginning for C/Fortran and then in the middle of parsing as well since only some modifier are allowed for C++. So if C++ modifier is parsed, parser needs to set auto_lang to C++ if the current auto_lang is not lang_fortran, parser also needs to check whether user_set_langis set and if so, compare it withauto_lang`.

A macro for checking whether detected language matches user-specified language.

#define lang_not_match ( ) (user_set_lang != Lang_unknown && user_set_lang != auto_lang) 
XinyaoYI added a commit that referenced this issue Nov 22, 2019
let user to specify whether it is for C, C++ or Fortran #80
Set two internal global variables for language: user_set_lang for storing user-specified language, auto_lang for storing parser detected language. And use setLang() to let user set the language.
ouankou added a commit that referenced this issue Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant