changed the compiler to remove all leading spaces from a method name when composing a primitive identifer.

started enhancing the compiler to support the #pragma directive
This commit is contained in:
hyunghwan.chung
2017-11-24 17:40:20 +00:00
parent d8bcb6e012
commit 76b975a152
12 changed files with 177 additions and 96 deletions

View File

@ -187,14 +187,14 @@ extend Apex
method(#dual) isNil
{
"^self == nil."
## ^self == nil.
^false
}
method(#dual) notNil
{
"^(self == nil) not"
"^self ~= nil."
## ^(self == nil) not
## ^self ~= nil.
^true.
}

View File

@ -115,21 +115,21 @@ class(#pointer,#final,#limited) BlockContext(Context)
method fork
{
"crate a new process in the runnable state"
## crate a new process in the runnable state
^self newProcess resume.
}
method newProcess
{
"create a new process in the suspended state"
## create a new process in the suspended state
<primitive: #_block_new_process>
self primitiveFailed.
}
method newProcessWith: anArray
{
"create a new process in the suspended state passing the elements
of anArray as block arguments"
## create a new process in the suspended state passing the elements
## of anArray as block arguments
<primitive: #_block_new_process>
self primitiveFailed.
}
@ -268,7 +268,7 @@ class(#pointer,#final,#limited) BlockContext(Context)
* --------------------------------------------------
| pc |
pc := thisContext pcplus1.
(self value) ifTrue: [ ^nil "^self" ].
(self value) ifTrue: [ ^nil ]. ## ^self
aBlock value.
thisContext goto: pc.
* -------------------------------------------------- *)
@ -293,7 +293,7 @@ class(#pointer,#final,#limited) BlockContext(Context)
* --------------------------------------------------
| pc |
pc := thisContext pcplus1.
(self value) ifTrue: [ ^nil "^self" ].
(self value) ifTrue: [ ^nil ]. ## ^self
thisContext goto: pc.
* -------------------------------------------------- *)
while ((self value) == false) { }.

View File

@ -80,7 +80,7 @@ while (ctx notNil)
System logNl: '== END OF BACKTRACE =='.
thisContext unwindTo: (thisProcess initialContext) return: nil.
('### EXCEPTION NOT HANDLED #### ' & self class name & ' - ' & self messageText) dump.
('### EXCEPTION NOT HANDLED(Exception) #### ' & self class name & ' - ' & self messageText) dump.
## TODO: debug the current process???? "
##Processor activeProcess terminate.

View File

@ -210,26 +210,10 @@ method(#class,#abstract) xxx. => method(#class) xxx { self subclassResponsibilit
method(#class) new: size { self messageProhibited: #new: }
*)
method(#primitive) _addSemaphore: sem.
method(#primitive) _removeSemaphore: sem.
method(#primitive) addSemaphore: sem.
method(#primitive) removeSemaphore: sem.
method(#primitive) _wait.
method addSemaphore: sem
{
| x |
x := self _addSemaphore: sem.
if (x isError) { Exception signal: ('Cannot add a semaphore - ' & x asString) }.
^x
}
method removeSemaphore: sem
{
| x |
x := self _removeSemaphore: sem.
if (x isError) { Exception signal: ('Cannot remove a semaphore - ' & x asString) }.
^x
}
method wait
{
| x |

View File

@ -110,6 +110,7 @@ class MyObject(Object)
'wrong module name'
'failed to import module'
'#include error'
'wrong pragma name'
'wrong namespace name'
'wrong pool dictionary name'
'duplicate pool dictionary name'

View File

@ -155,8 +155,8 @@ class MyObject(TestObject)
## ---------------------------------------------------------------------------
" this sample demonstrates what happens when a block context returns to the origin's caller
after the caller has already returned. "
## this sample demonstrates what happens when a block context returns to the origin's caller
## after the caller has already returned.
method(#class) xxxx
{
@ -180,7 +180,7 @@ class MyObject(TestObject)
method(#class) main66
{
self yyyy.
t2 := t2 value. "can t2 return? it should return somewhere into the method context of yyy. but it has already terminated"
t2 := t2 value. ## can t2 return? it should return somewhere into the method context of yyy. but it has already terminated
t2 dump.
}
@ -190,7 +190,7 @@ class MyObject(TestObject)
t1 := 1.
self xxxx.
t2 := t2 value. "can t2 return? it should return somewhere into the method context of yyy. but it has already terminated"
t2 := t2 value. ## can t2 return? it should return somewhere into the method context of yyy. but it has already terminated
t2 dump.
}
## ----------------------------------------------------------------------
@ -215,7 +215,7 @@ class MyObject(TestObject)
(#[3 2 1] at: 3) dump.
## thisContext value. "the message value must be unresolvable as thisContext is a method context"
## thisContext value. ## the message value must be unresolvable as thisContext is a method context
## [thisContext value] value.
'-------------------------' dump.
b := 0.
@ -354,7 +354,9 @@ PROCESS TESTING
(2r1111111111111111111111111111111111111111111111111111111111111111 printStringRadix:2) dump.
"(16rF0FFFF bitOr: 16r111111) dump.
(* -----------------------
(16rF0FFFF bitOr: 16r111111) dump.
(16r11 bitOr: 16r20000000000000000000000000000000FFFFFFFFFFFFFFFF11111100000000000000000001) dump.
((16r11 bitOr: 16r20000000000000000000000000000000FFFFFFFFFFFFFFFF11111100000000000000000001) bitOr: 16r1100) dump.
@ -365,7 +367,8 @@ PROCESS TESTING
((2r11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 bitXor: 2r11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111) printStringRadix: 2) dump.
((2r10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 bitAnd: 2r01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010) printStringRadix: 2) dump.
"
--------------------- *)
(16rFFFFFFFFFFFFFFFF bitOr: 16rFFFFFFFFFFFFFFFFFFFFFFFF) dump.
(-16rFFFFFFFFFFFFFFFF bitOr: 16rFFFFFFFFFFFFFFFFFFFFFFFF) dump.