Replies: 1 comment
-
ParserMethod is used in both the top level rules signatures Perhaps the code should first be refactored to distinguish better between the different scenarios (CST vs EmbeddedActions at least) as I started listing the flows and got confused myself. 😄 I think some of the complexity is due to the CST flow having been added at a later time on the same base parser class. Relevant code: defineRule runtime behaviorchevrotain/packages/chevrotain/src/parse/parser/traits/recognizer_engine.ts Lines 217 to 248 in 58b0a98 invokeRuleCatchchevrotain/packages/chevrotain/src/parse/parser/traits/recognizer_engine.ts Lines 258 to 310 in 58b0a98 Default RecoveryValueFunc (may only be relevant for CST flow)
|
Beta Was this translation helpful? Give feedback.
-
I wonder if
ParserMethod
has the wrong return type andnull
should be added because when a parser failed (and even recovery failed if enabled) it will returnnull
.Currently it is
export type ParserMethod<ARGS extends unknown[], R> = (...args: ARGS) => R
but maybe it should be
export type ParserMethod<ARGS extends unknown[], R> = (...args: ARGS) => R | null
Beta Was this translation helpful? Give feedback.
All reactions