-
Notifications
You must be signed in to change notification settings - Fork 123
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
Keyname overhaul #3102
Comments
Escaped Key Name StructureThe structure of escaped key names is defined by the following ANTLRv4 grammar. grammar EscapedKeyName;
keyName
: namespacedName
| cascadingName
;
namespacedName
: Namespace ':' keyPath
;
cascadingName
: keyPath
;
keyPath
: ('/' keyPart)+
| '/'
;
keyPart
: inactivePart
| activePart
;
inactivePart
: '.' canonicalPart
| '.' UnprefixedArrayIndex
;
activePart
: canonicalPart
| nonCanonicalPart
;
canonicalPart
: namePart
| ArrayPart
| emptyPart
;
nonCanonicalPart
: '.'
| '..'
|
| UnprefixedArrayIndex
;
Namespace
: 'spec'
| 'dir'
| 'user'
| 'system'
| 'meta'
| 'default'
| 'proc'
;
namePart
: partStartChar partChar*
| DotSequence
;
partStartChar
: EscapedStartChar
| EscapedSpecialChar
| NormalChar
| ':'
;
partChar
: EscapedSpecialChar
| StartChar
| NormalChar
| ':'
| '%'
;
emptyPart : '%' ;
ArrayPart : '#' PrefixedNumber ;
UnprefixedArrayIndex : '#' Number ;
DotSequence : '..' '.'+ ;
fragment Number : NonZeroDigit Digit* ;
fragment NonZeroDigit : [1-9] ;
fragment Digit : [0-9] ;
fragment PrefixedNumber
: Digit
| PrefixedNonZeroNumber
;
fragment PrefixedNonZeroNumber
: NonZeroDigit
| '_' PrefixedNonZeroNumber Digit
;
StartChar : [.%#@] ;
EscapedStartChar : '\\'StartChar ;
EscapedSpecialChar : '\\'[/\\] ;
NormalChar : ~[./\\%#@\n] ;
ErrChar: . ; The grammar could be simplified, but doing it this way, allows us to define some terms:
Informally this means:
|
Unescaped Key Name StructureThe structure of unescaped key names is much simpler. Here is again a ANTLRv4 grammar: grammar UnescapedKeyName;
unescapedKeyName
: NamespaceByte ('\u0000' unescapedPart?)* '\u0000'
;
unescapedPart : UChar+;
// 1 = cascading, 2 = meta, 3 = spec, ..., 7 = system
// equal to KEY_NS_* (modified)
NamespaceByte : [\u0001-\u0007] ;
UChar : ~[\u0000] ;
ErrChar: . ; Informally this just means:
|
IMPORTANT: This an informal description, NOT an actual implementation guideline. Steps maybe combined, omitted if checked elsewhere etc. Canonicalization of Key NamesThe first step in Canonicalization doesn't touch a possibly present namespace. The rules below apply only to the
|
IMPORTANT: This an informal description, NOT an actual implementation guideline. Steps maybe combined, omitted if checked elsewhere etc. Unescaping of Key NamesThe second step in This is done via the following rules:
|
Thank you so much for formalizing this. Please add this as docu in the PR. |
I mark this issue stale as it did not have any activity for one year. I'll close it in two weeks if no further activity occurs. If you want it to be alive again, ping the issue by writing a message here or create a new issue with the remainder of this issue. |
As it is already getting stale, slowly it is really time to get #3447 merged 😉 |
There are a few issues already concerning key names:
meta
namespacedefault
namespaceIn addition
elektraKeySetName
is known to be a bottleneck and should therefore be optimized.The goal of this issue is to define the structure of key names, so that we can reimplement
elektraKeySetName
.The text was updated successfully, but these errors were encountered: