File tree Expand file tree Collapse file tree 1 file changed +4
-18
lines changed
Expand file tree Collapse file tree 1 file changed +4
-18
lines changed Original file line number Diff line number Diff line change @@ -17,31 +17,17 @@ export function parseAllDocsToCST(ctx: Context): ParsedCSTDocs {
1717 keepSourceTokens : true ,
1818 lineCounter,
1919 } ) ;
20- const cstNodes : CST . Token [ ] = [ ] ;
20+ const cstNodes : CST . Token [ ] = [ ... parser . parse ( ctx . code ) ] ;
2121 const nodes : Document . Parsed [ ] = [ ] ;
22-
23- /**
24- * Process for Document
25- */
26- function processDoc ( node : Document . Parsed ) {
27- for ( const error of node . errors ) {
22+ for ( const doc of composer . compose ( cstNodes ) ) {
23+ for ( const error of doc . errors ) {
2824 throw ctx . throwError ( error . message , error . pos [ 0 ] ) ;
2925 }
3026 // ignore warns
3127 // for (const error of doc.warnings) {
3228 // throw ctx.throwError(error.message, error.pos[0])
3329 // }
34- nodes . push ( node ) ;
35- }
36-
37- for ( const cst of parser . parse ( ctx . code ) ) {
38- cstNodes . push ( cst ) ;
39- for ( const doc of composer . next ( cst ) ) {
40- processDoc ( doc ) ;
41- }
42- }
43- for ( const doc of composer . end ( ) ) {
44- processDoc ( doc ) ;
30+ nodes . push ( doc ) ;
4531 }
4632
4733 return { nodes, cstNodes, streamInfo : composer . streamInfo ( ) } ;
You can’t perform that action at this time.
0 commit comments