Syntax highlighting for Lex files in CLion - clion

Is it possible to get syntax highlighting for Lex files in CLion? I could not find a suitable plugin. I am using the Lex files to learn flex and bison.

Related

How to hide a single header file from gcc

I am compiling a c++ project and trying to find all what all functions from ncurses.h are used throughout the project.
I was wondering if I can tell gcc to not include specifically ncurses.h?
I ended up passing -D__NCURSES_H=1 on command line. 🤷‍♂️

XCode 11 and Cmake Syntax Highlighting

I am developing CMake scripts to generate XCode in Xcode 11. However, there is no syntax highlighting for CMakeLists.txt or .cmake files. Is it possible to enable it?
Editor -> Syntax coloring -> c++

Make Clion consider ".h" files as C++

Is there a way to make CLion consider single files with ".h" extension as C++ by default and not C?
If they are not included in the CMake script, and there is no corresponding ".cc" file, it consideres them as C by default for the syntax highlighing.
In current 2018.1 version it should be treated properly as C++, one limitation is: if there is no C++ files in the configuration at all, then C will be selected.

How to enable QtScript in your project when using MS Visual Studio compiler?

With QMake, the setup for QtScript is as simple as adding this to your .pro file:
QT += script
But we'e using MS Visual Studio for the project. What do I change to make Visual Studio recognize includes for QtScript? Currently, it reports that the files were not found:
#include <QScriptEngine>
#include <QScriptValue>
fatal error C1083: Cannot open include file: 'QScriptValue': No such file or directory
I use the Qt add-in for visual studio. I have checked the script option there - well actually it was checked already - but that didn't solve the problem:
I tried like you, same error. Then I tried to include like this:
#include <QtScript/QScriptValue>
And it worked. I tried this again :
#include <QScriptValue>
And now it works.
I guess it is something similar to what is explained in this link,
To summarize,
Configuration properties: General
Character Set: Use Unicode Character Set
C/C++: General
Additional Include Directories: "QT include directory here".
Linker: General
Additional Library Directories: "QT Lib directory here".
Linker: Input
Additional Dependencies: Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib (the import libraries for the required Qt DLLs)
(Add subscript d for debug mode ...)

How do I suppress compiler warnings in Xcode for generated files?

I am currently using flex/bison to generate a lexer & parser, with the whole project in Xcode. However the files generated by flex & bison produce a couple of compiler warnings when they are compiled. How can I suppress these warnings?
I know I can suppress warnings on a per-file basis through the 'Build Phases' tab, but the generated files don't appear here.
I tried adding the flag [-w] to the source file [ie, the .lpp and .ypp files], however this didn't work - Xcode understandably tried to pass that flag to bison, which it didn't like.
You can also turn off the warnings by embedding a pragma for the clang (or gcc) compiler to disable individual warnings.
For example, you could do the following a .lpp or .ypp file:
%{
#pragma clang diagnostic ignored "-Wunused-variable"
%}
...
%%
...
Where the %{ ... %} construct tells flex/bison to pass the line direct to the output.
References:
Disabling clang warnings
Selectively disabling gcc warnings

Resources