More demo
This commit is contained in:
parent
5edcca1e7f
commit
3153dc7c62
|
@ -104,6 +104,40 @@ export default [
|
||||||
ENDDOC
|
ENDDOC
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(define T #<<ENDDOC
|
||||||
|
version 2;
|
||||||
|
|
||||||
|
Grammar = {
|
||||||
|
"name": @<regexp "^[a-zA-Z_]\\w*"> string,
|
||||||
|
"rules": { @<regexp "^[a-zA-Z_]\\w*$"> string: Rule, ... },
|
||||||
|
optional "extras": [Rule ...],
|
||||||
|
optional "externals": [Rule ...],
|
||||||
|
optional "inline": [@<regexp "^[a-zA-Z_]\\w*$"> string ...],
|
||||||
|
optional "conflicts": [@<regexp "^[a-zA-Z_]\\w*$"> string ...],
|
||||||
|
optional "word": @<regexp "^[a-zA-Z_]\\w*"> string,
|
||||||
|
optional "supertypes": [string ...],
|
||||||
|
};
|
||||||
|
|
||||||
|
Rule =
|
||||||
|
/ @alias { "type": "ALIAS", "named": bool, "value": string, "content": Rule }
|
||||||
|
/ @blank { "type": "BLANK" }
|
||||||
|
/ @string { "type": "STRING", "value": string }
|
||||||
|
/ @pattern { "type": "PATTERN", "value": string }
|
||||||
|
/ @symbol { "type": "SYMBOL", "name": string }
|
||||||
|
/ @seq { "type": "SEQ", "members": [Rule ...] }
|
||||||
|
/ @choice { "type": "CHOICE", "members": [Rule ...] }
|
||||||
|
/ @repeat1 { "type": "REPEAT1", "content": Rule }
|
||||||
|
/ @repeat { "type": "REPEAT", "content": Rule }
|
||||||
|
/ @token { "type": TokenType, "content": Rule }
|
||||||
|
/ @field { "type": "FIELD", "name": string, "content": Rule }
|
||||||
|
/ @prec { "type": PrecType, "value": int, "content": Rule }
|
||||||
|
;
|
||||||
|
|
||||||
|
TokenType = "TOKEN" / "IMMEDIATE_TOKEN";
|
||||||
|
PrecType = "PREC" / "PREC_LEFT" / "PREC_RIGHT" / "PREC_DYNAMIC";
|
||||||
|
ENDDOC
|
||||||
|
)
|
||||||
|
|
||||||
(parameterize ((pretty-print-columns 80)) (write-pexprs (string->pexprs P #:read-syntax? #t)) (newline))
|
(parameterize ((pretty-print-columns 80)) (write-pexprs (string->pexprs P #:read-syntax? #t)) (newline))
|
||||||
(parameterize ((pretty-print-columns 10)) (write-pexprs (string->pexprs P #:read-syntax? #t)) (newline))
|
(parameterize ((pretty-print-columns 10)) (write-pexprs (string->pexprs P #:read-syntax? #t)) (newline))
|
||||||
|
|
||||||
|
@ -113,3 +147,5 @@ ENDDOC
|
||||||
(parameterize ((pretty-print-columns 40)) (write-pexprs (string->pexprs R #:read-syntax? #t)) (newline))
|
(parameterize ((pretty-print-columns 40)) (write-pexprs (string->pexprs R #:read-syntax? #t)) (newline))
|
||||||
|
|
||||||
(parameterize ((pretty-print-columns 40)) (write-pexprs (string->pexprs S #:read-syntax? #t)) (newline))
|
(parameterize ((pretty-print-columns 40)) (write-pexprs (string->pexprs S #:read-syntax? #t)) (newline))
|
||||||
|
|
||||||
|
(parameterize ((pretty-print-columns 40)) (write-pexprs (string->pexprs T #:read-syntax? #t)) (newline))
|
||||||
|
|
Loading…
Reference in New Issue