diff options
| author | Jonas Smedegaard <dr@jones.dk> | 2025-05-26 13:02:00 +0200 |
|---|---|---|
| committer | Jonas Smedegaard <dr@jones.dk> | 2025-05-26 13:02:00 +0200 |
| commit | a3eb7e16a727849c58cbabe3b1b9ef64b6f740f6 (patch) | |
| tree | b173b77fcbd7355d409df8a9cfc1362518569c75 /syntax/def.peg | |
| parent | cc6f0bb498635e85fa7938d34051af1e6ec0df37 (diff) | |
restructure PEG for simpler adding SemWord
Diffstat (limited to 'syntax/def.peg')
| -rw-r--r-- | syntax/def.peg | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/syntax/def.peg b/syntax/def.peg index 7696a0d..0c99c80 100644 --- a/syntax/def.peg +++ b/syntax/def.peg @@ -28,12 +28,18 @@ StyledWords <- '**' Words '**' LinkedWords <- '[' Words ']' '(' ((Uri _)? LinkTitle / Uri) ')' / '[' Words ']' LinkLabel / LinkLabel -AnnotatedWords <- '[' Words ']' '{' ![{}] PlainWords '}' +AnnotatedWords <- '[' Words ']' '{' KeyWords '}' LinkLabel <- '[' _? ![\[\]] PlainWords _? ']' LinkTitle <- '"' _? !'"' _? PlainWords _? '"' / "'" _? !"'" PlainWords _? "'" / "(" _? ![()] PlainWords _? ")" +KeyWords <- KeyWord (_ KeyWord)* PlainWords <- PRINTABLES (_ PRINTABLES)* +KeyWord <- Identifier / Class / Attribute / '-' +Identifier <- '#' [[:alpha:]] [[:alnum:]]* +Class <- '.' [[:alpha:]] [[:alnum:]]* +Attribute <- [[:alpha:]] [[:alnum:]]* SPACE* = SPACE* + ('"' [[:alnum:]]+ '"' / [[:alnum:]]+) Uri <- '<' ![<>] PRINTABLES? '>' / ![<>] PRINTABLES HardBreak <- SPACE SPACE+ NEWLINE @@ -55,9 +61,7 @@ BlockX <- LinkDefinition / List / Paragraph PrefixDefinition <- '{' CuriePrefix '}' ':' _? SemWord NEWLINE -AnnotatedWordsX <- '[' Words ']' - ('{' (SemWords / ![{}] PlainWords) '}') -SemWords <- SemWord (_ SemWord)* +KeyWordX <- SemWord / Identifier / Class / Attribute / '-' SemWord <- SEMPREFIX '<' ![<>] PRINTABLES '>' / SEMPREFIX Curie SEMPREFIX <- [.=] |
