Skip to content

Commit

Permalink
feat: relax interface names
Browse files Browse the repository at this point in the history
Allow uppercase letters in interface names.

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
  • Loading branch information
haraldh committed Dec 6, 2021
1 parent bcd0c3c commit b95c624
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions varlink_parser/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ fn test_domainnames() {
assert!(IDL::try_from("interface com.-example.leadinghyphen\nmethod F()->()").is_err());
assert!(IDL::try_from("interface xn--lgbbat1ad8j.example.algeria\nmethod F()->()").is_ok());
assert!(IDL::try_from("interface com.example-.danglinghyphen-\nmethod F()->()").is_err());
assert!(IDL::try_from("interface Com.example.uppercase-toplevel\nmethod F()->()").is_err());
assert!(IDL::try_from("interface Co9.example.number-toplevel\nmethod F()->()").is_err());
assert!(IDL::try_from("interface 1om.example.number-toplevel\nmethod F()->()").is_err());
assert!(IDL::try_from("interface com.Example\nmethod F()->()").is_err());
assert!(IDL::try_from("interface com.Example\nmethod F()->()").is_ok());
assert!(IDL::try_from("interface Com.example.uppercase-toplevel\nmethod F()->()").is_ok());
assert!(IDL::try_from("interface a.b\nmethod F()->()").is_ok());
assert!(IDL::try_from("interface a.b.c\nmethod F()->()").is_ok());
assert!(IDL::try_from("interface co9.example.number-toplevel\nmethod F()->()").is_ok());
assert!(IDL::try_from("interface a1.b1.c1\nmethod F()->()").is_ok());
assert!(IDL::try_from("interface a1.b--1.c--1\nmethod F()->()").is_ok());
assert!(IDL::try_from("interface a--1.b--1.c--1\nmethod F()->()").is_ok());
Expand Down
4 changes: 2 additions & 2 deletions varlink_parser/src/varlink_grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ peg::parser! {
= $( ['A'..='Z']['a'..='z' | 'A'..='Z' | '0'..='9']* )

rule interface_name() -> &'input str /* no hyphen at begin and end */
= quiet! { $( ['a'..='z'] ( ['-']*['a'..='z' | '0'..='9'] )* ( ['.']['a'..='z' | '0'..='9'] (['-']*['a'..='z' | '0'..='9'])* )+ ) }
/ expected!("<reverse domain name>")
= quiet! { $( ['A'..='Z' | 'a'..='z'] ( ['a'..='z' | '0'..='9' | '-' ] )* ( ['.']['A'..='Z' | 'a'..='z' | '0'..='9'] (['-']*['A'..='Z' | 'a'..='z' | '0'..='9'])* )+ ) }
/ expected!("<reverse domain name>")

rule array() -> ()
= "[]"
Expand Down

0 comments on commit b95c624

Please sign in to comment.