-
Notifications
You must be signed in to change notification settings - Fork 365
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
fail to parse the #define macro #1612
Comments
@WoolenWang thanks for the description. I have some problems to understand reproduce the problem? Could you give some more information how to reproduce the issue. In best case a reduced source code sample. |
@guwirth the src code use to parse is https://github.com/lua/lua/releases/tag/v5-2-3 get error when i use jruby call api to parse in file lstring.c .(but using the toolkit is ok to parse lstring.c) the code i write in ruby with jruby as bellow:: the key code is :: context = SquidAstVisitorContextImpl.new(SourceProject.new(""))
config = CxxConfiguration.new(Charset.forName(@encoding))
config.setErrorRecoveryEnabled(false)
if is_need_include
debug "添加include目录:#{self.include_dirs.uniq}"
config.setIncludeDirectories(self.include_dirs.uniq)
end
cpp_language = CppLanguage.new(MapSettings.new.asConfig)
parser = CxxParser.create(context, config, cpp_language)
# parser = CxxParser.create(context, config) 新的使用加了一个language,这个language可以直接送一个任意的配置进去就可以了
@line_offset = LineOffsets.new(@file_str)
@ast_node = parser.parse(@file_str) this code i just learn from your code usage: when i call CxxConfiguration.setErrorRecoveryEnabled(true) with getting this error ::
if i call CxxConfiguration.setErrorRecoveryEnabled(false) with getting this error ::
is that the way i use this cxx-sslr is not right?? really thanks for you to reply this. |
Oh, i found that this error was related to multi thread |
@WoolenWang you are correct: at the moment our plugin is not thread-safe. Unfortunately our preprocessor (which is responsible for the evaluation of @guwirth I already suggested to delete some shared states in preprocessor (see #1638). However the presence of |
Improved with 1.2.2 |
Look forward to this 1.2.2 version, the thread safe analysis is very cool , waiting for that |
Please turn debug info on and reproduce your issue.
The debug info in the log file could help to solve or locate the issue.
Description
Please provide a succinct description of your issue.
Steps to reproduce the problem
Please provide the steps required to reproduce the problem
parse with include header,setting the include dir ok
parse the c source code
Expected behavior
parse ok with the sslr ast tree node
Actual behavior
get exception::
`
com.sonar.sslr.api.RecognitionException: Parse error at line 1 column 8:
--> list_inline inlineEOF#define AD_R_OK 0EOF
`
Known workarounds
the parse error header is ::
LOG file
10:53:17.313 [Ruby-0-Thread-3: E:/git/code_helper/src/code_logger/code_inject/inject_runner.rb:88] WARN org.sonar.cxx.preprocessor.CxxPreprocessor - Cannot parse '#define list_inline inline', ignoring... 10:53:17.313 [Ruby-0-Thread-5: E:/git/code_helper/src/code_logger/code_inject/inject_runner.rb:88] WARN org.sonar.cxx.preprocessor.CxxPreprocessor - Cannot parse '#define AD_R_OK 0', ignoring... 10:53:17.313 [Ruby-0-Thread-3: E:/git/code_helper/src/code_logger/code_inject/inject_runner.rb:88] DEBUG org.sonar.cxx.preprocessor.CxxPreprocessor - Parser exception: '{}'
Related information
1.1.0
The text was updated successfully, but these errors were encountered: