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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a lexer for the TLS presentation language #2455

Merged
merged 5 commits into from Jun 15, 2023
Merged

Conversation

davidben
Copy link
Contributor

This is the syntax used to define TLS structures. It is defined (somewhat loosely) here:
https://www.rfc-editor.org/rfc/rfc8446#section-3

I patterned it after the Carbon syntax, mostly as an example of a small, vaguely-C-like lexer. Let me know if I got any of the project conventions wrong! I mostly mimicking other files and don't fully understand how the project works. 馃槃

CC: @dvorak42 @jyasskin

This is the syntax used to define TLS structures. It is defined
(somewhat loosely) here:
https://www.rfc-editor.org/rfc/rfc8446#section-3

I patterned it after the Carbon syntax, mostly as an example of a small,
vaguely-C-like lexer.
@jeanas
Copy link
Contributor

jeanas commented Jun 14, 2023

Hm, what are the uses for this format? Is it only used in the RFC itself, or more widely?

@davidben
Copy link
Contributor Author

davidben commented Jun 14, 2023

It's used in TLS extensions and anything else that uses that syntax to define structures. (It's just a compact syntax for describing fixed-width fields and fixed-width length prefixes.) Usually they're in other RFCs, which don't integrate with pygments, but @dvorak42 and @jyasskin wanted to embed something using it in a Bikeshed spec, which uses pygments, so I put this together for them.

AUTHORS Show resolved Hide resolved
pygments/lexers/tls.py Outdated Show resolved Hide resolved
@jeanas
Copy link
Contributor

jeanas commented Jun 15, 2023

OK, if it had some influence, why not, given that it's a very simple lexer.

Also remove line continuation rule. That was a copy/paste error.
pygments/lexers/tls.py Outdated Show resolved Hide resolved
Looking at the spec again, I'm not sure whether this is describing
syntax for their examples or actual syntax. Also I can't think of any
time I've seen it in a spec.
@davidben
Copy link
Contributor Author

One last change in case we crossed mid-air and you didn't see it. I removed this rule.
440ce9c

I got that from:

Optional components are denoted by enclosing them in "[[ ]]" (double brackets).
https://www.rfc-editor.org/rfc/rfc8446#section-3.2

But it only shows up in the spec here:
https://www.rfc-editor.org/rfc/rfc8446#section-3.5
https://www.rfc-editor.org/rfc/rfc8446#section-3.8

This seems to not actually be syntax but just to describe that, in the example, you could include it or not. I'll... see about getting that cleared up for rfc8446bis.

@jeanas
Copy link
Contributor

jeanas commented Jun 15, 2023

We have CI failures, please run tox -e check and make sure it passes.

@davidben
Copy link
Contributor Author

davidben commented Jun 15, 2023

Ah, whoops, I only ran plain tox. Fixed, I think.

(On my machine I got the .../tls.py:4: wrong module name underline, should be ~~~...~ error, but I also get a pile of unrelated ../__init__.py:0: empty file errors that don't seem to appear in CI. Fixed the former but left the latter alone.)

@jeanas
Copy link
Contributor

jeanas commented Jun 15, 2023

Maybe you have something in your source tree that interferes? Such as a (non-tox-managed) venv?

@jeanas jeanas merged commit bcd506d into pygments:master Jun 15, 2023
15 checks passed
@Anteru Anteru added this to the 2.16.0 milestone Aug 5, 2023
@Anteru Anteru added the A-lexing area: changes to individual lexers label Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lexing area: changes to individual lexers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants