Changed bit field syntax to use an & symbol

pull/8/head
Sasha Koshka 5 months ago
parent 731cc828ce
commit e316eb7791

@ -97,8 +97,10 @@ func (parser *ParsingOperation) parseObjtMember () (
member.what, err = parser.parseType()
if err != nil { return }
println(parser.token.Describe())
// if there is a bit width, get it
if parser.token.Is(lexer.TokenKindColon) {
if parser.token.Is(lexer.TokenKindBinaryAnd) {
err = parser.nextToken(lexer.TokenKindUInt)
if err != nil { return }
member.bitWidth = parser.token.Value().(uint64)

@ -10,8 +10,8 @@ objt ro Basic:Obj
ro that:Basic
ro this:Basic
objt ro BitFields:Obj
ro that:Int:1
ro this:Int:24
ro that:Int & 1
ro this:Int & 24 298
objt ro ComplexInit:Obj
ro basic:Int 87
ro complex0:Bird

@ -299,7 +299,7 @@ func (member ObjtMember) ToString (indent int) (output string) {
output += member.what.ToString()
if member.bitWidth > 0 {
output += fmt.Sprint(":", member.bitWidth)
output += fmt.Sprint(" & ", member.bitWidth)
}
isComplexInitialization :=

@ -5,8 +5,8 @@ objt ro Basic:Obj
ro this:Basic
objt ro BitFields:Obj
ro that:Int:1
ro this:Int:24 298
ro that:Int & 1
ro this:Int & 24 298
objt ro Init:Obj
ro that:String "hello world"