Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
RBParser example
Last updated at 8:58 pm UTC on 7 November 2018
Example which gives an idea how simple JavaScript may be generated by parsing Smalltalk code with the RBParser.

| exp sel |
Transcript open;clear.

exp := (RBParser parseExpression: 'c:= Sketch minimal').
"exp inspect."
exp class == RBAssignmentNode ifTrue: [
	Transcript show: exp variable token value, ':= '.
	classname := exp value receiver name asString.
	sel :=  exp value selector asString.
	Transcript show: classname ; show:'.' ; show:sel,'()'.
	Transcript show: ';';cr].



Output:

c:= Sketch.minimal();