added two experimental language/compiler enhancements - 1. multi-line comments enclosed in (* and *) 2. unary method and message with parenthensized parameters

This commit is contained in:
hyunghwan.chung
2016-12-06 17:21:47 +00:00
parent 0cc0339158
commit f88027af32
4 changed files with 191 additions and 35 deletions

View File

@ -1,9 +1,11 @@
#class(#byte) Stdio(Object) from 'stdio'
{
## #method(#class) _newInstSize
## {
## <primitive: #stdio._newInstSize>
## }
(*
* The following methods are generated by the module.
* #method(#class) _newInstSize { <primitive: #stdio._newInstSize> }
* #method open: name for: mode { <primitive: #stdio.open> }
* #method close { <primitive: #stdio.close> }
*)
#method(#class) new: size
{
@ -24,15 +26,35 @@
^(self new) open: name for: mode
}
## #method open: name for: mode
## {
## <primitive: #stdio.open>
## }
## #method close
## {
## <primitive: #stdio.close>
## }
#method(#class) input
{
^(super new) open: 0 for: 'r'
}
#method(#class) output
{
^(super new) open: 1 for: 'w'
}
#method(#class) error
{
^(super new) open: 2 for: 'w'
}
(*
#method format: fmt with: ...
{
}
*)
#method format (fmt. args)
{
'THIS IS FORMAT' dump.
fmt dump.
args dump.
}
}
#extend Stdio

View File

@ -130,6 +130,22 @@
v1 close.
nil isNil ifTrue: [ 'NIL NIL NIL' dump. ].
(Apex new) notNil ifTrue: [ 'APEX NIL NIL NIL' dump. ].
(*
v1 format(10 20 30) isNil
procecure call is treated as if it is a unary message...
v1 format(10 , 20 , 30) isNil ifTrue: [
xxxx
].
*)
v1 format(10 . 20) isNil ifFalse: [
'Beautiful life' dump.
].
}
}