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