summaryrefslogtreecommitdiff
path: root/docs/c1/grammar
diff options
context:
space:
mode:
Diffstat (limited to 'docs/c1/grammar')
-rw-r--r--docs/c1/grammar/abnf.txt12
-rw-r--r--docs/c1/grammar/index.md6
-rw-r--r--docs/c1/grammar/zbnf.txt11
3 files changed, 19 insertions, 10 deletions
diff --git a/docs/c1/grammar/abnf.txt b/docs/c1/grammar/abnf.txt
index 6daaceb..7424f41 100644
--- a/docs/c1/grammar/abnf.txt
+++ b/docs/c1/grammar/abnf.txt
@@ -19,7 +19,7 @@ Blank = HTAB / LF / %x0b / %x0c / CR / SP / Comment
Trail = SkipLine / SkipUnit / ";" "~" *Blank
-Datum = BareString / DottedStr / CladDatum / Rune / RuneStr
+Datum = BareString / SpecialStr / CladDatum / Rune / RuneStr
/ RuneDotStr / RuneClad / LabelRef / LabelDef / HashStr
/ HashDotStr / HashClad / QuoteExpr / JoinExpr
@@ -36,7 +36,7 @@ AnyButLF = %x00-09 / %x0b-ff
BareString = BareChar *( BareChar / Numeric )
-DottedStr = ( "." / Numeric ) *( "." / Numeric / BareChar )
+SpecialStr = SpecStrChar *( SpecStrChar / BareChar )
CladDatum = "|" *( PipeStrChar / "\" StringEsc ) "|"
/ DQUOTE *( QuotStrChar / "\" StringEsc ) DQUOTE
@@ -48,7 +48,7 @@ Rune = "#" RuneName
RuneStr = "#" RuneName "\" BareString
-RuneDotStr = "#" RuneName "\" DottedStr
+RuneDotStr = "#" RuneName "\" SpecialStr
RuneClad = "#" RuneName CladDatum
@@ -58,7 +58,7 @@ LabelDef = "#" "%" Label "=" Datum
HashStr = "#" "\" BareString
-HashDotStr = "#" "\" DottedStr
+HashDotStr = "#" "\" SpecialStr
HashClad = "#" CladDatum
@@ -73,10 +73,12 @@ JoinExpr = Datum RJoinDatum
BareChar = "!" / "$" / "%" / "*" / "/" / "<" / "=" / ">"
- / "?" / "@" / "^" / "_" / "~" / ALPHA
+ / "?" / "^" / "_" / "~" / ALPHA
Numeric = "+" / "-" / DIGIT
+SpecStrChar = "." / ":" / Numeric
+
PipeStrChar = %x00-5b / %x5d-7b / %x7d-ff ; any but "|" or "\"
QuotStrChar = %x00-21 / %x23-5b / %x5d-ff ; any but DQUOTE or "\"
diff --git a/docs/c1/grammar/index.md b/docs/c1/grammar/index.md
index d70021a..8fefe0e 100644
--- a/docs/c1/grammar/index.md
+++ b/docs/c1/grammar/index.md
@@ -74,6 +74,12 @@ The following limits are not represented in the grammar:
want to use the ABNF to generate a parser anyway.)
+## At-quoted strings
+
+The mechanism of at-quoted strings is not represented in any of the
+grammars, since it essentially has 256 variants.
+
+
## Stream-parsing strategy
The parser consumes one `Unit` from the input stream every time it's
diff --git a/docs/c1/grammar/zbnf.txt b/docs/c1/grammar/zbnf.txt
index 551c319..002e027 100644
--- a/docs/c1/grammar/zbnf.txt
+++ b/docs/c1/grammar/zbnf.txt
@@ -22,7 +22,7 @@ SkipLine : ( ~LF )* [LF]
OneDatum : BareString | CladDatum
-BareString : ( '.' | '+' | '-' | DIGIT ) ( BareChar | '.' )*
+BareString : SpecBareChar ( BareChar | JoinChar )*
| BareChar+
CladDatum : PipeStr | QuoteStr | HashExpr | QuoteExpr | List
@@ -33,16 +33,17 @@ HashExpr : '#' ( RuneExpr | LabelExpr | HashDatum )
QuoteExpr : "'" Datum | '`' Datum | ',' Datum
List : ParenList | SquareList | BraceList
+SpecBareChar : '+' | '-' | JoinChar | DIGIT
+
BareChar : ALPHA | DIGIT
- | '!' | '$' | '%' | '*' | '+'
- | '-' | '/' | '<' | '=' | '>'
- | '?' | '@' | '^' | '_' | '~'
+ | '!' | '$' | '%' | '*' | '+' | '-' | '/'
+ | '<' | '=' | '>' | '?' | '^' | '_' | '~'
PipeStrChar : ~( '|' | '\' )
QuotStrChar : ~( '"' | '\' )
StringEsc : '\' | '|' | '"' | ( HTAB | SP )* LF ( HTAB | SP )*
- | 'a' | 'b' | 't' | 'n' | 'v' | 'f' | 'r' | 'e'
+ | '0' | 'a' | 'b' | 't' | 'n' | 'v' | 'f' | 'r' | 'e'
| 'x' HexByte+ ';'
| 'u' UnicodeSV ';'