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

include for preprocessor_number_literal has no matching pattern #653

Closed
1 task done
asottile opened this issue Mar 1, 2024 · 2 comments
Closed
1 task done

include for preprocessor_number_literal has no matching pattern #653

asottile opened this issue Mar 1, 2024 · 2 comments

Comments

@asottile
Copy link
Contributor

asottile commented Mar 1, 2024

Checklist

  • This problem exists even with the setting "C_Cpp.enhancedColorization": "Disabled" (n/a)

If Disabling that^ makes the problem go away, then follow this to make an issue on the C++ extension:
https://github.com/microsoft/vscode-cpptools/issues/new/choose

The code with a problem is:

#pragma once

It looks like:

n/a

Traceback (most recent call last):
  File "/home/asottile/workspace/babi-grammars/bin/test-grammars", line 73, in <module>
    raise SystemExit(main())
  File "/home/asottile/workspace/babi-grammars/bin/test-grammars", line 56, in main
    state, _ = highlight_line(
  File "/home/asottile/workspace/babi-grammars/.tox/py310/lib/python3.10/site-packages/babi/highlight.py", line 749, in highlight_line
    search_res = state.cur.rule.search(
  File "/home/asottile/workspace/babi-grammars/.tox/py310/lib/python3.10/site-packages/babi/highlight.py", line 363, in search
    return _do_regset(idx, match, self, compiler, state, pos)
  File "/home/asottile/workspace/babi-grammars/.tox/py310/lib/python3.10/site-packages/babi/highlight.py", line 332, in _do_regset
    target_rule = compiler.compile_rule(rule.u_rules[idx])
  File "/home/asottile/workspace/babi-grammars/.tox/py310/lib/python3.10/site-packages/babi/highlight.py", line 633, in compile_rule
    ret = self._c_rules[rule] = self._compile_rule(grammar, rule)
  File "/home/asottile/workspace/babi-grammars/.tox/py310/lib/python3.10/site-packages/babi/highlight.py", line 601, in _compile_rule
    regs, rules = self._patterns(grammar, rule.patterns)
  File "/home/asottile/workspace/babi-grammars/.tox/py310/lib/python3.10/site-packages/babi/highlight.py", line 565, in _patterns_
    tmp_regs, tmp_rules = self._include(
  File "/home/asottile/workspace/babi-grammars/.tox/py310/lib/python3.10/site-packages/babi/highlight.py", line 547, in _include_
    return self._patterns(grammar, (repository[s[1:]],))
  File "/home/asottile/workspace/babi-grammars/.tox/py310/lib/python3.10/site-packages/babi/fdict.py", line 45, in __getitem__
    raise KeyError(key)
KeyError: 'preprocessor_number_literal'

It should look like:

(not crash my editor)

this include goes nowhere:

"include": "#preprocessor_number_literal"

it looks like maybe it should go here but idk where that hash comes from:

"d9bc4796b0b_preprocessor_number_literal": {

@jeff-hykin
Copy link
Owner

jeff-hykin commented Apr 16, 2024

it looks like maybe it should go here but idk where that hash comes from:

Yep thats correct.

The library (ruby_grammar_builder) allows making isolated files, in theory it prevents namespace collisions. It looks like there's an issue with how those are getting replaced though.

I'll add a workaround, and just let me know if there's any more missing ones.

@asottile
Copy link
Contributor Author

quick question as well -- what's the difference between ./syntaxes and ./autogenerated?

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

2 participants