Implement new eBNF for codeblock attributes

This commit is contained in:
Guillaume Gomez 2023-05-02 22:01:28 +02:00
parent 4ce17fa30e
commit 7681f63cab
8 changed files with 376 additions and 199 deletions

View file

@ -6,14 +6,80 @@
#![feature(no_core)]
#![no_core]
/// ```{. class= whatever=hehe #id} } {{
/// ```{. }
/// main;
/// ```
//~^^^ ERROR missing class name after `.`
//~| ERROR missing class name after `class=`
//~| ERROR unsupported attribute `whatever=hehe`
//~| ERROR unsupported attribute `#id`
//~| ERROR unexpected `}` outside attribute block (`{}`)
//~| ERROR unclosed attribute block (`{}`): missing `}` at the end
//~| ERROR unexpected `{` inside attribute block (`{}`)
//~^^^ ERROR unexpected ` ` character after `.`
pub fn foo() {}
/// ```{class= a}
/// main;
/// ```
//~^^^ ERROR unexpected ` ` character after `=`
pub fn foo2() {}
/// ```{#id}
/// main;
/// ```
//~^^^ ERROR unexpected character `#`
pub fn foo3() {}
/// ```{{
/// main;
/// ```
//~^^^ ERROR unexpected character `{`
pub fn foo4() {}
/// ```}
/// main;
/// ```
//~^^^ ERROR unexpected character `}`
pub fn foo5() {}
/// ```)
/// main;
/// ```
//~^^^ ERROR unexpected character `)`
pub fn foo6() {}
/// ```{class=}
/// main;
/// ```
//~^^^ ERROR unexpected `}` character after `=`
pub fn foo7() {}
/// ```(
/// main;
/// ```
//~^^^ ERROR unclosed comment: missing `)` at the end
pub fn foo8() {}
/// ```{class=one=two}
/// main;
/// ```
//~^^^ ERROR unexpected `=`
pub fn foo9() {}
/// ```{.one.two}
/// main;
/// ```
//~^^^ ERROR unexpected `.` character
pub fn foo10() {}
/// ```{class=.one}
/// main;
/// ```
//~^^^ ERROR unexpected `.` character after `=`
pub fn foo11() {}
/// ```{class=one.two}
/// main;
/// ```
//~^^^ ERROR unexpected `.` character
pub fn foo12() {}
/// ```{(comment)}
/// main;
/// ```
//~^^^ ERROR unexpected character `(`
pub fn foo13() {}