Fixed bug with identifier parsing
This commit is contained in:
parent
ec21a1d05e
commit
b76cb30d94
@ -103,7 +103,7 @@ func (parser *ParsingOperation) parseEnumMember () (
|
||||
if err != nil { return }
|
||||
err = parser.expect (
|
||||
lexer.TokenKindLessThan,
|
||||
lexer.TokenKindGreaterThan)
|
||||
lexer.TokenKindLParen)
|
||||
if err != nil { return }
|
||||
|
||||
if parser.token.Is(lexer.TokenKindLessThan) {
|
||||
|
@ -23,11 +23,30 @@ enum ro NamedColor:U32
|
||||
- red:<0xFF0000>
|
||||
- green:<0x00FF00>
|
||||
- blue:<0x0000FF>
|
||||
enum ro ThisIsTerrible:Obj:(.rw x:Int .rw y:Int)
|
||||
- up: (.x: 0 .y: -1)
|
||||
- down: (.x: 0 .y: 1)
|
||||
- left: (.x: -1 .y: 0)
|
||||
- right: (.x: 1 .y: 0)
|
||||
enum ro ThisIsTerrible:Obj:
|
||||
(
|
||||
.rw x:Int
|
||||
.rw y:Int
|
||||
)
|
||||
- up:
|
||||
(
|
||||
.x:<0>
|
||||
.y:<-1>
|
||||
)
|
||||
- down:
|
||||
(
|
||||
.x:<0>
|
||||
.y:<1>)
|
||||
- left:
|
||||
(
|
||||
.x:<-1>
|
||||
.y:<0>
|
||||
)
|
||||
- right:
|
||||
(
|
||||
.x:<1>
|
||||
.y:<0>
|
||||
)
|
||||
enum ro Weekday:Int
|
||||
- sunday
|
||||
- monday
|
||||
|
@ -12,7 +12,10 @@ func (parser *ParsingOperation) parseIdentifier () (
|
||||
identifier.location = parser.token.Location()
|
||||
|
||||
for {
|
||||
if !parser.token.Is(lexer.TokenKindName) { break }
|
||||
if !parser.token.Is(lexer.TokenKindName) {
|
||||
parser.previousToken()
|
||||
break
|
||||
}
|
||||
|
||||
identifier.trail = append (
|
||||
identifier.trail,
|
||||
|
@ -364,10 +364,10 @@ func (section EnumSection) ToString (indent int) (output string) {
|
||||
member.value.kind == ArgumentKindArrayDefaultValues
|
||||
|
||||
if isComplexInitialization {
|
||||
output += "\n"
|
||||
output += ":\n"
|
||||
output += member.value.ToString(indent + 2, true)
|
||||
} else if member.value.kind != ArgumentKindNil {
|
||||
output += " " + member.value.ToString(0, false)
|
||||
output += ":<" + member.value.ToString(0, false) + ">"
|
||||
}
|
||||
output += "\n"
|
||||
}
|
||||
|
@ -6,7 +6,10 @@ import "git.tebibyte.media/arf/arf/types"
|
||||
|
||||
// parseType parses a type notation of the form Name, {Name}, etc.
|
||||
func (parser *ParsingOperation) parseType () (what Type, err error) {
|
||||
println("START")
|
||||
defer println("END")
|
||||
err = parser.expect(lexer.TokenKindName, lexer.TokenKindLBrace)
|
||||
println(parser.token.Describe())
|
||||
if err != nil { return }
|
||||
what.location = parser.token.Location()
|
||||
|
||||
@ -181,11 +184,11 @@ func (parser *ParsingOperation) parseObjectDefaultValueAndMembers () (
|
||||
} else if parser.token.Is(lexer.TokenKindPermission) {
|
||||
// parsing a member declaration
|
||||
var member TypeMember
|
||||
member,
|
||||
err = parser.parseObjectNewMember()
|
||||
member, err = parser.parseObjectNewMember()
|
||||
|
||||
// TODO: error on duplicate
|
||||
members = append(members, member)
|
||||
if err != nil { return }
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user