Issue #239: Fix all Smalltak/X source files to be in unicode (UTF8 without BOM) and prefixed by "{ Encoding: utf8 }" when any unicode character is present
- All source *.st files are now Unicode UTF8 without BOM
Files are in two groups (fileOut works this way in Smalltalk/X):
- containing a unicode character have "{ Encoding: utf8 }" at the header
- ASCII only are without the header
"{ Package: 'stx:goodies/petitparser/compiler' }"
"{ NameSpace: Smalltalk }"
PPCRewritingVisitor subclass:#PPCLL1Visitor
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'PetitCompiler-Visitors'
!
!PPCLL1Visitor methodsFor:'as yet unclassified'!
isDeterministicChoice: node
| firsts |
firsts := OrderedCollection new.
node children do: [ :child |
(self startsWithToken: child) ifFalse: [ ^ false ].
firsts addAll: child firstSetWithTokens.
].
(firsts asIdentitySet size = firsts size) ifFalse: [ ^ false ].
firsts do:[:e1 |
firsts do:[:e2 |
e1 == e2 ifFalse: [
(e1 overlapsWith: e2) ifTrue: [ ^ false ] ].
].
].
^ true
"Modified: / 10-05-2015 / 07:27:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
startsWithToken: node
| firstSet terminal total |
total := 0.
firstSet := node firstSetWithTokens.
terminal := (firstSet detect: [ :e | e isTerminal ] ifNone: [ nil ]).
terminal isNil ifFalse: [ ^ false ].
^ true
!
visitChoiceNode: node
super visitChoiceNode: node.
(self isDeterministicChoice: node) ifTrue: [
self change.
^ PPCDeterministicChoiceNode new
children: node children;
name: node name;
firstFollowCache: node firstFollowCache;
yourself
].
^ node
! !