File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change 11import { isArray } from "@alanscodelog/utils/isArray"
22import { isWhitespace } from "@alanscodelog/utils/isWhitespace"
3- import { last } from "@alanscodelog/utils/last"
43import { mixin } from "@alanscodelog/utils/mixin"
54import { setReadOnly } from "@alanscodelog/utils/setReadOnly"
65import type { AddParameters , Mixin } from "@alanscodelog/utils/types"
@@ -345,12 +344,12 @@ export class Parser<T extends {} = {}> {
345344 const pairs : any [ ] [ ] = [ ] as any
346345 let next = this . peek ( 1 )
347346
348- while ( true ) {
347+ while ( pairs . length < 1 || pairs [ pairs . length - 1 ] ?. [ 1 ] !== undefined ) {
349348 const exp = type === "AND" ? this . ruleCondition ( ) : this . ruleBool ( "AND" )
350349 next = this . peek ( 1 )
351350 const canAttemptErrorRecovery = type === "AND"
352- ? [ "error" , "and" ] . includes ( this . options . onMissingBooleanOperator )
353- : this . options . onMissingBooleanOperator === "or"
351+ ? [ "error" , "and" ] . includes ( this . options . onMissingBooleanOperator )
352+ : this . options . onMissingBooleanOperator === "or"
354353 const extras : any [ ] = [ ]
355354 if (
356355 canAttemptErrorRecovery
@@ -404,9 +403,6 @@ export class Parser<T extends {} = {}> {
404403 pairs [ pairs . length - 1 ] . splice ( 1 , 1 , extra [ 0 ] )
405404 pairs . push ( [ extra [ 1 ] ] )
406405 }
407- if ( last ( pairs ) [ 1 ] === undefined ) {
408- break
409- }
410406 }
411407
412408 if ( pairs . length === 0 && this . isType ( this . peek ( 1 ) , OP_TYPE ) ) {
You can’t perform that action at this time.
0 commit comments