File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,14 +11,6 @@ import generate from './generator.js';
1111import * as parser from './preprocessor-parser.js' ;
1212import { formatError } from '../error.js' ;
1313
14- // Register the constant_expression parser so preprocessor.ts can parse #if
15- // expression strings after macro expansion.
16- const expressionParser = ( src : string ) : PreprocessorAstNode =>
17- formatError ( parser ) ( src , {
18- grammarSource : 'expression' ,
19- startRule : 'constant_expression' ,
20- } ) ;
21-
2214export type PreprocessorProgram = {
2315 type : string ;
2416 program : PreprocessorSegmentNode [ ] ;
@@ -147,6 +139,12 @@ export type NodeEvaluators = Partial<
147139 }
148140> ;
149141
142+ const expressionParser = ( src : string ) : PreprocessorAstNode =>
143+ formatError ( parser ) ( src , {
144+ grammarSource : 'expression' ,
145+ startRule : 'constant_expression' ,
146+ } ) ;
147+
150148const evaluate = ( ast : PreprocessorAstNode , evaluators : NodeEvaluators ) => {
151149 const visit = ( node : PreprocessorAstNode ) => {
152150 const evaluator = evaluators [ node . type ] ;
You can’t perform that action at this time.
0 commit comments