8000 Grammar warnings spam stderr · Issue #88 · eclipse-cdt/cdt-lsp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Grammar warnings spam stderr #88

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

Closed
ddscharfe opened this issue May 17, 2023 · 7 comments
Closed

Grammar warnings spam stderr #88

ddscharfe opened this issue May 17, 2023 · 7 comments
Milestone

Comments

@ddscharfe
Copy link
Contributor

I get lots of warnings which are written to stderr when a file is opened (only happens once per file after eclipse restart)

nested repeat operator '+' and '?' was replaced with '*' in regular expression /(using)(?:(?:\s)+)?(?!namespace)(\s*+((?:(?:(?:\[\[.*?\]\]|__attribute(?:__)?\s*\(\s*\(.*?\)\s*\))|__declspec\(.*?\))|alignas\(.*?\))(?!\)))?((?:((?:(?>(?:\s)+)|\/\*(?:[^\*]|(?:\*)++[^\/])*+(?:\*)++\/)+)|(?:\b)|(?=\W)|(?<=\W)|(?:\�)|(?:\Z)))(?:(?:(?:(?:unsigned)|(?:signed)|(?:short)|(?:long))|(?:(?:struct)|(?:class)|(?:union)|(?:enum)))((?:((?:(?>(?:\s)+)|\/\*(?:[^\*]|(?:\*)++[^\/])*+(?:\*)++\/)+)|(?:\b)|(?=\W)|(?<=\W)|(?:\�)|(?:\Z))))*((?:::)?(?:(?!\b(?:__has_cpp_attribute|reinterpret_cast|atomic_noexcept|atomic_commit|atomic_cancel|__has_include|synchronized|dynamic_cast|thread_local|static_cast|const_cast|co_return|constexpr|constexpr|constexpr|co_return|protected|namespace|consteval|noexcept|decltype|template|operator|noexcept|co_yield|co_await|reflexpr|continue|co_await|co_yield|requires|volatile|register|restrict|explicit|volatile|noexcept|typename|default|_Pragma|mutable|include|concept|alignas|virtual|alignof|__asm__|defined|mutable|typedef|warning|private|and_eq|define|pragma|typeid|switch|bitand|return|ifndef|export|struct|sizeof|module|static|public|extern|inline|friend|delete|xor_eq|import|not_eq|class|compl|bitor|throw|or_eq|while|catch|break|union|const|const|endif|ifdef|undef|error|using|else|line|goto|else|elif|this|enum|case|new|asm|not|try|for|and|xor|or|if|do|if)\b)(?<!\w)(?:[a-zA-Z_]|(?:\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}))(?:[a-zA-Z0-9_]|(?:\\u[0-9a-fA-F]{4}|\\U[0-9a-
...

The warnings originate from the joni library which parses the regular expressions. In org.eclipse.tm4e.core.internal.oniguruma.OnigRegExp, a regex is created like this

new Regex(pattern, 0, pattern.length, Option.CAPTURE_GROUP, UTF8Encoding.INSTANCE, Syntax.DEFAULT,
					WarnCallback.DEFAULT);

See https://github.com/jruby/joni/blob/master/src/org/joni/WarnCallback.java

public interface WarnCallback {
    WarnCallback DEFAULT = new WarnCallback() {
        public void warn(String message) {
            System.err.println(message);
        }
    };
    ...

The grammar has either to be fixed (in the https://github.com/jeff-hykin/better-cpp-syntax) or there has to be an option in https://github.com/eclipse/tm4e to disable the warnings being printed to stderr.

@ghentschke
Copy link
Contributor

That bothers me as well. Thank you for delivering the root cause. I think an option in tm4e would be fine.

@ghentschke
Copy link
8000
Contributor

Is there already an issue on tm4e?

@ddscharfe
Copy link
Contributor Author
ddscharfe commented May 17, 2023

Not yet, I can create an issue there and will try to provide a PR.

Btw if the warnings bother you, the clangd log messages bothered me too, but they can be disabled via the clangd command --log==error parameter (that's why I created issue 81).

@ddscharfe
Copy link
Contributor Author
ddscharfe commented May 17, 2023

Issue: eclipse-tm4e/tm4e#534
PR: eclipse-tm4e/tm4e#535

If accepted, we can get rid of the messages by setting
Logger.getLogger("").setLevel(Level.SEVERE);.

@ghentschke
Copy link
Contributor

Thank you @ddscharfe !

ddscharfe added a commit to ddscharfe/eclipse-cdt-lsp that referenced this issue May 17, 2023
ghentschke pushed a commit that referenced this issue May 17, 2023
@ghentschke
Copy link
Contributor
ghentschke commented May 17, 2023

Can be closed when target platform has been updated: see also #90 (comment)

ddscharfe added a commit to ddscharfe/eclipse-cdt-lsp that referenced this issue Jul 3, 2023
Keep a reference to the logger, otherwise it will be garbage collected
and a new logger will be used in tm4e which has a different warning
level.

See also eclipse-cdt#101.
ghentschke pushed a commit that referenced this issue Jul 3, 2023
Keep a reference to the logger, otherwise it will be garbage collected
and a new logger will be used in tm4e which has a different warning
level.

See also #101.
@ghentschke
Copy link
Contributor

Fixed with updated target platform

@jonahgraham jonahgraham added this to the 1.0.0 milestone Sep 18, 2023
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

3 participants
0