-
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser/html): parse doctype declarations
- Loading branch information
Showing
14 changed files
with
304 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
crates/biome_html_parser/tests/html_specs/ok/doctype/basic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html> |
50 changes: 50 additions & 0 deletions
50
crates/biome_html_parser/tests/html_specs/ok/doctype/basic.html.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
source: crates/biome_html_parser/tests/spec_test.rs | ||
expression: snapshot | ||
--- | ||
## Input | ||
|
||
```html | ||
<!DOCTYPE html> | ||
``` | ||
|
||
|
||
## AST | ||
|
||
``` | ||
HtmlRoot { | ||
bom_token: missing (optional), | ||
directive: HtmlDirective { | ||
l_angle_token: L_ANGLE@0..1 "<" [] [], | ||
excl_token: BANG@1..2 "!" [] [], | ||
doctype_token: DOCTYPE_KW@2..10 "DOCTYPE" [] [Whitespace(" ")], | ||
html_token: HTML_KW@10..14 "html" [] [], | ||
quirk_token: missing (optional), | ||
public_id_token: missing (optional), | ||
system_id_token: missing (optional), | ||
r_angle_token: R_ANGLE@14..15 ">" [] [], | ||
}, | ||
html: missing (optional), | ||
eof_token: EOF@15..16 "" [Newline("\n")] [], | ||
} | ||
``` | ||
|
||
## CST | ||
|
||
``` | ||
0: [email protected] | ||
0: (empty) | ||
1: [email protected] | ||
0: [email protected] "<" [] [] | ||
1: [email protected] "!" [] [] | ||
2: [email protected] "DOCTYPE" [] [Whitespace(" ")] | ||
3: [email protected] "html" [] [] | ||
4: (empty) | ||
5: (empty) | ||
6: (empty) | ||
7: [email protected] ">" [] [] | ||
2: (empty) | ||
3: [email protected] "" [Newline("\n")] [] | ||
``` |
1 change: 1 addition & 0 deletions
1
crates/biome_html_parser/tests/html_specs/ok/doctype/long-legacy1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html SYSTEM "about:legacy-compat"> |
50 changes: 50 additions & 0 deletions
50
crates/biome_html_parser/tests/html_specs/ok/doctype/long-legacy1.html.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
source: crates/biome_html_parser/tests/spec_test.rs | ||
expression: snapshot | ||
--- | ||
## Input | ||
|
||
```html | ||
<!DOCTYPE html SYSTEM "about:legacy-compat"> | ||
``` | ||
|
||
|
||
## AST | ||
|
||
``` | ||
HtmlRoot { | ||
bom_token: missing (optional), | ||
directive: HtmlDirective { | ||
l_angle_token: L_ANGLE@0..1 "<" [] [], | ||
excl_token: BANG@1..2 "!" [] [], | ||
doctype_token: DOCTYPE_KW@2..10 "DOCTYPE" [] [Whitespace(" ")], | ||
html_token: HTML_KW@10..15 "html" [] [Whitespace(" ")], | ||
quirk_token: HTML_LITERAL@15..22 "SYSTEM" [] [Whitespace(" ")], | ||
public_id_token: HTML_STRING_LITERAL@22..43 "\"about:legacy-compat\"" [] [], | ||
system_id_token: missing (optional), | ||
r_angle_token: R_ANGLE@43..44 ">" [] [], | ||
}, | ||
html: missing (optional), | ||
eof_token: EOF@44..45 "" [Newline("\n")] [], | ||
} | ||
``` | ||
|
||
## CST | ||
|
||
``` | ||
0: [email protected] | ||
0: (empty) | ||
1: [email protected] | ||
0: [email protected] "<" [] [] | ||
1: [email protected] "!" [] [] | ||
2: [email protected] "DOCTYPE" [] [Whitespace(" ")] | ||
3: [email protected] "html" [] [Whitespace(" ")] | ||
4: [email protected] "SYSTEM" [] [Whitespace(" ")] | ||
5: [email protected] "\"about:legacy-compat\"" [] [] | ||
6: (empty) | ||
7: [email protected] ">" [] [] | ||
2: (empty) | ||
3: [email protected] "" [Newline("\n")] [] | ||
``` |
1 change: 1 addition & 0 deletions
1
crates/biome_html_parser/tests/html_specs/ok/doctype/long-legacy2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
50 changes: 50 additions & 0 deletions
50
crates/biome_html_parser/tests/html_specs/ok/doctype/long-legacy2.html.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
source: crates/biome_html_parser/tests/spec_test.rs | ||
expression: snapshot | ||
--- | ||
## Input | ||
|
||
```html | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> | ||
``` | ||
|
||
|
||
## AST | ||
|
||
``` | ||
HtmlRoot { | ||
bom_token: missing (optional), | ||
directive: HtmlDirective { | ||
l_angle_token: L_ANGLE@0..1 "<" [] [], | ||
excl_token: BANG@1..2 "!" [] [], | ||
doctype_token: DOCTYPE_KW@2..10 "DOCTYPE" [] [Whitespace(" ")], | ||
html_token: HTML_KW@10..15 "html" [] [Whitespace(" ")], | ||
quirk_token: HTML_LITERAL@15..22 "PUBLIC" [] [Whitespace(" ")], | ||
public_id_token: HTML_STRING_LITERAL@22..49 "\"-//W3C//DTD HTML 4.01//EN\"" [] [], | ||
system_id_token: missing (optional), | ||
r_angle_token: R_ANGLE@49..50 ">" [] [], | ||
}, | ||
html: missing (optional), | ||
eof_token: EOF@50..51 "" [Newline("\n")] [], | ||
} | ||
``` | ||
|
||
## CST | ||
|
||
``` | ||
0: [email protected] | ||
0: (empty) | ||
1: [email protected] | ||
0: [email protected] "<" [] [] | ||
1: [email protected] "!" [] [] | ||
2: [email protected] "DOCTYPE" [] [Whitespace(" ")] | ||
3: [email protected] "html" [] [Whitespace(" ")] | ||
4: [email protected] "PUBLIC" [] [Whitespace(" ")] | ||
5: [email protected] "\"-//W3C//DTD HTML 4.01//EN\"" [] [] | ||
6: (empty) | ||
7: [email protected] ">" [] [] | ||
2: (empty) | ||
3: [email protected] "" [Newline("\n")] [] | ||
``` |
2 changes: 2 additions & 0 deletions
2
crates/biome_html_parser/tests/html_specs/ok/doctype/long-legacy3.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" | ||
"http://www.w3.org/TR/html4/frameset.dtd"> |
51 changes: 51 additions & 0 deletions
51
crates/biome_html_parser/tests/html_specs/ok/doctype/long-legacy3.html.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
source: crates/biome_html_parser/tests/spec_test.rs | ||
expression: snapshot | ||
--- | ||
## Input | ||
|
||
```html | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" | ||
"http://www.w3.org/TR/html4/frameset.dtd"> | ||
``` | ||
|
||
|
||
## AST | ||
|
||
``` | ||
HtmlRoot { | ||
bom_token: missing (optional), | ||
directive: HtmlDirective { | ||
l_angle_token: L_ANGLE@0..1 "<" [] [], | ||
excl_token: BANG@1..2 "!" [] [], | ||
doctype_token: DOCTYPE_KW@2..10 "DOCTYPE" [] [Whitespace(" ")], | ||
html_token: HTML_KW@10..15 "HTML" [] [Whitespace(" ")], | ||
quirk_token: HTML_LITERAL@15..22 "PUBLIC" [] [Whitespace(" ")], | ||
public_id_token: HTML_STRING_LITERAL@22..58 "\"-//W3C//DTD HTML 4.01 Frameset//EN\"" [] [], | ||
system_id_token: HTML_STRING_LITERAL@58..102 "\"http://www.w3.org/TR/html4/frameset.dtd\"" [Newline("\n"), Whitespace(" ")] [], | ||
r_angle_token: R_ANGLE@102..103 ">" [] [], | ||
}, | ||
html: missing (optional), | ||
eof_token: EOF@103..104 "" [Newline("\n")] [], | ||
} | ||
``` | ||
|
||
## CST | ||
|
||
``` | ||
0: [email protected] | ||
0: (empty) | ||
1: [email protected] | ||
0: [email protected] "<" [] [] | ||
1: [email protected] "!" [] [] | ||
2: [email protected] "DOCTYPE" [] [Whitespace(" ")] | ||
3: [email protected] "HTML" [] [Whitespace(" ")] | ||
4: [email protected] "PUBLIC" [] [Whitespace(" ")] | ||
5: [email protected] "\"-//W3C//DTD HTML 4.01 Frameset//EN\"" [] [] | ||
6: [email protected] "\"http://www.w3.org/TR/html4/frameset.dtd\"" [Newline("\n"), Whitespace(" ")] [] | ||
7: [email protected] ">" [] [] | ||
2: (empty) | ||
3: [email protected] "" [Newline("\n")] [] | ||
``` |
1 change: 1 addition & 0 deletions
1
crates/biome_html_parser/tests/html_specs/ok/doctype/minimal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE> |
Oops, something went wrong.