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

Unsafe keywords #288

Merged
merged 2 commits into from
Sep 1, 2023
Merged

Unsafe keywords #288

merged 2 commits into from
Sep 1, 2023

Conversation

wise0704
Copy link
Contributor

@wise0704 wise0704 commented Sep 1, 2023

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.

Copy link
Member

@JoeRobich JoeRobich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wise0704!

@JoeRobich JoeRobich merged commit b75bcbf into dotnet:main Sep 1, 2023
2 checks passed
@@ -2761,29 +2782,60 @@ repository:
include: "#comment"
}
]
"checked-unchecked-statement":
Copy link

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'

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants