diff -r 2f598ee17a2d -r 6e97d8145481 PPExpressionParser.st --- a/PPExpressionParser.st Sun Sep 08 15:50:00 2019 +0200 +++ b/PPExpressionParser.st Sun Sep 08 16:46:10 2019 +0200 @@ -1,5 +1,9 @@ +"{ Encoding: utf8 }" + "{ Package: 'stx:goodies/petitparser' }" +"{ NameSpace: Smalltalk }" + PPDelegateParser subclass:#PPExpressionParser instanceVariableNames:'operators' classVariableNames:'' @@ -27,20 +31,20 @@ ! buildOn: aParser - ^ self buildSelectors inject: aParser into: [ :term :selector | - | list | - list := operators at: selector ifAbsent: [ #() ]. - list isEmpty - ifTrue: [ term ] - ifFalse: [ - self - perform: selector with: term - with: (list size = 1 - ifTrue: [ list first first ==> [ :operator | Array with: list first second with: operator ] ] - ifFalse: [ - list - inject: PPChoiceParser new - into: [ :choice :each | choice / (each first ==> [ :operator | Array with: each second with: operator ]) ] ]) ] ] + ^ self buildSelectors inject: aParser into: [ :term :selector | + | list | + list := operators at: selector ifAbsent: [ #() ]. + list isEmpty + ifTrue: [ term ] + ifFalse: [ + self + perform: selector with: term + with: (list size == 1 + ifTrue: [ list first first ==> [ :operator | Array with: list first second with: operator ] ] + ifFalse: [ + list + inject: PPChoiceParser new + into: [ :choice :each | choice / (each first ==> [ :operator | Array with: each second with: operator ]) ] ]) ] ] ! buildSelectors @@ -103,13 +107,14 @@ !PPExpressionParser class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPExpressionParser.st,v 1.3 2012-05-04 21:59:01 vrany Exp $' + ^ '$Header$' ! version_CVS - ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPExpressionParser.st,v 1.3 2012-05-04 21:59:01 vrany Exp $' + ^ '$Header$' ! version_SVN - ^ '§Id: PPExpressionParser.st 2 2010-12-17 18:44:23Z vranyj1 §' + ^ '$Id$' ! ! +