syntax_rfc3987.lark 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. iri: scheme ":" ihier_part ("?" iquery)? ("#" ifragment)?
  2. iri_reference: iri | irelative_ref
  3. absolute_iri: scheme ":" ihier_part ("?" iquery)?
  4. scheme: alpha (alpha | digit | "+" | "-" | ".")*
  5. ihier_part: "//" iauthority ipath_abempty
  6. | ipath_absolute
  7. | ipath_rootless
  8. | ipath_empty
  9. irelative_ref: irelative_part ("?" iquery)? ("#" ifragment)?
  10. irelative_part: "//" iauthority ipath_abempty
  11. | ipath_absolute
  12. | ipath_noscheme
  13. | ipath_empty
  14. iauthority: (iuserinfo "@")? ihost (":" port)?
  15. iuserinfo: (iunreserved | pct_encoded | sub_delims | ":")*
  16. ihost: ip_literal | ipv4address | ireg_name
  17. ireg_name: (iunreserved | pct_encoded | sub_delims)*
  18. ipath: ipath_abempty
  19. | ipath_absolute
  20. | ipath_noscheme
  21. | ipath_rootless
  22. | ipath_empty
  23. ipath_abempty: ("/" isegment)*
  24. ipath_absolute: "/" (isegment_nz ("/" isegment)*)?
  25. ipath_noscheme: isegment_nz_nc ("/" isegment)*
  26. ipath_rootless: isegment_nz ("/" isegment)*
  27. ipath_empty: -> empty
  28. isegment: ipchar*
  29. isegment_nz: ipchar+
  30. isegment_nz_nc: (iunreserved | pct_encoded | sub_delims | "@")+
  31. ipchar: iunreserved | pct_encoded | sub_delims | ":" | "@"
  32. iquery: (ipchar | iprivate | "/" | "?")*
  33. ifragment: (ipchar | "/" | "?")*
  34. iunreserved: alpha | digit | "-" | "." | "_" | "~" | ucschar
  35. ucschar: /[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]/
  36. iprivate: /[\uE000-\uF8FF]/
  37. sub_delims: "!" | "$" | "&" | "'" | "(" | ")"
  38. | "*" | "+" | "," | ";" | "="
  39. ip_literal: "[" (ipv6address | ipvfuture) "]"
  40. ipvfuture: "v" hexdig+ "." (unreserved | sub_delims | ":")+
  41. ipv6address: h16 ":" h16 ":" h16 ":" h16 ":" h16 ":" h16 ":" ls32
  42. | "::" h16 ":" h16 ":" h16 ":" h16 ":" h16 ":" ls32
  43. | h16 "::" h16 ":" h16 ":" h16 ":" h16 ":" ls32
  44. | h16 ":" h16 "::" h16 ":" h16 ":" h16 ":" ls32
  45. | h16 ":" h16 ":" h16 "::" h16 ":" h16 ":" ls32
  46. | h16 ":" h16 ":" h16 ":" h16 "::" h16 ":" ls32
  47. | h16 ":" h16 ":" h16 ":" h16 ":" h16 "::" ls32
  48. | h16 ":" h16 ":" h16 ":" h16 ":" h16 ":" h16 "::" h16
  49. | h16 ":" h16 ":" h16 ":" h16 ":" h16 ":" h16 ":" h16 "::"
  50. h16: hexdig
  51. | hexdig hexdig
  52. | hexdig hexdig hexdig
  53. | hexdig hexdig hexdig hexdig
  54. ls32: h16 ":" h16 | ipv4address
  55. ipv4address: dec_octet "." dec_octet "." dec_octet "." dec_octet
  56. dec_octet: digit
  57. | non_zero digit
  58. | "1" digit digit
  59. | "2" ("0".."4") digit
  60. | "25" ("0".."5")
  61. digit: T_DIGIT
  62. T_DIGIT: /[0-9]/
  63. non_zero: T_NON_ZERO
  64. T_NON_ZERO: /[1-9]/
  65. unreserved: alpha | digit | "-" | "." | "_" | "~"
  66. alpha: T_ALPHA
  67. T_ALPHA: /[A-Za-z]/
  68. hexdig: T_HEXDIG
  69. T_HEXDIG: /[0-9A-Fa-f]/
  70. port: digit*
  71. pct_encoded: "%" hexdig hexdig