Ver Fonte

New: PEG (grammar)

Leonardo Di Donato há 8 anos atrás
pai
commit
8830c537d2
1 ficheiros alterados com 42 adições e 0 exclusões
  1. 42 0
      urn.peg

+ 42 - 0
urn.peg

@@ -0,0 +1,42 @@
+package main
+
+type URN Peg {
+
+}
+
+URN <- URN_PREFIX NID colon NSS eot
+
+URN_PREFIX <- "urn" colon
+
+NID <- LET_NUM LET_NUM_HYP?
+
+NSS <- CHARS+
+
+LET_NUM <- upper+ / lower+ / number+
+
+LET_NUM_HYP <- LET_NUM / hyp
+
+CHARS <- TRANS / perc HEX HEX
+
+TRANS <- LET_NUM / OTHER / RESERVED 
+
+HEX <- number+ / [A-F]+ / [a-f]+
+
+OTHER <- '(' / ')' / '+' / ',' / hyp / '.' / colon / '=' / '@' / ';' / '$' / '_' / '!' / '*' / '\''
+
+RESERVED <- perc / '/' / '?' / '#'
+
+colon <- ':'
+
+eot <- !.
+
+upper <- [A-Z]
+
+lower <- [a-z]
+
+number <- [0-9]
+
+hyp <- '-'
+
+perc <- '%'
+