The following problems reported by John Brant have been fixed:
*) The scanner should reinitialize the keyword map
when it loads
(WikiScanner initializeKeywordMap).
*) Page names should be case-insensitive. Most likely
ordinary users
are
used to non-case-sensitive items (e.g., the Windows file system, domain
names --
WWW.GOOGLE.COM =
www.google.com).
I changed the behavior and I think this enhances the usability a lot.
Additionally I've also modified the internal representation of children
in the folders: they are now stored in a dictionary (id -> structure)
instead as an ordered collection, what enhances lookup-speed a lot. I
used an ordered collection in the past because folders were rendered
automatically before, but now as they behave like an ordinary page
there is no more need to keep the pages in a certain order.
As the internal data-structure changed, existing wikis have to be
migrated. The post-load action will evaluate the following code:
Folder>>migrateOrderedCollectionToDictinary
| childrenInstVarIndex old |
childrenInstVarIndex := self allSuperclasses
inject: (self instVarNames indexOf: 'children')
into: [ :sum :each | sum + each instVarNames size ].
self allInstancesDo: [ :folder |
old := folder instVarAt: childrenInstVarIndex.
(old isKindOf: SequenceableCollection) ifTrue: [
folder instVarAt: childrenInstVarIndex put: folder
defaultChildrenCollection.
old do: [ :child | folder add: child ] ] ]
*) If you have a page title with quotes in it, they
don't appear when
you
reedit the page. For example, if you have (This is a "test"), the page
title
on reediting will be (This is a ).
*) If you enter < in a page for the < character, it appears as a <
when
you reedit the page. For example, edit the syntax page. After you save
the
page, the <b> is changed to <b>.
These two bugs have been fixed, I forgot to encode strings in the
attributes of the html-tags properly.
Another thing I've fixed are the recent changes: it displays a page at
most once a day, even if it has been edited several times.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Essentially, you want a LR(0) parser. If you override
the #handleError:
method, you can simulate LR(0) behavior -- I've attached it below. If
you
have multiple reductions for the same state, it will just pick one to
reduce. For example, if you have:
Run : A "A" | B "B" ;
A : "1" {Transcript show: 'a' ;cr; flush};
B : "1" {Transcript show: 'b'; cr; flush};
And you enter "1C" it may pick either A or B to reduce. However, if
you have
valid string (1A or 1B), then it reduces properly.
John Brant
--------------------------
handleError: anInteger
| result |
1 to: self emptySymbolTokenId
do:
[:i |
result := self actionFor: i.
(result bitAnd: self actionMask) = self reduceAction
ifTrue: [^self reduce: (result bitShift:
-2)]].
super handleError: anInteger
Wow, thanks a lot for this code-snippet. I included it into my parser
and all the tests immediately passed. Shouldn't this be a checkbox in
the SmaCC-UI to allow generating this method automatically? Or are
there any problems to be expected when adding this code? I tried all
kinds of valid and invalid input and it works as expected with my
example.
Regards,
Lukas
--
Lukas Renggli
http://renggli.freezope.org