Description
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:
-
setLang: set the
user_set_lang
variable to the language user wants to parse in the future call to parseOpenMP -
getLang: return the value of the
user_set_lang
variable -
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. Ifuser_set_lang
is not set, parser will use the detected language (stored inauto_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 eitheruser_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 with
auto_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)
Activity
Fixed issue #80 and #83
Merge pull request #85 from passlab/xinyao