Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xml/parser): Parse cdata section (#6531)
- Loading branch information
1 parent
180f674
commit 7f8c4e0
Showing
27 changed files
with
1,969 additions
and
421 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,5 +60,9 @@ pub enum Token { | |
target: JsWord, | ||
data: JsWord, | ||
}, | ||
Cdata { | ||
data: JsWord, | ||
raw: JsWord, | ||
}, | ||
Eof, | ||
} |
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
25 changes: 25 additions & 0 deletions
25
crates/swc_xml_codegen/tests/fixture/cdata_section/input.xml
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,25 @@ | ||
<root> | ||
<description>An example of escaped CENDs</description> | ||
<!-- This text contains a CEND ]]> --> | ||
<!-- In this first case we put the ]] at the end of the first CDATA block | ||
and the > in the second CDATA block --> | ||
<exampleOfACDATA> | ||
<![CDATA[ | ||
Since this is a CDATA section | ||
I can use all sorts of reserved characters | ||
but my document is still well formed! | ||
]]> | ||
</exampleOfACDATA> | ||
<p><![CDATA[<greeting>Hello, world!</greeting>]]></p> | ||
<p><![CDATA[content]]></p> | ||
<p><![CDATA[&ing]]></p> | ||
<p><![CDATA[&ing ]]]></p> | ||
<p><![CDATA[&ing]] ]]></p> | ||
<p><![CDATA[<message>text</message>]]></p> | ||
<p><![CDATA[</this is malformed!</malformed</malformed & worse>]]></p> | ||
<p><![CDATA[1]]><![CDATA[2]]></p> | ||
<p> | ||
<![CDATA[data]]> </p> | ||
<p><![CDATA[bracket ]after]]></p> | ||
<p><![CDATA[]]></p> | ||
</root> |
25 changes: 25 additions & 0 deletions
25
crates/swc_xml_codegen/tests/fixture/cdata_section/output.min.xml
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,25 @@ | ||
<root> | ||
<description>An example of escaped CENDs</description> | ||
<!-- This text contains a CEND ]]> --> | ||
<!-- In this first case we put the ]] at the end of the first CDATA block | ||
and the > in the second CDATA block --> | ||
<exampleOfACDATA> | ||
<![CDATA[ | ||
Since this is a CDATA section | ||
I can use all sorts of reserved characters | ||
but my document is still well formed! | ||
]]> | ||
</exampleOfACDATA> | ||
<p><![CDATA[<greeting>Hello, world!</greeting>]]></p> | ||
<p><![CDATA[content]]></p> | ||
<p><![CDATA[&ing]]></p> | ||
<p><![CDATA[&ing ]]]></p> | ||
<p><![CDATA[&ing]] ]]></p> | ||
<p><![CDATA[<message>text</message>]]></p> | ||
<p><![CDATA[</this is malformed!</malformed</malformed & worse>]]></p> | ||
<p><![CDATA[1]]><![CDATA[2]]></p> | ||
<p> | ||
<![CDATA[data]]> </p> | ||
<p><![CDATA[bracket ]after]]></p> | ||
<p><![CDATA[]]></p> | ||
</root> |
25 changes: 25 additions & 0 deletions
25
crates/swc_xml_codegen/tests/fixture/cdata_section/output.xml
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,25 @@ | ||
<root> | ||
<description>An example of escaped CENDs</description> | ||
<!-- This text contains a CEND ]]> --> | ||
<!-- In this first case we put the ]] at the end of the first CDATA block | ||
and the > in the second CDATA block --> | ||
<exampleOfACDATA> | ||
<![CDATA[ | ||
Since this is a CDATA section | ||
I can use all sorts of reserved characters | ||
but my document is still well formed! | ||
]]> | ||
</exampleOfACDATA> | ||
<p><![CDATA[<greeting>Hello, world!</greeting>]]></p> | ||
<p><![CDATA[content]]></p> | ||
<p><![CDATA[&ing]]></p> | ||
<p><![CDATA[&ing ]]]></p> | ||
<p><![CDATA[&ing]] ]]></p> | ||
<p><![CDATA[<message>text</message>]]></p> | ||
<p><![CDATA[</this is malformed!</malformed</malformed & worse>]]></p> | ||
<p><![CDATA[1]]><![CDATA[2]]></p> | ||
<p> | ||
<![CDATA[data]]> </p> | ||
<p><![CDATA[bracket ]after]]></p> | ||
<p><![CDATA[]]></p> | ||
</root> |
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
Oops, something went wrong.
7f8c4e0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/bugs-1
341810
ns/iter (± 28980
)365328
ns/iter (± 33945
)0.94
es/full/minify/libraries/antd
2018981038
ns/iter (± 20723901
)2107189944
ns/iter (± 128191799
)0.96
es/full/minify/libraries/d3
442203065
ns/iter (± 16064490
)470107055
ns/iter (± 35088197
)0.94
es/full/minify/libraries/echarts
1703355564
ns/iter (± 26324547
)1774468471
ns/iter (± 79040254
)0.96
es/full/minify/libraries/jquery
110845356
ns/iter (± 5169149
)124719297
ns/iter (± 5571075
)0.89
es/full/minify/libraries/lodash
132277049
ns/iter (± 2967923
)145008154
ns/iter (± 15196825
)0.91
es/full/minify/libraries/moment
66907887
ns/iter (± 3036705
)70419868
ns/iter (± 6250800
)0.95
es/full/minify/libraries/react
22176430
ns/iter (± 305040
)26011022
ns/iter (± 8917317
)0.85
es/full/minify/libraries/terser
357419993
ns/iter (± 9563367
)374857588
ns/iter (± 20216458
)0.95
es/full/minify/libraries/three
643875030
ns/iter (± 17605416
)674491467
ns/iter (± 60117562
)0.95
es/full/minify/libraries/typescript
3728175153
ns/iter (± 42866771
)3929072169
ns/iter (± 103581545
)0.95
es/full/minify/libraries/victory
915345212
ns/iter (± 17857521
)947208804
ns/iter (± 53613068
)0.97
es/full/minify/libraries/vue
179418799
ns/iter (± 4200803
)186362935
ns/iter (± 10012014
)0.96
es/full/codegen/es3
33808
ns/iter (± 896
)33974
ns/iter (± 632
)1.00
es/full/codegen/es5
33883
ns/iter (± 2293
)33877
ns/iter (± 1046
)1.00
es/full/codegen/es2015
33844
ns/iter (± 432
)33961
ns/iter (± 1526
)1.00
es/full/codegen/es2016
33812
ns/iter (± 633
)33852
ns/iter (± 690
)1.00
es/full/codegen/es2017
33762
ns/iter (± 1203
)33934
ns/iter (± 2102
)0.99
es/full/codegen/es2018
33827
ns/iter (± 873
)33910
ns/iter (± 828
)1.00
es/full/codegen/es2019
33822
ns/iter (± 950
)33792
ns/iter (± 827
)1.00
es/full/codegen/es2020
33836
ns/iter (± 1828
)34074
ns/iter (± 2069
)0.99
es/full/all/es3
191349752
ns/iter (± 6917198
)216390998
ns/iter (± 25768620
)0.88
es/full/all/es5
176588373
ns/iter (± 11646973
)205628084
ns/iter (± 17480324
)0.86
es/full/all/es2015
142249333
ns/iter (± 10842831
)166888123
ns/iter (± 10837340
)0.85
es/full/all/es2016
142040995
ns/iter (± 4096314
)152641547
ns/iter (± 15029279
)0.93
es/full/all/es2017
144454669
ns/iter (± 14462038
)165712110
ns/iter (± 21696277
)0.87
es/full/all/es2018
149065172
ns/iter (± 12788899
)153998771
ns/iter (± 11429859
)0.97
es/full/all/es2019
152736481
ns/iter (± 15570807
)159882719
ns/iter (± 11490676
)0.96
es/full/all/es2020
130389675
ns/iter (± 4044322
)148746533
ns/iter (± 8774768
)0.88
es/full/parser
684487
ns/iter (± 23236
)728824
ns/iter (± 65214
)0.94
es/full/base/fixer
25079
ns/iter (± 748
)26502
ns/iter (± 1685
)0.95
es/full/base/resolver_and_hygiene
89057
ns/iter (± 2503
)94321
ns/iter (± 9653
)0.94
serialization of ast node
214
ns/iter (± 3
)219
ns/iter (± 14
)0.98
serialization of serde
231
ns/iter (± 7
)232
ns/iter (± 16
)1.00
This comment was automatically generated by workflow using github-action-benchmark.