-
Notifications
You must be signed in to change notification settings - Fork 34
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
Unsafe keywords #288
Unsafe keywords #288
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wise0704!
@@ -2761,29 +2782,60 @@ repository: | |||
include: "#comment" | |||
} | |||
] | |||
"checked-unchecked-statement": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this removed the definition of checked-unchecked-statement
however it is still referenced:
include: "#checked-unchecked-statement" |
this is breaking my more-strict tmlanguage parsing in https://github.com/asottile/babi-grammars:
Traceback (most recent call last):
File "/tmp/babi-grammars/bin/test-grammars", line 73, in <module>
raise SystemExit(main())
^^^^^^
File "/tmp/babi-grammars/bin/test-grammars", line 47, in main
compiler = grammars.compiler_for_file(filename, line)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 714, in compiler_for_file
return self.compiler_for_scope(scope)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 689, in compiler_for_scope
ret = self._compiled[scope] = Compiler(grammar, self)
^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 528, in __init__
root = self._compile_root(grammar)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 592, in _compile_root
regs, rules = self._patterns(grammar, grammar.patterns)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 565, in _patterns_
tmp_regs, tmp_rules = self._include(
^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 547, in _include_
return self._patterns(grammar, (repository[s[1:]],))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 571, in _patterns_
tmp_regs, tmp_rules = self._patterns(grammar, rule.patterns)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 565, in _patterns_
tmp_regs, tmp_rules = self._include(
^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 547, in _include_
return self._patterns(grammar, (repository[s[1:]],))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 571, in _patterns_
tmp_regs, tmp_rules = self._patterns(grammar, rule.patterns)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 565, in _patterns_
tmp_regs, tmp_rules = self._include(
^^^^^^^^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/highlight.py", line 547, in _include_
return self._patterns(grammar, (repository[s[1:]],))
~~~~~~~~~~^^^^^^^
File "/tmp/babi-grammars/.tox/py312/lib/python3.12/site-packages/babi/fdict.py", line 45, in __getitem__
raise KeyError(key)
KeyError: 'checked-unchecked-statement'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Opened #298 to remove this reference.
This is not a complete support for unsafe code, since there are many patterns detecting for type that do not support the * operator yet.
This PR only adds the missing keywords + minimal support for pointer type declaration.