-
Notifications
You must be signed in to change notification settings - Fork 221
spec: grammar #578
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
Open
jkowalleck
wants to merge
50
commits into
package-url:main
Choose a base branch
from
jkowalleck:spec/grammar-ABNF
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
spec: grammar #578
Changes from 45 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
6ca8acd
spec: grammar ABNF
jkowalleck a405b2b
fix ABNF for `.` and `/` exceptions
jkowalleck 1a31031
fix ABNF for `.` inclusion
jkowalleck 3ccbab1
fix dot in subpath, like `...foo
jkowalleck 92f0b32
fix qualifier-key
jkowalleck 18f4ca3
fix
jkowalleck 4f2a434
format
jkowalleck c678791
fix subpath
jkowalleck ccecacb
fix subpath
jkowalleck 8a3a840
reformat
jkowalleck f1429f4
reformat
jkowalleck e8f95a7
reformat
jkowalleck 47b5940
moved grammar to own file
jkowalleck 012c1d8
fix: percent encoding spec applied to ABNF
jkowalleck 9751879
fix: percent encoding spec applied to ABNF
jkowalleck 8155567
layoput
jkowalleck b3c8bb3
docs
jkowalleck 187f2b2
fix
jkowalleck e822787
fix dot being not encoded nowhere never-ever
jkowalleck eeb3688
style
jkowalleck 83b5727
style
jkowalleck 20f93c8
style
jkowalleck 097da44
style
jkowalleck 7598bfb
style
jkowalleck 5ea4232
style
jkowalleck 294be92
Merge branch 'main' into spec/grammar-ABNF
jkowalleck 9f4aea6
add to TOC
jkowalleck 424fcc8
fix typos
jkowalleck 9cc7a42
duplicates as keywords
jkowalleck ab2c46c
typo and style
jkowalleck affade7
fix: non-canonical namespace
jkowalleck c8b72e9
fix: non-canonical qualifiers
jkowalleck d54d323
fix: non-canonical subpath
jkowalleck 305cf6e
Merge branch 'main' into spec/grammar-ABNF
mjherzog 0748fb5
Merge remote-tracking branch 'upstream/main' into spec/grammar-ABNF
jkowalleck 8765ae4
docs
jkowalleck bf00df3
docs
jkowalleck eb98ca7
style
jkowalleck a3a12e2
make grammar part of standard
jkowalleck 4c27377
docs
jkowalleck d57c009
style: max 80 characters per line
jkowalleck 3ce66b3
docs
jkowalleck 82a3ce0
style
jkowalleck 8102c22
docs
jkowalleck c00f4df
style
jkowalleck 1d2fc09
revisit according to spec
jkowalleck 1b1a6c7
style
jkowalleck 9a1e736
docs
jkowalleck e44bffb
Apply suggestion from @ppkarwasz
jkowalleck 4e5b907
style
jkowalleck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,106 @@ | ||||||
| # Package-URL Grammar | ||||||
|
|
||||||
| A PURL string adhers to the following grammar, | ||||||
| using syntax as per [RFC5234: Augmented BNF for Syntax Specifications: ABNF](https://datatracker.ietf.org/doc/html/rfc5234). | ||||||
|
|
||||||
| ```abnf | ||||||
| purl = scheme ":" *"/" type | ||||||
| [ 1*"/" namespace ] 1*"/" name *"/" | ||||||
| [ "@" version ] [ "?" qualifiers ] | ||||||
| [ "#" *"/" subpath *"/" ] | ||||||
| ; leading/trailing slashes allowed here and there | ||||||
| purl-canonical = scheme ":" type-canonical | ||||||
jkowalleck marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| [ "/" namespace-canonical ] "/" name | ||||||
jkowalleck marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| [ "@" version ] [ "?" qualifiers-canonical ] | ||||||
| [ "#" subpath-canonical ] | ||||||
|
|
||||||
|
|
||||||
| scheme = %x70.6B.67 ; lowercase string "pkg" | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you dont like this original ABNF case-sensitive notation, we could use RFC7405's case-sensitive notation:
Suggested change
|
||||||
|
|
||||||
| type = ALPHA *( ALPHA / DIGIT / "." / "-" ) | ||||||
| type-canonical = LOWALPHA *( LOWALPHA / DIGIT / "." / "-" ) | ||||||
|
|
||||||
| namespace = namespace-segment *( 1*"/" namespace-segment ) | ||||||
| namespace-canonical = namespace-segment *( "/" namespace-segment ) | ||||||
| namespace-segment = 1*namespace-sc | ||||||
| namespace-sc = PERM-ALPHANUM | ||||||
| / PERM-PUNCTUATION | ||||||
| / "%" ( PERM-ESCAPED-00-1F | ||||||
| / PERM-ESCAPED-20-2C | ||||||
| ; except general exclusion "-" (2D) | ||||||
| ; except general exclusion "." (2E) | ||||||
| ; except the separator "/" (2F) | ||||||
| / PERM-ESCAPED-30-FF ) | ||||||
| ; namespace safe characters | ||||||
|
|
||||||
| name = 1*PCT-ENCODED | ||||||
|
|
||||||
| version = 1*PCT-ENCODED | ||||||
|
|
||||||
| qualifiers = qualifier *( "&" qualifier ) | ||||||
| qualifiers-canonical = qualifier-canonical *( "&" qualifier-canonical ) | ||||||
| qualifier = qualifier-key "=" [ qualifier-value ] | ||||||
| qualifier-canonical = qualifier-key-canonical "=" qualifier-value | ||||||
| qualifier-key = ALPHA *( ALPHA / DIGIT / "." / "-" / "_" ) | ||||||
| qualifier-key-canonical = LOWALPHA *( LOWALPHA / DIGIT / "." / "-" / "_" ) | ||||||
| qualifier-value = 1*PCT-ENCODED | ||||||
|
|
||||||
| subpath = subpath-segment | ||||||
| *( 1*"/" subpath-segment ) | ||||||
| / 0<subpath-sc> ; empty | ||||||
| subpath-canonical = subpath-segment-canonical | ||||||
jkowalleck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| *( "/" subpath-segment-canonical ) | ||||||
| / 0<subpath-sc> ; empty | ||||||
jkowalleck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
jkowalleck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| subpath-segment = 1*( subpath-sc / "." / "%2E" ) | ||||||
| subpath-segment-canonical = [ "." ] subpath-sc *( subpath-sc / "." ) | ||||||
| ; prevent "." and ".." standalone | ||||||
| / "." "." 1*( subpath-sc / "." ) | ||||||
| ; prevent ".." standalone | ||||||
| subpath-sc = PERM-ALPHANUM | ||||||
| / "-" / "_" / "~" ; PERM-PUNCTUATION except "." | ||||||
| / "%" ( PERM-ESCAPED-00-1F | ||||||
| / PERM-ESCAPED-20-2C | ||||||
| ; except general exclusion "-" (2D) | ||||||
| ; except the special char "." (2E) | ||||||
| ; except the separator "/" (2F) | ||||||
| / PERM-ESCAPED-30-FF ) | ||||||
| ; subpath safe characters | ||||||
|
|
||||||
|
|
||||||
| LOWALPHA = %x61-7A ; a-z | ||||||
|
|
||||||
| PCT-ENCODED = PERM-ALPHANUM | ||||||
| / PERM-PUNCTUATION | ||||||
| / ":" ; a specific separator that must not be encoded | ||||||
| / PERM-ESCAPED | ||||||
|
|
||||||
| ; permitted character classes | ||||||
| PERM-ALPHANUM = ALPHA / DIGIT | ||||||
| PERM-PUNCTUATION = "." / "-" / "_" / "~" | ||||||
| PERM-SEPARATOR = ":" / "/" / "@" / "?" / "=" / "&" / "#" | ||||||
| PERM-ESCAPED = "%" ( PERM-ESCAPED-00-1F | ||||||
| / PERM-ESCAPED-20-2C | ||||||
| / PERM-ESCAPED-2D-2F | ||||||
| / PERM-ESCAPED-30-FF ) | ||||||
|
|
||||||
| ; applied purl spec rules for general character encoding | ||||||
| PERM-ESCAPED-00-1F = %x30-31 HEXDIG ; 00-1F | ||||||
| PERM-ESCAPED-20-2C = %x32 ( DIGIT / "A" / "B" / "C" ) ; 20-2C | ||||||
| PERM-ESCAPED-2D-2F = ; except following characters: "-" (2D) | ||||||
| ; except following characters: "." (2E) | ||||||
| / %x32 "F" ; 2F | ||||||
jkowalleck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| PERM-ESCAPED-30-FF = ; except following characters: "0"-"9" (30-39) | ||||||
| ; except following characters: ":" (3A) | ||||||
| %x33 ( "B" / "C" / "D" / "E" / "F" ) ; 3B-3F | ||||||
| / %x34 %x30 ; 40 | ||||||
| ; except following characters: "A"-"Z" (41-5A) | ||||||
| / %x35 ( "B" / "C" / "D" / "E" ) ; 5B-5E | ||||||
| ; except following characters: "_" (5F) | ||||||
| / %x36 %x30 ; 60 | ||||||
| ; except following characters: "a"-"z" (61-7A) | ||||||
| / %x37 ( "B" / "C" / "D" ) ; 7B-7D | ||||||
| ; except following characters: "~" (7E) | ||||||
| / %x37 "F" ; 7F | ||||||
| / %x38-39 HEXDIG ; 80-9F | ||||||
| / ( "A" / "B" / "C" / "D" / "E" / "F" ) HEXDIG ; A0-FF | ||||||
| ``` | ||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.