UNPKG
@yugu/gogocode
Version:
latest (1.0.55)
1.0.55
1.0.54
The simplest tool to parse/transform/generate code on ast
github.com/thx/gogocode
thx/gogocode
@yugu/gogocode
/
src
/
html-core
/
parse.js
7 lines
•
288 B
JavaScript
View Raw
1
2
3
4
5
6
7
const
{ constructTree, tokenize } =
require
(
'hyntax-yx'
);
module
.
exports
=
(
code
) =>
{
// const selfClosingTag = code.replace(/{{[^{^}]+}}/g, '').match(/(?<=\<)[a-z|\.|-]+(?=[^><]+\/>)/g)
const
{ tokens } =
tokenize
(code)
const
{ ast } =
constructTree
(tokens)
return
ast }