Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- parse
- "comment stating purpose of message"
- |result a x tmp error res t node top toAdd g|
- error := false.
- t := Tree new.
- t tag: (NonTerm g).
- g := Tree new.
- g tag: (CTerm eop).
- mag := {{NonTerm g. t.}. {CTerm eop. g.}.}.
- result := OrderedCollection new.
- a := (scanner nextToken) tag.
- x := ((mag at: 1) at: 1).
- [(x ~= (CTerm eop) and: (error not))] whileTrue:[
- x := ((mag at: 1) at:1).
- top := ((mag at: 1) at:2).
- (terms includes: x) ifTrue: [
- ((x = CTerm pass) or: (x = a )) ifTrue: [
- node := Tree new.
- node tag: x.
- (top childs) add: node.
- (x = CTerm pass) ifTrue:[
- mag := mag allButFirst.
- ].
- (x = a) ifTrue:[
- mag := mag allButFirst.
- a := (scanner nextToken) tag.
- ]
- ]
- ifFalse: [
- Transcript show: 'ERROR'.
- error := true.
- ].
- ]
- ifFalse:[
- tmp := (table at:(x-20)) at:a.
- (tmp at:1) = -1
- ifTrue: [
- Transcript show: 'ERROR'.
- error := true.
- ]
- ifFalse: [
- node := Tree new.
- node tag: x.
- (top childs) add:node.
- mag := mag allButFirst.
- "mag := tmp, mag."
- toAdd := {}.
- (tmp reverse) do: [:object | toAdd := {{object. node.}.},toAdd].
- mag := toAdd,mag.
- res := (self class describe: x), ' -> '.
- tmp do: [:object | res := res, ' ', (self class describe: object), ', ' ].
- result add:res.
- ].
- ].
- ].
- t describe:'-'.
- "error ifFalse:[
- result do: [:object | Transcript show: object; cr].
- ]"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement