func-section #1

Merged
sashakoshka merged 52 commits from func-section into main 2022-09-03 18:09:14 -06:00
3 changed files with 124 additions and 119 deletions
Showing only changes of commit ed44795664 - Show all commits

View File

@ -36,10 +36,17 @@ func (lexer *LexingOperation) tokenizeNumberBeginning (negative bool) (err error
isFloat, amountRead, isFloat, amountRead,
err = lexer.tokenizeNumber(10) err = lexer.tokenizeNumber(10)
} else if lexer.char >= '0' && lexer.char <= '9' { } else if lexer.char >= '0' && lexer.char <= '8' {
intNumber, floatNumber, intNumber, floatNumber,
isFloat, amountRead, isFloat, amountRead,
err = lexer.tokenizeNumber(8) err = lexer.tokenizeNumber(8)
} else if lexer.char != ' ' { // a space should correctly
err = infoerr.NewError ( // terminate this
lexer.file.Location(1),
"unexpected rune '" + string(lexer.char) +
"' in integer literal",
infoerr.ErrorKindError)
return
} }
} else { } else {
intNumber, floatNumber, intNumber, floatNumber,

View File

@ -62,8 +62,6 @@ func (parser *ParsingOperation) parseFuncSection () (
"this function has nothing in it", "this function has nothing in it",
infoerr.ErrorKindWarn).Print() infoerr.ErrorKindWarn).Print()
} }
// TODO: if function is empty, warn.
return return
} }

View File

@ -13,120 +13,120 @@ func ro bMethod
--- ---
external external
# func ro cBasicPhrases func ro cBasicPhrases
# --- ---
# fn 329 983 09 fn 329 983 09
# [fn 329 983 09] [fn 329 983 09]
# [fn [fn
# 329 329
# 983 983
# 091] 091]
# fn [gn fn [gn
# 329 983 329 983
# 091] 123 091] 123
# func ro dArgumentTypes func ro dArgumentTypes
# --- ---
# [bird tree butterfly.wing "hello world" [bird tree butterfly.wing "hello world"
# grass:{Int:mut 8}] grass:{Int:mut 8}]
#
# func ro eMath func ro eMath
# > x:Int > x:Int
# > y:Int > y:Int
# < z:Int < z:Int
# --- ---
# ++ x ++ x
# -- y -- y
# set z [+ [* 0392 00] 98 x [/ 9832 y] 930] set z [+ [* 0392 00] 98 x [/ 9832 y] 930]
#
# ! true ! true
# ~ 0b01 ~ 0b01
# ~= x ~= x
# % 873 32 % 873 32
#
# = 5 5 = 5 5
# != 4 4 != 4 4
#
# <= 4 98 <= 4 98
# < 4 98 < 4 98
# << 0x0F 4 << 0x0F 4
# <<= x 4 <<= x 4
#
# >= 98 4 >= 98 4
# > 98 4 > 98 4
# >> 0xF0 4 >> 0xF0 4
# >>= x 4 >>= x 4
#
# | 0b01 0b10 | 0b01 0b10
# |= x 0b10 |= x 0b10
# & 0b110 0b011 & 0b110 0b011
# &= x 0b011 &= x 0b011
#
# && true true && true true
# || true false || true false
#
# func ro fReturnDirection func ro fReturnDirection
# < err:Error < err:Error
# --- ---
# someFunc 498 2980 90 -> thing:Int err someFunc 498 2980 90 -> thing:Int err
# otherFunc -> thing err:Error otherFunc -> thing err:Error
#
# [fn [fn
# 329 329
# 983 983
# 091] -> thing:Int err 091] -> thing:Int err
#
# func ro gControlFlow func ro gControlFlow
# --- ---
# if condition if condition
# something something
#
# if condition if condition
# something something
# elseif elseif
# [otherThing] [otherThing]
# else else
# finalThing finalThing
#
# while [< x 432] while [< x 432]
# something something
#
# switch value switch value
# : 324 : 324
# something something
# [: 93284] [: 93284]
# otherThing otherThing
# : 9128 34738 7328 : 9128 34738 7328
# multipleCases multipleCases
# : :
# [defaultThing] [defaultThing]
#
# for index:Size element:Int someArray for index:Size element:Int someArray
# something something
# someNextThing someNextThing
# justMakingSureBlockParsingWorks justMakingSureBlockParsingWorks
#
# [if condition] [if condition]
# if condition if condition
# nestedThing nestedThing
# else else
# otherThing otherThing
# else else
# if condition if condition
# nestedThing nestedThing
# else else
# otherThing otherThing
#
# func hSetPhrase func hSetPhrase
# --- ---
# set x:Int 3 set x:Int 3
# # TODO: this should be the "location of" phrase. update other things to # TODO: this should be the "location of" phrase. update other things to
# # match. # match.
# set y:{Int} [. x] set y:{Int} [. x]
# set z:{Int 8} set z:{Int 8}
# 398 9 2309 983 -2387 398 9 2309 983 -2387
# 478 555 123 478 555 123
# set bird:Bird set bird:Bird
# .that .that
# .whenYou 99999 .whenYou 99999
# .this 324 .this 324