Patch #954

NFO lexer and basic parser

Added by yorick over 9 years ago. Updated over 9 years ago.

Status:NewStart date:2010-05-22
Priority:LowDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

I created an NFO lexer, and also a very basic parser(parses into objects with an array of tokens starting with the , * or sprite name)

nfo_parse.diff Magnifier (2.21 KB) yorick, 2010-05-22 18:23

History

#1 Updated by Alberth over 9 years ago

Patch seems to miss handling of SPRITENAME. Updating the patch as below seems to do the trick.

@@ -59,7 +63,7 @@
         result = []
         cursprite = NFOSprite()
         for token in self.lexer:
-            if token.type == 'STAR' or token.type == 'DOUBLESTAR' or token.type == 'SOUNDNAME':
+            if token.type == 'STAR' or token.type == 'DOUBLESTAR' or token.type == 'SOUNDNAME' or token.type == 'SPRITENAME':
                 cursprite.pop()
                 result.append(cursprite)
                 cursprite = NFOSprite()

I ran a test with a single NFO file, and that seems to work at first glance, except the data in the sprites is not interpreted.
(but that seems like a next step to me.)

Also available in: Atom PDF