(Experimental): implemented IPT composite images.

use LEX/YACC to parse IPT files.
This commit is contained in:
morkt
2019-01-28 19:37:14 +04:00
parent e0114ad91d
commit 14a94d20f1
12 changed files with 2907 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
%namespace GameRes.Formats.Artemis
%partial
%parsertype IPTParser
%visibility internal
%tokentype Token
%union {
public int n;
public string s;
public IPTObject o;
}
%start input
%token NUMBER STRING_LITERAL IDENTIFIER
%%
input: root_definition ;
root_definition: IDENTIFIER '=' object { RootObject[$1.s] = $3.o; }
;
object: '{' { BeginObject(); }
decl_list optional_comma
'}' { EndObject(); }
;
decl_list: statement
| decl_list ',' statement
;
optional_comma: ',' | /* empty */ ;
statement: definition | lvalue ;
definition: IDENTIFIER '=' value { CurrentObject[$1.s] = $3.Value; }
;
lvalue: value { CurrentObject.Values.Add ($1.Value); }
;
value: object | string | number ;
string: STRING_LITERAL ;
number: NUMBER ;
%%