Merged in latest version from Moose repository
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 03 Oct 2014 02:45:16 +0100
changeset 378 53d66ecfeb1b
parent 377 6112a403a52d
child 379 451b5ae38b72
Merged in latest version from Moose repository Name: PetitAnalyzer-DiegoLont.46 Author: DiegoLont Time: 02-09-2013, 12:37:58 PM UUID: 89f155fa-89b4-4bb7-b76e-0f8485be4a56 Repository: http://smalltalkhub.com/mc/Moose/PetitParser/main
PPNotParser.st
PPRepeatingParser.st
analyzer/Make.proto
analyzer/PPParserReplaceRule.st
analyzer/PPSentinel.st
analyzer/analyzer.rc
analyzer/bc.mak
analyzer/extensions.st
analyzer/stx_goodies_petitparser_analyzer.st
petitparser.rc
tests/tests.rc
--- a/PPNotParser.st	Fri Oct 03 02:33:08 2014 +0100
+++ b/PPNotParser.st	Fri Oct 03 02:45:16 2014 +0100
@@ -8,6 +8,8 @@
 !
 
 
+
+
 !PPNotParser methodsFor:'parsing'!
 
 parseOn: aPPContext
--- a/PPRepeatingParser.st	Fri Oct 03 02:33:08 2014 +0100
+++ b/PPRepeatingParser.st	Fri Oct 03 02:45:16 2014 +0100
@@ -26,17 +26,8 @@
 	^ (self on: aParser) setMin: aMinInteger max: aMaxInteger
 ! !
 
-!PPRepeatingParser methodsFor:'*petitanalyzer-matching'!
-
-match: aParser inContext: aDictionary seen: anIdentitySet
-	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self min = aParser min and: [ self max = aParser max ] ]
-! !
 
-!PPRepeatingParser methodsFor:'*petitanalyzer-testing'!
 
-isNullable
-	^ min = 0
-! !
 
 !PPRepeatingParser methodsFor:'accessing'!
 
--- a/analyzer/Make.proto	Fri Oct 03 02:33:08 2014 +0100
+++ b/analyzer/Make.proto	Fri Oct 03 02:45:16 2014 +0100
@@ -135,7 +135,7 @@
 $(OUTDIR)PPSearcher.$(O) PPSearcher.$(H): PPSearcher.st $(INCLUDE_TOP)/stx/goodies/petitparser/analyzer/PPProcessor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)PPBlockReplaceRule.$(O) PPBlockReplaceRule.$(H): PPBlockReplaceRule.st $(INCLUDE_TOP)/stx/goodies/petitparser/analyzer/PPReplaceRule.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/analyzer/PPRule.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)PPParserReplaceRule.$(O) PPParserReplaceRule.$(H): PPParserReplaceRule.st $(INCLUDE_TOP)/stx/goodies/petitparser/analyzer/PPReplaceRule.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/analyzer/PPRule.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPActionParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPDelegateParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPEpsilonParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPFailingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPFlattenParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPLimitedRepeatingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPListParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPLiteralParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPOptionalParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPluggableParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPredicateParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPredicateSequenceParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPRepeatingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPSequenceParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPTokenParser.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPActionParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPDelegateParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPEpsilonParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPFailingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPFlattenParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPLimitedRepeatingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPListParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPLiteralParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPNotParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPOptionalParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPluggableParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPredicateParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPPredicateSequenceParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPRepeatingParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPSequenceParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPTokenParser.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/analyzer/PPParserReplaceRule.st	Fri Oct 03 02:33:08 2014 +0100
+++ b/analyzer/PPParserReplaceRule.st	Fri Oct 03 02:45:16 2014 +0100
@@ -25,8 +25,8 @@
 
 !PPParserReplaceRule methodsFor:'matching'!
 
-foundMatchFor:aParser
-    ^ replaceParser copyInContext: owner context
+foundMatchFor: aParser 
+	^ replaceParser copyInContext: owner context
 ! !
 
 !PPParserReplaceRule class methodsFor:'documentation'!
--- a/analyzer/PPSentinel.st	Fri Oct 03 02:33:08 2014 +0100
+++ b/analyzer/PPSentinel.st	Fri Oct 03 02:45:16 2014 +0100
@@ -18,7 +18,7 @@
 !PPSentinel class methodsFor:'instance creation'!
 
 instance
-    ^ instance ifNil:[ instance := self new ].
+	^ instance ifNil: [ instance := self new ]
 ! !
 
 !PPSentinel class methodsFor:'documentation'!
--- a/analyzer/analyzer.rc	Fri Oct 03 02:33:08 2014 +0100
+++ b/analyzer/analyzer.rc	Fri Oct 03 02:45:16 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2014\nCopyright eXept Software AG 1998-2014\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Fri, 03 Oct 2014 01:32:33 GMT\0"
+      VALUE "ProductDate", "Fri, 03 Oct 2014 01:43:52 GMT\0"
     END
 
   END
--- a/analyzer/bc.mak	Fri Oct 03 02:33:08 2014 +0100
+++ b/analyzer/bc.mak	Fri Oct 03 02:45:16 2014 +0100
@@ -81,7 +81,7 @@
 $(OUTDIR)PPSearcher.$(O) PPSearcher.$(H): PPSearcher.st $(INCLUDE_TOP)\stx\goodies\petitparser\analyzer\PPProcessor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)PPBlockReplaceRule.$(O) PPBlockReplaceRule.$(H): PPBlockReplaceRule.st $(INCLUDE_TOP)\stx\goodies\petitparser\analyzer\PPReplaceRule.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\analyzer\PPRule.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)PPParserReplaceRule.$(O) PPParserReplaceRule.$(H): PPParserReplaceRule.st $(INCLUDE_TOP)\stx\goodies\petitparser\analyzer\PPReplaceRule.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\analyzer\PPRule.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\petitparser\PPActionParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPDelegateParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPEpsilonParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPFailingParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPFlattenParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPLimitedRepeatingParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPListParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPLiteralParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPOptionalParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPPluggableParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPPredicateParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPPredicateSequenceParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPRepeatingParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPSequenceParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPTokenParser.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\petitparser\PPActionParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPDelegateParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPEpsilonParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPFailingParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPFlattenParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPLimitedRepeatingParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPListParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPLiteralParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPNotParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPOptionalParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPPluggableParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPPredicateParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPPredicateSequenceParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPRepeatingParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPSequenceParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPTokenParser.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/analyzer/extensions.st	Fri Oct 03 02:33:08 2014 +0100
+++ b/analyzer/extensions.st	Fri Oct 03 02:45:16 2014 +0100
@@ -27,9 +27,9 @@
 
 !PPLimitedRepeatingParser methodsFor:'*petitanalyzer-transforming'!
 
-replace:aParser with:anotherParser
-    super replace:aParser with:anotherParser.
-    limit == aParser ifTrue:[limit := anotherParser].
+replace: aParser with: anotherParser
+	super replace: aParser with: anotherParser.
+	limit == aParser ifTrue: [ limit := anotherParser ]
 ! !
 
 !PPListParser methodsFor:'*petitanalyzer-matching'!
@@ -67,6 +67,18 @@
 	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self literal = aParser literal and: [ self message = aParser message ] ]
 ! !
 
+!PPNotParser methodsFor:'*petitanalyzer-private'!
+
+firstSets: aFirstDictionary into: aSet
+	
+! !
+
+!PPNotParser methodsFor:'*petitanalyzer-testing'!
+
+isFirstSetTerminal
+	^ true
+! !
+
 !PPOptionalParser methodsFor:'*petitanalyzer-testing'!
 
 isNullable
@@ -200,7 +212,7 @@
 	| firstSets |
 	firstSets := IdentityDictionary new.
 	self allParsersDo: [ :each |
-		firstSets at: each put: (each isTerminal
+		firstSets at: each put: (each isFirstSetTerminal
 			ifTrue: [ IdentitySet with: each ]
 			ifFalse: [ IdentitySet new ]).
 		each isNullable
@@ -299,6 +311,14 @@
 
 !PPParser methodsFor:'*petitanalyzer-testing'!
 
+isFirstSetTerminal
+	"Answer true if the receiver is a terminal or leaf parser, that means it does not delegate to any other parser."
+
+	^ self children isEmpty
+! !
+
+!PPParser methodsFor:'*petitanalyzer-testing'!
+
 isNullable
 	"Answer true if the receiver is a nullable parser, e.g. it can successfully parse nothing."
 	
@@ -455,6 +475,16 @@
 	^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self size = aParser size ]
 ! !
 
+!PPRepeatingParser methodsFor:'*petitanalyzer-private'!
+
+followSets: aFollowDictionary firstSets: aFirstDictionary into: aSet
+	| firstSet |
+	super followSets: aFollowDictionary firstSets:  aFirstDictionary into: aSet.
+	
+	firstSet := aFirstDictionary at: self.
+	self children do: [:p | (aFollowDictionary at: p) addAll: (firstSet reject: [:each | each isNullable]) ]
+! !
+
 !PPRepeatingParser methodsFor:'*petitanalyzer-testing'!
 
 isNullable
--- a/analyzer/stx_goodies_petitparser_analyzer.st	Fri Oct 03 02:33:08 2014 +0100
+++ b/analyzer/stx_goodies_petitparser_analyzer.st	Fri Oct 03 02:45:16 2014 +0100
@@ -10,6 +10,20 @@
 
 !stx_goodies_petitparser_analyzer class methodsFor:'accessing - monticello'!
 
+monticelloLastMergedVersionInfo
+    "The last merged version is: "
+
+    ^ '
+    Name: PetitAnalyzer-DiegoLont.46
+    Author: DiegoLont
+    Time: 02-09-2013, 12:37:58 PM
+    UUID: 89f155fa-89b4-4bb7-b76e-0f8485be4a56        
+    Repository: http://smalltalkhub.com/mc/Moose/PetitParser/main
+    '
+
+    "Created: / 03-10-2014 / 02:40:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 monticelloName
     "Return name of the package for Monticello. This is used when package is exported"
 
@@ -113,7 +127,6 @@
         PPParser cycleSet:
         PPParser cycleSet:firstSets:into:
         PPParser firstSet
-        PPParser firstSets
         PPParser firstSets:into:
         PPParser followSet
         PPParser followSets
@@ -141,6 +154,11 @@
         PPSequenceParser firstSets:into:
         PPSequenceParser followSets:firstSets:into:
         PPTokenParser match:inContext:seen:
+        PPNotParser firstSets:into:
+        PPNotParser isFirstSetTerminal
+        PPParser firstSets
+        PPParser isFirstSetTerminal
+        PPRepeatingParser followSets:firstSets:into:
     )
 ! !
 
--- a/petitparser.rc	Fri Oct 03 02:33:08 2014 +0100
+++ b/petitparser.rc	Fri Oct 03 02:45:16 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "(C) Lukas Renggli\0"
       VALUE "ProductName", "Petit Parser\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Fri, 03 Oct 2014 01:32:30 GMT\0"
+      VALUE "ProductDate", "Fri, 03 Oct 2014 01:43:49 GMT\0"
     END
 
   END
--- a/tests/tests.rc	Fri Oct 03 02:33:08 2014 +0100
+++ b/tests/tests.rc	Fri Oct 03 02:45:16 2014 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2014\nCopyright eXept Software AG 1998-2014\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Fri, 03 Oct 2014 01:32:32 GMT\0"
+      VALUE "ProductDate", "Fri, 03 Oct 2014 01:43:50 GMT\0"
     END
 
   END