Allow more quoting

pull/70/head
Stephan Seitz 2021-04-16 10:07:11 +07:00
parent e61888e097
commit 2219fcb63d
5 changed files with 63140 additions and 53235 deletions

@ -64,7 +64,7 @@ module.exports = grammar(clojure, {
syn_quoting_lit: $ => syn_quoting_lit: $ =>
seq(field('marker', "`"), seq(field('marker', "`"),
repeat($._gap), repeat($._gap),
field('value', $.list_lit)), field('value', ($._form))),
defun: $ => defun: $ =>
seq(field('open', "("), seq(field('open', "("),
@ -77,7 +77,7 @@ module.exports = grammar(clojure, {
'across', 'across',
'being', 'being',
'using', 'using',
/being the (hash-key[s]?|hash-value[s]?) in/, /being the (hash-key[s]?|hash-value[s]?|present-symbol[s]?) (in|of)/,
'below', 'below',
'above', 'above',
'from', 'from',
@ -137,7 +137,7 @@ module.exports = grammar(clojure, {
field('function_name', $._form), field('function_name', $._form),
optional(field('specifier', seq(repeat($._gap), choice($.kwd_lit, $.sym_lit)))), optional(field('specifier', seq(repeat($._gap), choice($.kwd_lit, $.sym_lit)))),
repeat($._gap), repeat($._gap),
field('lambda_list', $.list_lit)), field('lambda_list', choice($.list_lit, $.unquoting_lit))),
seq(field('keyword', alias('lambda', $.defun_keyword)), seq(field('keyword', alias('lambda', $.defun_keyword)),
repeat($._gap), repeat($._gap),
field('lambda_list', $.list_lit)) field('lambda_list', $.list_lit))

@ -1582,7 +1582,7 @@
"name": "value", "name": "value",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "list_lit" "name": "_form"
} }
} }
] ]
@ -1783,7 +1783,7 @@
}, },
{ {
"type": "PATTERN", "type": "PATTERN",
"value": "being the (hash-key[s]?|hash-value[s]?) in" "value": "being the (hash-key[s]?|hash-value[s]?|present-symbol[s]?) (in|of)"
}, },
{ {
"type": "STRING", "type": "STRING",
@ -2412,8 +2412,17 @@
"type": "FIELD", "type": "FIELD",
"name": "lambda_list", "name": "lambda_list",
"content": { "content": {
"type": "SYMBOL", "type": "CHOICE",
"name": "list_lit" "members": [
{
"type": "SYMBOL",
"name": "list_lit"
},
{
"type": "SYMBOL",
"name": "unquoting_lit"
}
]
} }
} }
] ]

@ -601,6 +601,10 @@
{ {
"type": "list_lit", "type": "list_lit",
"named": true "named": true
},
{
"type": "unquoting_lit",
"named": true
} }
] ]
}, },
@ -3187,12 +3191,108 @@
] ]
}, },
"value": { "value": {
"multiple": false, "multiple": true,
"required": true, "required": true,
"types": [ "types": [
{
"type": "#",
"named": false
},
{
"type": ".",
"named": false
},
{
"type": "char_lit",
"named": true
},
{
"type": "complex_num_lit",
"named": true
},
{
"type": "derefing_lit",
"named": true
},
{
"type": "evaling_lit",
"named": true
},
{
"type": "fancy_literal",
"named": true
},
{
"type": "include_reader_macro",
"named": true
},
{
"type": "kwd_lit",
"named": true
},
{ {
"type": "list_lit", "type": "list_lit",
"named": true "named": true
},
{
"type": "nil_lit",
"named": true
},
{
"type": "num_lit",
"named": true
},
{
"type": "package_lit",
"named": true
},
{
"type": "quoting_lit",
"named": true
},
{
"type": "read_cond_lit",
"named": true
},
{
"type": "set_lit",
"named": true
},
{
"type": "splicing_read_cond_lit",
"named": true
},
{
"type": "str_lit",
"named": true
},
{
"type": "sym_lit",
"named": true
},
{
"type": "sym_val_lit",
"named": true
},
{
"type": "syn_quoting_lit",
"named": true
},
{
"type": "unquote_splicing_lit",
"named": true
},
{
"type": "unquoting_lit",
"named": true
},
{
"type": "var_quoting_lit",
"named": true
},
{
"type": "vec_lit",
"named": true
} }
] ]
} }

File diff suppressed because it is too large Load Diff

@ -745,3 +745,39 @@ Multiple gaps in Loop
(kwd_lit (kwd_lit
(sym_lit)) (sym_lit))
(sym_lit))))))))))))) (sym_lit)))))))))))))
================================================================================
Unquoting in defun
================================================================================
(defun ,foo ,arguments
)
--------------------------------------------------------------------------------
(source
(list_lit
(defun
(defun_header
(defun_keyword)
(unquoting_lit
(sym_lit))
(unquoting_lit
(sym_lit))))))
================================================================================
Weird quoting
================================================================================
(deftype worker-pool-workers ()
`simple-vector)
--------------------------------------------------------------------------------
(source
(list_lit
(sym_lit)
(sym_lit)
(list_lit)
(syn_quoting_lit
(sym_lit))))