shortened elsif to elif.

enhanced is_reserved_word() to return a token type through a non-NULL second parameter
This commit is contained in:
hyunghwan.chung
2019-07-26 04:40:33 +00:00
parent 05837aef28
commit bd1d30360e
12 changed files with 86 additions and 138 deletions

View File

@ -167,10 +167,10 @@ class(#pointer) Array(SequenceableCollection)
s := anArray size.
if (start < 0) { start := 0 }
elsif (start >= s) { start := s - 1 }.
elif (start >= s) { start := s - 1 }.
if (end < 0) { end := 0 }
elsif (end >= s) { end := s - 1 }.
elif (end >= s) { end := s - 1 }.
*/
i := 0.
ss := self size.
@ -457,11 +457,11 @@ class(#byte) ByteArray(Array)
| firstByte |
firstByte := self at: 0.
if ((firstByte bitAnd:2r10000000) == 0) { 1 }
elsif (firstByte bitAnd:2r11000000) == 2r10000000) { 2 }
elsif (firstByte bitAnd:2r11100000) == 2r11000000) { 3 }
elsif (firstByte bitAnd:2r11110000) == 2r11100000) { 4 }
elsif (firstByte bitAnd:2r11111000) == 2r11110000) { 5 }
elsif (firstByte bitAnd:2r11111100) == 2r11111000) { 6 }.
elif (firstByte bitAnd:2r11000000) == 2r10000000) { 2 }
elif (firstByte bitAnd:2r11100000) == 2r11000000) { 3 }
elif (firstByte bitAnd:2r11110000) == 2r11100000) { 4 }
elif (firstByte bitAnd:2r11111000) == 2r11110000) { 5 }
elif (firstByte bitAnd:2r11111100) == 2r11111000) { 6 }.
*/
}
}

View File

@ -514,8 +514,8 @@ extend Apex
//# TODO: convert an exception to a more specific one depending on the error code.
//#if (ec == Error.Code.ERANGE) { self index: index outOfRange: (self basicSize) }
//# elsif (ec == Error.Code.EPERM) { self messageProhibited: method name }
//# elsif (ec == Error.Code.ENOIMPL) { self subclassResponsibility: method name }.
//# elif (ec == Error.Code.EPERM) { self messageProhibited: method name }
//# elif (ec == Error.Code.ENOIMPL) { self subclassResponsibility: method name }.
(PrimitiveFailureException /* in: method */ withErrorCode: ec) signal: msg.
}

View File

@ -92,11 +92,11 @@ class(#limited) Character(Magnitude)
{
^self asInteger - $0 asInteger
}
elsif ((self >= $A) and (self <= $Z))
elif ((self >= $A) and (self <= $Z))
{
^self asInteger - $A asInteger + 10
}
elsif ((self >= $a) and (self <= $z))
elif ((self >= $a) and (self <= $z))
{
^self asInteger - $a asInteger + 10
}.
@ -359,7 +359,7 @@ class(#limited) Number(Magnitude)
/* self < 0 ifTrue: [^-1].
self > 0 ifTrue: [^1].
^0.*/
^if (self < 0) { -1 } elsif (self > 0) { 1 } else { 0 }
^if (self < 0) { -1 } elif (self > 0) { 1 } else { 0 }
}
}

View File

@ -113,15 +113,15 @@ class MyObject(Object)
System logNl: "XXXXXXXXX".
1111
}
elsif ("abcd" ~= "abcd")
elif ("abcd" ~= "abcd")
{
System logNl: "second if".
}
elsif ([k := 20. System logNl: "k => " & (k asString). k + 20. true] value)
elif ([k := 20. System logNl: "k => " & (k asString). k + 20. true] value)
{
System logNl: "THIRID forever............." & (k asString)
}
elsif (true = true)
elif (true = true)
{
System logNl: "forever............."
}
@ -168,7 +168,7 @@ class MyObject(Object)
}.*/
a := if(false) { 10 } elsif (false) { 20 } elsif (false) { 30} else { 40}.
a := if(false) { 10 } elif (false) { 20 } elif (false) { 30} else { 40}.
//a := if(false) { 999 } else { 888 }.
a dump.

View File

@ -231,7 +231,7 @@ method(#class,#abstract) xxx. => method(#class) xxx { self subclassResponsibilit
// if the internal semaphore has been signaled,
// arrange to return nil to indicate timeout.
if (r == s) { r := nil } // timed out
elsif (r signalAction notNil) { r signalAction value: r }. // run the signal action block
elif (r signalAction notNil) { r signalAction value: r }. // run the signal action block
] ensure: [
// System<<unsignal: doesn't thrown an exception even if the semaphore s is not
// register with System<<signal:afterXXX:. otherwise, i would do like this line

View File

@ -59,7 +59,7 @@ class(#byte(4)) IP4Address(IPAddress)
if (acc > 255) { Exception signal: ('invalid IPv4 address B ' & str). }.
digits := digits + 1.
}
elsif (c == $.)
elif (c == $.)
{
if (dots >= 3 or: [digits == 0]) { ^Error.Code.EINVAL }.
self basicAt: (dots + address_offset) put: acc.
@ -151,7 +151,7 @@ class(#byte(16)) IP6Address(IP4Address)
colonpos := tgpos.
continue.
}
elsif (pos >= size)
elif (pos >= size)
{
// a colon can't be the last character
^Error.Code.EINVAL
@ -194,7 +194,7 @@ class(#byte(16)) IP6Address(IP4Address)
self basicShiftFrom: colonpos to: (colonpos + (mysize - tgpos)) count: (tgpos - colonpos).
//tgpos := tgpos + (mysize - tgpos).
}
elsif (tgpos ~~ mysize)
elif (tgpos ~~ mysize)
{
^Error.Code.EINVAL
}.
@ -379,7 +379,7 @@ class SyncSocket(Socket)
self __wait_for_output.
soerr := self _socketError.
if (soerr == 0) { break }
elsif (soerr > 0)
elif (soerr > 0)
{
Exception signal: ('unable to connect - error ' & soerr asString).
}.

View File

@ -432,7 +432,7 @@ class X11.Button(X11.Label)
self.bgcolor := x.
self onPaintEvent: llevent.
}
elsif (type == X11.LLEventType.BUTTON_RELEASE)
elif (type == X11.LLEventType.BUTTON_RELEASE)
{
x := self.fgcolor.
self.fgcolor := self.bgcolor.