Browse Source

fcl-res: basic rc definitions

Reintegrate fpcres-rc branch by Martok

git-svn-id: trunk@46373 -
svenbarth 5 years ago
parent
commit
d6dd918582
4 changed files with 1220 additions and 224 deletions
  1. 578 157
      packages/fcl-res/src/rclex.inc
  2. 56 28
      packages/fcl-res/src/rclex.l
  3. 472 30
      packages/fcl-res/src/rcparser.pas
  4. 114 9
      packages/fcl-res/src/rcparser.y

+ 578 - 157
packages/fcl-res/src/rclex.inc

@@ -2,10 +2,32 @@
 (* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
 (* lexical analyzer template (TP Lex V3.0), V1.0 3-2-91 AG *)
 
 
 (* global definitions: *)
 (* global definitions: *)
+var
+  kwtmp: integer;
+  strbuf: string;
+
+const
+  KeywordDefs: array [0..0] of TIdentMapEntry = (
+    (Value: _LANGUAGE; Name: 'LANGUAGE')
+  );
+
+function KeywordToInt(k: string; out kw: integer): boolean;
+var
+  i: integer;
+begin
+  Result:= False;
+  for i:= low(KeywordDefs) to high(KeywordDefs) do begin
+    if k = KeywordDefs[i].Name then begin
+      kw:= KeywordDefs[i].Value;
+      Exit(True);
+    end;
+  end;
+end;
 
 
 const INCOMLINE = 2;
 const INCOMLINE = 2;
 const INCOMMENT = 4;
 const INCOMMENT = 4;
 const INSTRING = 6;
 const INSTRING = 6;
+const INSTRINGL = 8;
 
 
 
 
 
 
@@ -31,34 +53,54 @@ begin
   6:
   6:
                         start(0);
                         start(0);
   7:
   7:
-                        return(ILLEGAL);
+                        return(_ILLEGAL);
 
 
   8:
   8:
-                         begin
-                           if ypreproc.isdefine(yytext) then begin
-                             unget_char(' ');
-                             unget_string(ypreproc.getdefine(yytext));
-                           end else
-                             return(ID);
-                         end;
+                        return(_NUMDECIMAL);
   9:
   9:
-                         return(ID);
-(*
-[ \t\n\f]               ;
-#define
-#else
-#endif
-#ifdef
-#ifndef
-#include
-#undef
-              
-.                       begin
-                           writeln(erroutput, 'Illegal character in line ',yylineno, ' col ', yycolno);
-                           writeln(erroutput, '"',yyline,'"');
-                           return(ILLEGAL);
-                        end;          
-*)
+                        return(_NUMHEX);
+  10:
+                        return(_NUMDECIMALL);
+  11:
+                        return(_NUMHEXL);
+  12:
+                        begin start(INSTRING); strbuf:= ''; end;
+  13:
+                        strbuf:= strbuf + '"';
+  14:
+                        begin
+                          start(0);
+                          yytext:= strbuf;
+                          return(_QUOTEDSTR);
+                        end;
+  15:
+                        ;
+  16:
+                        return(_ILLEGAL);
+  17:
+                        strbuf:= strbuf + yytext;
+
+  18:
+                        return(_BEGIN);
+  19:
+                        return(_END);
+  20:
+                        begin
+                          if ypreproc.isdefine(yytext) then begin
+                            unget_char(' ');
+                            unget_string(ypreproc.getdefine(yytext));
+                          end else
+                            if KeywordToInt(yytext, kwtmp) then
+                              return(kwtmp)
+                            else
+                              return(_ID);
+                         end;
+  21:
+                        ;
+  22:
+                        returnc(',');
+  23:
+                        return(_ILLEGAL);
   end;
   end;
 end(*yyaction*);
 end(*yyaction*);
 
 
@@ -71,10 +113,10 @@ type YYTRec = record
 
 
 const
 const
 
 
-yynmarks   = 13;
-yynmatches = 13;
-yyntrans   = 21;
-yynstates  = 20;
+yynmarks   = 50;
+yynmatches = 50;
+yyntrans   = 72;
+yynstates  = 48;
 
 
 yyk : array [1..yynmarks] of Integer = (
 yyk : array [1..yynmarks] of Integer = (
   { 0: }
   { 0: }
@@ -86,30 +128,95 @@ yyk : array [1..yynmarks] of Integer = (
   { 6: }
   { 6: }
   { 7: }
   { 7: }
   { 8: }
   { 8: }
-  9,
   { 9: }
   { 9: }
-  8,
-  9,
   { 10: }
   { 10: }
-  9,
+  23,
   { 11: }
   { 11: }
-  2,
+  8,
+  23,
   { 12: }
   { 12: }
-  3,
+  23,
   { 13: }
   { 13: }
-  5,
+  12,
+  23,
   { 14: }
   { 14: }
-  5,
+  20,
+  23,
   { 15: }
   { 15: }
-  7,
+  18,
+  23,
   { 16: }
   { 16: }
-  1,
+  20,
+  23,
   { 17: }
   { 17: }
-  4,
+  19,
+  23,
   { 18: }
   { 18: }
-  8,
+  20,
+  23,
   { 19: }
   { 19: }
-  6
+  21,
+  { 20: }
+  22,
+  23,
+  { 21: }
+  21,
+  23,
+  { 22: }
+  23,
+  { 23: }
+  2,
+  { 24: }
+  3,
+  { 25: }
+  5,
+  { 26: }
+  5,
+  { 27: }
+  7,
+  { 28: }
+  14,
+  17,
+  { 29: }
+  17,
+  { 30: }
+  16,
+  { 31: }
+  17,
+  { 32: }
+  1,
+  { 33: }
+  4,
+  { 34: }
+  8,
+  { 35: }
+  10,
+  { 36: }
+  9,
+  { 37: }
+  20,
+  { 38: }
+  20,
+  { 39: }
+  20,
+  { 40: }
+  6,
+  { 41: }
+  13,
+  { 42: }
+  15,
+  { 43: }
+  11,
+  { 44: }
+  20,
+  { 45: }
+  19,
+  20,
+  { 46: }
+  20,
+  { 47: }
+  18,
+  20
 );
 );
 
 
 yym : array [1..yynmatches] of Integer = (
 yym : array [1..yynmatches] of Integer = (
@@ -122,74 +229,220 @@ yym : array [1..yynmatches] of Integer = (
 { 6: }
 { 6: }
 { 7: }
 { 7: }
 { 8: }
 { 8: }
-  9,
 { 9: }
 { 9: }
-  8,
-  9,
 { 10: }
 { 10: }
-  9,
+  23,
 { 11: }
 { 11: }
-  2,
+  8,
+  23,
 { 12: }
 { 12: }
-  3,
+  23,
 { 13: }
 { 13: }
-  5,
+  12,
+  23,
 { 14: }
 { 14: }
-  5,
+  20,
+  23,
 { 15: }
 { 15: }
-  7,
+  18,
+  23,
 { 16: }
 { 16: }
-  1,
+  20,
+  23,
 { 17: }
 { 17: }
-  4,
+  19,
+  23,
 { 18: }
 { 18: }
-  8,
+  20,
+  23,
 { 19: }
 { 19: }
-  6
+  21,
+{ 20: }
+  22,
+  23,
+{ 21: }
+  21,
+  23,
+{ 22: }
+  23,
+{ 23: }
+  2,
+{ 24: }
+  3,
+{ 25: }
+  5,
+{ 26: }
+  5,
+{ 27: }
+  7,
+{ 28: }
+  14,
+  17,
+{ 29: }
+  17,
+{ 30: }
+  16,
+{ 31: }
+  17,
+{ 32: }
+  1,
+{ 33: }
+  4,
+{ 34: }
+  8,
+{ 35: }
+  10,
+{ 36: }
+  9,
+{ 37: }
+  20,
+{ 38: }
+  20,
+{ 39: }
+  20,
+{ 40: }
+  6,
+{ 41: }
+  13,
+{ 42: }
+  15,
+{ 43: }
+  11,
+{ 44: }
+  20,
+{ 45: }
+  19,
+  20,
+{ 46: }
+  20,
+{ 47: }
+  18,
+  20
 );
 );
 
 
 yyt : array [1..yyntrans] of YYTrec = (
 yyt : array [1..yyntrans] of YYTrec = (
 { 0: }
 { 0: }
-  ( cc: [ #1..#9,#11..'.','0'..'@','['..'^','`','{'..#255 ]; s: 10),
-  ( cc: [ '/' ]; s: 8),
-  ( cc: [ 'A'..'Z','_','a'..'z' ]; s: 9),
+  ( cc: [ #1..#8,#11,#13..#31,'!','#'..'+','-','.',
+            ':'..'@','['..'^','`','|','~'..#255 ]; s: 22),
+  ( cc: [ #9,#12,' ' ]; s: 21),
+  ( cc: [ #10 ]; s: 19),
+  ( cc: [ '"' ]; s: 13),
+  ( cc: [ ',' ]; s: 20),
+  ( cc: [ '/' ]; s: 10),
+  ( cc: [ '0' ]; s: 12),
+  ( cc: [ '1'..'9' ]; s: 11),
+  ( cc: [ 'A','C','D','F'..'Z','_','a'..'z' ]; s: 18),
+  ( cc: [ 'B' ]; s: 14),
+  ( cc: [ 'E' ]; s: 16),
+  ( cc: [ '{' ]; s: 15),
+  ( cc: [ '}' ]; s: 17),
 { 1: }
 { 1: }
-  ( cc: [ #1..#9,#11..'.','0'..'@','['..'^','`','{'..#255 ]; s: 10),
-  ( cc: [ '/' ]; s: 8),
-  ( cc: [ 'A'..'Z','_','a'..'z' ]; s: 9),
+  ( cc: [ #1..#8,#11,#13..#31,'!','#'..'+','-','.',
+            ':'..'@','['..'^','`','|','~'..#255 ]; s: 22),
+  ( cc: [ #9,#12,' ' ]; s: 21),
+  ( cc: [ #10 ]; s: 19),
+  ( cc: [ '"' ]; s: 13),
+  ( cc: [ ',' ]; s: 20),
+  ( cc: [ '/' ]; s: 10),
+  ( cc: [ '0' ]; s: 12),
+  ( cc: [ '1'..'9' ]; s: 11),
+  ( cc: [ 'A','C','D','F'..'Z','_','a'..'z' ]; s: 18),
+  ( cc: [ 'B' ]; s: 14),
+  ( cc: [ 'E' ]; s: 16),
+  ( cc: [ '{' ]; s: 15),
+  ( cc: [ '}' ]; s: 17),
 { 2: }
 { 2: }
-  ( cc: [ #1..#9,#11..#255 ]; s: 12),
-  ( cc: [ #10 ]; s: 11),
+  ( cc: [ #1..#9,#11..#255 ]; s: 24),
+  ( cc: [ #10 ]; s: 23),
 { 3: }
 { 3: }
-  ( cc: [ #1..#9,#11..#255 ]; s: 12),
-  ( cc: [ #10 ]; s: 11),
+  ( cc: [ #1..#9,#11..#255 ]; s: 24),
+  ( cc: [ #10 ]; s: 23),
 { 4: }
 { 4: }
-  ( cc: [ #0 ]; s: 15),
-  ( cc: [ #1..#9,#11..')','+'..#255 ]; s: 13),
-  ( cc: [ '*' ]; s: 14),
+  ( cc: [ #0 ]; s: 27),
+  ( cc: [ #1..#9,#11..')','+'..#255 ]; s: 25),
+  ( cc: [ '*' ]; s: 26),
 { 5: }
 { 5: }
-  ( cc: [ #0 ]; s: 15),
-  ( cc: [ #1..#9,#11..')','+'..#255 ]; s: 13),
-  ( cc: [ '*' ]; s: 14),
+  ( cc: [ #0 ]; s: 27),
+  ( cc: [ #1..#9,#11..')','+'..#255 ]; s: 25),
+  ( cc: [ '*' ]; s: 26),
 { 6: }
 { 6: }
+  ( cc: [ #1..#9,#11..'!','#'..'[',']'..#255 ]; s: 31),
+  ( cc: [ #10 ]; s: 30),
+  ( cc: [ '"' ]; s: 28),
+  ( cc: [ '\' ]; s: 29),
 { 7: }
 { 7: }
+  ( cc: [ #1..#9,#11..'!','#'..'[',']'..#255 ]; s: 31),
+  ( cc: [ #10 ]; s: 30),
+  ( cc: [ '"' ]; s: 28),
+  ( cc: [ '\' ]; s: 29),
 { 8: }
 { 8: }
-  ( cc: [ '*' ]; s: 17),
-  ( cc: [ '/' ]; s: 16),
 { 9: }
 { 9: }
-  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 18),
 { 10: }
 { 10: }
+  ( cc: [ '*' ]; s: 33),
+  ( cc: [ '/' ]; s: 32),
 { 11: }
 { 11: }
+  ( cc: [ '0'..'9' ]; s: 34),
+  ( cc: [ 'L' ]; s: 35),
 { 12: }
 { 12: }
+  ( cc: [ 'x' ]; s: 36),
 { 13: }
 { 13: }
 { 14: }
 { 14: }
-  ( cc: [ '/' ]; s: 19),
+  ( cc: [ '0'..'9','A'..'D','F'..'Z','_','a'..'z' ]; s: 38),
+  ( cc: [ 'E' ]; s: 37),
 { 15: }
 { 15: }
 { 16: }
 { 16: }
+  ( cc: [ '0'..'9','A'..'M','O'..'Z','_','a'..'z' ]; s: 38),
+  ( cc: [ 'N' ]; s: 39),
 { 17: }
 { 17: }
 { 18: }
 { 18: }
-  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 18)
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 38),
 { 19: }
 { 19: }
+{ 20: }
+{ 21: }
+{ 22: }
+{ 23: }
+{ 24: }
+{ 25: }
+{ 26: }
+  ( cc: [ '/' ]; s: 40),
+{ 27: }
+{ 28: }
+  ( cc: [ '"' ]; s: 41),
+{ 29: }
+  ( cc: [ #10 ]; s: 42),
+{ 30: }
+{ 31: }
+{ 32: }
+{ 33: }
+{ 34: }
+  ( cc: [ '0'..'9' ]; s: 34),
+  ( cc: [ 'L' ]; s: 35),
+{ 35: }
+{ 36: }
+  ( cc: [ '0'..'9','A'..'F','a'..'f' ]; s: 36),
+  ( cc: [ 'L' ]; s: 43),
+{ 37: }
+  ( cc: [ '0'..'9','A'..'F','H'..'Z','_','a'..'z' ]; s: 38),
+  ( cc: [ 'G' ]; s: 44),
+{ 38: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 38),
+{ 39: }
+  ( cc: [ '0'..'9','A'..'C','E'..'Z','_','a'..'z' ]; s: 38),
+  ( cc: [ 'D' ]; s: 45),
+{ 40: }
+{ 41: }
+{ 42: }
+{ 43: }
+{ 44: }
+  ( cc: [ '0'..'9','A'..'H','J'..'Z','_','a'..'z' ]; s: 38),
+  ( cc: [ 'I' ]; s: 46),
+{ 45: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 38),
+{ 46: }
+  ( cc: [ '0'..'9','A'..'M','O'..'Z','_','a'..'z' ]; s: 38),
+  ( cc: [ 'N' ]; s: 47),
+{ 47: }
+  ( cc: [ '0'..'9','A'..'Z','_','a'..'z' ]; s: 38)
 );
 );
 
 
 yykl : array [0..yynstates-1] of Integer = (
 yykl : array [0..yynstates-1] of Integer = (
@@ -202,17 +455,45 @@ yykl : array [0..yynstates-1] of Integer = (
 { 6: } 1,
 { 6: } 1,
 { 7: } 1,
 { 7: } 1,
 { 8: } 1,
 { 8: } 1,
-{ 9: } 2,
-{ 10: } 4,
-{ 11: } 5,
-{ 12: } 6,
-{ 13: } 7,
-{ 14: } 8,
+{ 9: } 1,
+{ 10: } 1,
+{ 11: } 2,
+{ 12: } 4,
+{ 13: } 5,
+{ 14: } 7,
 { 15: } 9,
 { 15: } 9,
-{ 16: } 10,
-{ 17: } 11,
-{ 18: } 12,
-{ 19: } 13
+{ 16: } 11,
+{ 17: } 13,
+{ 18: } 15,
+{ 19: } 17,
+{ 20: } 18,
+{ 21: } 20,
+{ 22: } 22,
+{ 23: } 23,
+{ 24: } 24,
+{ 25: } 25,
+{ 26: } 26,
+{ 27: } 27,
+{ 28: } 28,
+{ 29: } 30,
+{ 30: } 31,
+{ 31: } 32,
+{ 32: } 33,
+{ 33: } 34,
+{ 34: } 35,
+{ 35: } 36,
+{ 36: } 37,
+{ 37: } 38,
+{ 38: } 39,
+{ 39: } 40,
+{ 40: } 41,
+{ 41: } 42,
+{ 42: } 43,
+{ 43: } 44,
+{ 44: } 45,
+{ 45: } 46,
+{ 46: } 48,
+{ 47: } 49
 );
 );
 
 
 yykh : array [0..yynstates-1] of Integer = (
 yykh : array [0..yynstates-1] of Integer = (
@@ -224,18 +505,46 @@ yykh : array [0..yynstates-1] of Integer = (
 { 5: } 0,
 { 5: } 0,
 { 6: } 0,
 { 6: } 0,
 { 7: } 0,
 { 7: } 0,
-{ 8: } 1,
-{ 9: } 3,
-{ 10: } 4,
-{ 11: } 5,
-{ 12: } 6,
-{ 13: } 7,
+{ 8: } 0,
+{ 9: } 0,
+{ 10: } 1,
+{ 11: } 3,
+{ 12: } 4,
+{ 13: } 6,
 { 14: } 8,
 { 14: } 8,
-{ 15: } 9,
-{ 16: } 10,
-{ 17: } 11,
-{ 18: } 12,
-{ 19: } 13
+{ 15: } 10,
+{ 16: } 12,
+{ 17: } 14,
+{ 18: } 16,
+{ 19: } 17,
+{ 20: } 19,
+{ 21: } 21,
+{ 22: } 22,
+{ 23: } 23,
+{ 24: } 24,
+{ 25: } 25,
+{ 26: } 26,
+{ 27: } 27,
+{ 28: } 29,
+{ 29: } 30,
+{ 30: } 31,
+{ 31: } 32,
+{ 32: } 33,
+{ 33: } 34,
+{ 34: } 35,
+{ 35: } 36,
+{ 36: } 37,
+{ 37: } 38,
+{ 38: } 39,
+{ 39: } 40,
+{ 40: } 41,
+{ 41: } 42,
+{ 42: } 43,
+{ 43: } 44,
+{ 44: } 45,
+{ 45: } 47,
+{ 46: } 48,
+{ 47: } 50
 );
 );
 
 
 yyml : array [0..yynstates-1] of Integer = (
 yyml : array [0..yynstates-1] of Integer = (
@@ -248,17 +557,45 @@ yyml : array [0..yynstates-1] of Integer = (
 { 6: } 1,
 { 6: } 1,
 { 7: } 1,
 { 7: } 1,
 { 8: } 1,
 { 8: } 1,
-{ 9: } 2,
-{ 10: } 4,
-{ 11: } 5,
-{ 12: } 6,
-{ 13: } 7,
-{ 14: } 8,
+{ 9: } 1,
+{ 10: } 1,
+{ 11: } 2,
+{ 12: } 4,
+{ 13: } 5,
+{ 14: } 7,
 { 15: } 9,
 { 15: } 9,
-{ 16: } 10,
-{ 17: } 11,
-{ 18: } 12,
-{ 19: } 13
+{ 16: } 11,
+{ 17: } 13,
+{ 18: } 15,
+{ 19: } 17,
+{ 20: } 18,
+{ 21: } 20,
+{ 22: } 22,
+{ 23: } 23,
+{ 24: } 24,
+{ 25: } 25,
+{ 26: } 26,
+{ 27: } 27,
+{ 28: } 28,
+{ 29: } 30,
+{ 30: } 31,
+{ 31: } 32,
+{ 32: } 33,
+{ 33: } 34,
+{ 34: } 35,
+{ 35: } 36,
+{ 36: } 37,
+{ 37: } 38,
+{ 38: } 39,
+{ 39: } 40,
+{ 40: } 41,
+{ 41: } 42,
+{ 42: } 43,
+{ 43: } 44,
+{ 44: } 45,
+{ 45: } 46,
+{ 46: } 48,
+{ 47: } 49
 );
 );
 
 
 yymh : array [0..yynstates-1] of Integer = (
 yymh : array [0..yynstates-1] of Integer = (
@@ -270,64 +607,148 @@ yymh : array [0..yynstates-1] of Integer = (
 { 5: } 0,
 { 5: } 0,
 { 6: } 0,
 { 6: } 0,
 { 7: } 0,
 { 7: } 0,
-{ 8: } 1,
-{ 9: } 3,
-{ 10: } 4,
-{ 11: } 5,
-{ 12: } 6,
-{ 13: } 7,
+{ 8: } 0,
+{ 9: } 0,
+{ 10: } 1,
+{ 11: } 3,
+{ 12: } 4,
+{ 13: } 6,
 { 14: } 8,
 { 14: } 8,
-{ 15: } 9,
-{ 16: } 10,
-{ 17: } 11,
-{ 18: } 12,
-{ 19: } 13
+{ 15: } 10,
+{ 16: } 12,
+{ 17: } 14,
+{ 18: } 16,
+{ 19: } 17,
+{ 20: } 19,
+{ 21: } 21,
+{ 22: } 22,
+{ 23: } 23,
+{ 24: } 24,
+{ 25: } 25,
+{ 26: } 26,
+{ 27: } 27,
+{ 28: } 29,
+{ 29: } 30,
+{ 30: } 31,
+{ 31: } 32,
+{ 32: } 33,
+{ 33: } 34,
+{ 34: } 35,
+{ 35: } 36,
+{ 36: } 37,
+{ 37: } 38,
+{ 38: } 39,
+{ 39: } 40,
+{ 40: } 41,
+{ 41: } 42,
+{ 42: } 43,
+{ 43: } 44,
+{ 44: } 45,
+{ 45: } 47,
+{ 46: } 48,
+{ 47: } 50
 );
 );
 
 
 yytl : array [0..yynstates-1] of Integer = (
 yytl : array [0..yynstates-1] of Integer = (
 { 0: } 1,
 { 0: } 1,
-{ 1: } 4,
-{ 2: } 7,
-{ 3: } 9,
-{ 4: } 11,
-{ 5: } 14,
-{ 6: } 17,
-{ 7: } 17,
-{ 8: } 17,
-{ 9: } 19,
-{ 10: } 20,
-{ 11: } 20,
-{ 12: } 20,
-{ 13: } 20,
-{ 14: } 20,
-{ 15: } 21,
-{ 16: } 21,
-{ 17: } 21,
-{ 18: } 21,
-{ 19: } 22
+{ 1: } 14,
+{ 2: } 27,
+{ 3: } 29,
+{ 4: } 31,
+{ 5: } 34,
+{ 6: } 37,
+{ 7: } 41,
+{ 8: } 45,
+{ 9: } 45,
+{ 10: } 45,
+{ 11: } 47,
+{ 12: } 49,
+{ 13: } 50,
+{ 14: } 50,
+{ 15: } 52,
+{ 16: } 52,
+{ 17: } 54,
+{ 18: } 54,
+{ 19: } 55,
+{ 20: } 55,
+{ 21: } 55,
+{ 22: } 55,
+{ 23: } 55,
+{ 24: } 55,
+{ 25: } 55,
+{ 26: } 55,
+{ 27: } 56,
+{ 28: } 56,
+{ 29: } 57,
+{ 30: } 58,
+{ 31: } 58,
+{ 32: } 58,
+{ 33: } 58,
+{ 34: } 58,
+{ 35: } 60,
+{ 36: } 60,
+{ 37: } 62,
+{ 38: } 64,
+{ 39: } 65,
+{ 40: } 67,
+{ 41: } 67,
+{ 42: } 67,
+{ 43: } 67,
+{ 44: } 67,
+{ 45: } 69,
+{ 46: } 70,
+{ 47: } 72
 );
 );
 
 
 yyth : array [0..yynstates-1] of Integer = (
 yyth : array [0..yynstates-1] of Integer = (
-{ 0: } 3,
-{ 1: } 6,
-{ 2: } 8,
-{ 3: } 10,
-{ 4: } 13,
-{ 5: } 16,
-{ 6: } 16,
-{ 7: } 16,
-{ 8: } 18,
-{ 9: } 19,
-{ 10: } 19,
-{ 11: } 19,
-{ 12: } 19,
-{ 13: } 19,
-{ 14: } 20,
-{ 15: } 20,
-{ 16: } 20,
-{ 17: } 20,
-{ 18: } 21,
-{ 19: } 21
+{ 0: } 13,
+{ 1: } 26,
+{ 2: } 28,
+{ 3: } 30,
+{ 4: } 33,
+{ 5: } 36,
+{ 6: } 40,
+{ 7: } 44,
+{ 8: } 44,
+{ 9: } 44,
+{ 10: } 46,
+{ 11: } 48,
+{ 12: } 49,
+{ 13: } 49,
+{ 14: } 51,
+{ 15: } 51,
+{ 16: } 53,
+{ 17: } 53,
+{ 18: } 54,
+{ 19: } 54,
+{ 20: } 54,
+{ 21: } 54,
+{ 22: } 54,
+{ 23: } 54,
+{ 24: } 54,
+{ 25: } 54,
+{ 26: } 55,
+{ 27: } 55,
+{ 28: } 56,
+{ 29: } 57,
+{ 30: } 57,
+{ 31: } 57,
+{ 32: } 57,
+{ 33: } 57,
+{ 34: } 59,
+{ 35: } 59,
+{ 36: } 61,
+{ 37: } 63,
+{ 38: } 64,
+{ 39: } 66,
+{ 40: } 66,
+{ 41: } 66,
+{ 42: } 66,
+{ 43: } 66,
+{ 44: } 68,
+{ 45: } 69,
+{ 46: } 71,
+{ 47: } 72
 );
 );
 
 
 
 

+ 56 - 28
packages/fcl-res/src/rclex.l

@@ -1,8 +1,32 @@
+%{
+var
+  kwtmp: integer;
+  strbuf: string;
+
+const
+  KeywordDefs: array [0..0] of TIdentMapEntry = (
+    (Value: _LANGUAGE; Name: 'LANGUAGE')
+  );
 
 
-%x INCOMLINE INCOMMENT INSTRING
+function KeywordToInt(k: string; out kw: integer): boolean;
+var
+  i: integer;
+begin
+  Result:= False;
+  for i:= low(KeywordDefs) to high(KeywordDefs) do begin
+    if k = KeywordDefs[i].Name then begin
+      kw:= KeywordDefs[i].Value;
+      Exit(True);
+    end;
+  end;
+end;
+
+%}
+%x INCOMLINE INCOMMENT INSTRING INSTRINGL
 
 
-D [0-9]    
+D [0-9]
 H [0-9a-fA-F]
 H [0-9a-fA-F]
+IDENT [a-zA-Z_]([a-zA-Z0-9_])*
 
 
 %%
 %%
 
 
@@ -13,34 +37,38 @@ H [0-9a-fA-F]
 "/*"                    start(INCOMMENT);
 "/*"                    start(INCOMMENT);
 <INCOMMENT>.            ;
 <INCOMMENT>.            ;
 <INCOMMENT>"*/"         start(0);
 <INCOMMENT>"*/"         start(0);
-<INCOMMENT>\0           return(ILLEGAL);
-
-[a-zA-Z_]([a-zA-Z0-9_])* begin
-                           if ypreproc.isdefine(yytext) then begin
-                             unget_char(' ');
-                             unget_string(ypreproc.getdefine(yytext));
-                           end else
-                             return(ID);
+<INCOMMENT>\0           return(_ILLEGAL);
+
+[1-9]([0-9])*           return(_NUMDECIMAL);
+0x{H}*                  return(_NUMHEX);
+[1-9]([0-9])*L          return(_NUMDECIMALL);
+0x{H}*L                 return(_NUMHEXL);
+\"                      begin start(INSTRING); strbuf:= ''; end;
+<INSTRING>\"\"          strbuf:= strbuf + '"';
+<INSTRING>\"            begin
+                          start(0);
+                          yytext:= strbuf;
+                          return(_QUOTEDSTR);
+                        end;
+<INSTRING>\\\n          ;
+<INSTRING>\n            return(_ILLEGAL);
+<INSTRING>.             strbuf:= strbuf + yytext;
+
+BEGIN|{                 return(_BEGIN);
+END|}                   return(_END);
+{IDENT}                 begin
+                          if ypreproc.isdefine(yytext) then begin
+                            unget_char(' ');
+                            unget_string(ypreproc.getdefine(yytext));
+                          end else
+                            if KeywordToInt(yytext, kwtmp) then
+                              return(kwtmp)
+                            else
+                              return(_ID);
                          end;
                          end;
-.                        return(ID);
-%{
-(*
 [ \t\n\f]               ;
 [ \t\n\f]               ;
-#define
-#else
-#endif
-#ifdef
-#ifndef
-#include
-#undef
-              
-.                       begin
-                           writeln(erroutput, 'Illegal character in line ',yylineno, ' col ', yycolno);
-                           writeln(erroutput, '"',yyline,'"');
-                           return(ILLEGAL);
-                        end;          
-*)
-%}
+","                     returnc(',');
+.                       return(_ILLEGAL);
 %%
 %%
 
 
 // end.
 // end.

+ 472 - 30
packages/fcl-res/src/rcparser.pas

@@ -109,22 +109,61 @@ begin
   end;
   end;
 end;
 end;
 
 
+type
+  rcnumtype = record
+    v: LongWord;
+    long: boolean;
+  end;
+
+var
+  aktresource: TAbstractResource;
+  language: TLangID;
+  filestream: TFileStream;
+
+procedure create_resource(aId, aType: TResourceDesc; aClass: TResourceClass);
+var
+  r: TAbstractResource;
+begin
+  r:= aClass.Create(aId, aType);
+  r.LangID:= language;
+  aktresources.Add(r);
+  aktresource:= r;
+end;
+
+procedure create_resource(aId, aType: TResourceDesc); overload;
+begin
+  create_resource(aId, aType, TGenericResource);
+end;
+
+procedure assign_custom_stream(fn: string);
+var
+  fs: TFileStream;
+begin
+  fs:= TFileStream.Create(fn, fmOpenRead or fmShareDenyWrite);
+  aktresource.SetCustomRawDataStream(fs);
+end;
+
 
 
 var
 var
   yycapture: AnsiString;
   yycapture: AnsiString;
-const ILLEGAL = 257;
-const CSTRING = 258;
-const NUMBER = 259;
-const ID = 260;
-const EQUAL = 261;
-const R_AND = 262;
-const UNEQUAL = 263;
-const GT = 264;
-const LT = 265;
-const GTE = 266;
-const LTE = 267;
-const QUESTIONMARK = 268;
-const COLON = 269;
+const _ILLEGAL = 257;
+const _NUMDECIMAL = 258;
+const _NUMHEX = 259;
+const _NUMDECIMALL = 260;
+const _NUMHEXL = 261;
+const _QUOTEDSTR = 262;
+const _BEGIN = 263;
+const _END = 264;
+const _LANGUAGE = 265;
+const _VERSION = 266;
+const _ID = 267;
+
+type YYSType = record case Integer of
+                 1 : ( yyString : String );
+                 2 : ( yyTMemoryStream : TMemoryStream );
+                 3 : ( yyTResourceDesc : TResourceDesc );
+                 4 : ( yyrcnumtype : rcnumtype );
+               end(*YYSType*);
 
 
 var yylval : YYSType;
 var yylval : YYSType;
 
 
@@ -143,9 +182,93 @@ begin
   (* actions: *)
   (* actions: *)
   case yyruleno of
   case yyruleno of
    1 : begin
    1 : begin
-         Echo; 
        end;
        end;
    2 : begin
    2 : begin
+         yyval := yyv[yysp-1];
+       end;
+   3 : begin
+         yyval := yyv[yysp-0];
+       end;
+   4 : begin
+         yyval := yyv[yysp-0];
+       end;
+   5 : begin
+         yyval := yyv[yysp-0];
+       end;
+   6 : begin
+         create_resource(yyv[yysp-1].yyTResourceDesc, yyv[yysp-0].yyTResourceDesc); 
+       end;
+   7 : begin
+         assign_custom_stream(yyv[yysp-0].yyString); 
+       end;
+   8 : begin
+         create_resource(yyv[yysp-1].yyTResourceDesc, yyv[yysp-0].yyTResourceDesc); 
+       end;
+   9 : begin
+         aktresource.SetCustomRawDataStream(yyv[yysp-1].yyTMemoryStream); 
+       end;
+  10 : begin
+         yyval.yyTResourceDesc:= TResourceDesc.Create(yyv[yysp-0].yyrcnumtype.v); 
+       end;
+  11 : begin
+         yyval.yyTResourceDesc:= TResourceDesc.Create(yyv[yysp-0].yyString); 
+       end;
+  12 : begin
+         language:= MakeLangID(yyv[yysp-2].yyrcnumtype.v, yyv[yysp-0].yyrcnumtype.v); 
+       end;
+  13 : begin
+         yyval := yyv[yysp-0];
+       end;
+  14 : begin
+         yyval.yyrcnumtype.v:= StrToInt(yytext); yyval.yyrcnumtype.long:= False; 
+       end;
+  15 : begin
+         yyval.yyrcnumtype.v:= StrToInt(Copy(yytext,1,length(yytext)-1)); yyval.yyrcnumtype.long:= True; 
+       end;
+  16 : begin
+         yyval.yyrcnumtype.v:= StrToInt('$'+Copy(yytext,3,Maxint)); yyval.yyrcnumtype.long:= False; 
+       end;
+  17 : begin
+         yyval.yyrcnumtype.v:= StrToInt('$'+Copy(yytext,3,length(yytext)-3)); yyval.yyrcnumtype.long:= True; 
+       end;
+  18 : begin
+         yyval.yyString:= yytext; 
+       end;
+  19 : begin
+         yyval.yyString:= yytext; 
+       end;
+  20 : begin
+         yyval.yyString:= yytext; 
+       end;
+  21 : begin
+         yyval.yyString:= yytext; 
+       end;
+  22 : begin
+         yyval.yyTMemoryStream:= TMemoryStream.Create; 
+       end;
+  23 : begin
+         yyval := yyv[yysp-1];
+       end;
+  24 : begin
+         yyval.yyTMemoryStream:= yyv[yysp-1].yyTMemoryStream; 
+       end;
+  25 : begin
+         yyval := yyv[yysp-3];
+       end;
+  26 : begin
+         
+         yyval.yyTMemoryStream:= yyv[yysp-1].yyTMemoryStream;
+         yyval.yyTMemoryStream.WriteBuffer(yyv[yysp-0].yyString[1], Length(yyv[yysp-0].yyString));
+         
+       end;
+  27 : begin
+         
+         yyval.yyTMemoryStream:= yyv[yysp-1].yyTMemoryStream;
+         if yyv[yysp-0].yyrcnumtype.long then
+         yyval.yyTMemoryStream.WriteDWord(NtoLE(yyv[yysp-0].yyrcnumtype.v))
+         else
+         yyval.yyTMemoryStream.WriteWord(NtoLE(Word(yyv[yysp-0].yyrcnumtype.v)));
+         
        end;
        end;
   end;
   end;
 end(*yyaction*);
 end(*yyaction*);
@@ -161,59 +284,378 @@ type YYARec = record
 
 
 const
 const
 
 
-yynacts   = 2;
-yyngotos  = 1;
-yynstates = 3;
-yynrules  = 2;
+yynacts   = 39;
+yyngotos  = 27;
+yynstates = 36;
+yynrules  = 27;
 
 
 yya : array [1..yynacts] of YYARec = (
 yya : array [1..yynacts] of YYARec = (
 { 0: }
 { 0: }
 { 1: }
 { 1: }
   ( sym: 0; act: 0 ),
   ( sym: 0; act: 0 ),
-  ( sym: 260; act: 2 )
+  ( sym: 258; act: 9 ),
+  ( sym: 259; act: 10 ),
+  ( sym: 260; act: 11 ),
+  ( sym: 261; act: 12 ),
+  ( sym: 262; act: 13 ),
+  ( sym: 265; act: 14 ),
+  ( sym: 267; act: 15 ),
 { 2: }
 { 2: }
+{ 3: }
+{ 4: }
+{ 5: }
+{ 6: }
+  ( sym: 258; act: 9 ),
+  ( sym: 259; act: 10 ),
+  ( sym: 260; act: 11 ),
+  ( sym: 261; act: 12 ),
+  ( sym: 262; act: 13 ),
+  ( sym: 267; act: 15 ),
+{ 7: }
+{ 8: }
+{ 9: }
+{ 10: }
+{ 11: }
+{ 12: }
+{ 13: }
+{ 14: }
+  ( sym: 258; act: 9 ),
+  ( sym: 259; act: 10 ),
+  ( sym: 260; act: 11 ),
+  ( sym: 261; act: 12 ),
+{ 15: }
+{ 16: }
+  ( sym: 262; act: -6 ),
+  ( sym: 263; act: -8 ),
+{ 17: }
+{ 18: }
+  ( sym: 44; act: 21 ),
+{ 19: }
+  ( sym: 263; act: 22 ),
+{ 20: }
+  ( sym: 262; act: 24 ),
+{ 21: }
+  ( sym: 258; act: 9 ),
+  ( sym: 259; act: 10 ),
+  ( sym: 260; act: 11 ),
+  ( sym: 261; act: 12 ),
+{ 22: }
+{ 23: }
+{ 24: }
+{ 25: }
+{ 26: }
+  ( sym: 258; act: 9 ),
+  ( sym: 259; act: 10 ),
+  ( sym: 260; act: 11 ),
+  ( sym: 261; act: 12 ),
+  ( sym: 262; act: 31 ),
+{ 27: }
+  ( sym: 44; act: 32 ),
+  ( sym: 264; act: 33 ),
+{ 28: }
+{ 29: }
+{ 30: }
+{ 31: }
+{ 32: }
+{ 33: }
+{ 34: }
+  ( sym: 258; act: 9 ),
+  ( sym: 259; act: 10 ),
+  ( sym: 260; act: 11 ),
+  ( sym: 261; act: 12 ),
+  ( sym: 262; act: 31 )
+{ 35: }
 );
 );
 
 
 yyg : array [1..yyngotos] of YYARec = (
 yyg : array [1..yyngotos] of YYARec = (
 { 0: }
 { 0: }
-  ( sym: -2; act: 1 )
+  ( sym: -10; act: 1 ),
 { 1: }
 { 1: }
+  ( sym: -14; act: 2 ),
+  ( sym: -13; act: 3 ),
+  ( sym: -12; act: 4 ),
+  ( sym: -11; act: 5 ),
+  ( sym: -7; act: 6 ),
+  ( sym: -4; act: 7 ),
+  ( sym: -3; act: 8 ),
 { 2: }
 { 2: }
+{ 3: }
+{ 4: }
+{ 5: }
+{ 6: }
+  ( sym: -7; act: 16 ),
+  ( sym: -4; act: 7 ),
+  ( sym: -3; act: 8 ),
+{ 7: }
+{ 8: }
+{ 9: }
+{ 10: }
+{ 11: }
+{ 12: }
+{ 13: }
+{ 14: }
+  ( sym: -3; act: 17 ),
+  ( sym: -2; act: 18 ),
+{ 15: }
+{ 16: }
+  ( sym: -16; act: 19 ),
+  ( sym: -15; act: 20 ),
+{ 17: }
+{ 18: }
+{ 19: }
+{ 20: }
+  ( sym: -5; act: 23 ),
+{ 21: }
+  ( sym: -3; act: 17 ),
+  ( sym: -2; act: 25 ),
+{ 22: }
+  ( sym: -17; act: 26 ),
+  ( sym: -8; act: 27 ),
+{ 23: }
+{ 24: }
+{ 25: }
+{ 26: }
+  ( sym: -9; act: 28 ),
+  ( sym: -6; act: 29 ),
+  ( sym: -3; act: 30 ),
+{ 27: }
+{ 28: }
+{ 29: }
+{ 30: }
+{ 31: }
+{ 32: }
+  ( sym: -18; act: 34 ),
+{ 33: }
+{ 34: }
+  ( sym: -9; act: 35 ),
+  ( sym: -6; act: 29 ),
+  ( sym: -3; act: 30 )
+{ 35: }
 );
 );
 
 
 yyd : array [0..yynstates-1] of Integer = (
 yyd : array [0..yynstates-1] of Integer = (
-{ 0: } -2,
+{ 0: } -1,
 { 1: } 0,
 { 1: } 0,
-{ 2: } -1
+{ 2: } -5,
+{ 3: } -4,
+{ 4: } -3,
+{ 5: } -2,
+{ 6: } 0,
+{ 7: } -11,
+{ 8: } -10,
+{ 9: } -14,
+{ 10: } -16,
+{ 11: } -15,
+{ 12: } -17,
+{ 13: } -19,
+{ 14: } 0,
+{ 15: } -18,
+{ 16: } 0,
+{ 17: } -13,
+{ 18: } 0,
+{ 19: } 0,
+{ 20: } 0,
+{ 21: } 0,
+{ 22: } -22,
+{ 23: } -7,
+{ 24: } -20,
+{ 25: } -12,
+{ 26: } 0,
+{ 27: } 0,
+{ 28: } -23,
+{ 29: } -26,
+{ 30: } -27,
+{ 31: } -21,
+{ 32: } -24,
+{ 33: } -9,
+{ 34: } 0,
+{ 35: } -25
 );
 );
 
 
 yyal : array [0..yynstates-1] of Integer = (
 yyal : array [0..yynstates-1] of Integer = (
 { 0: } 1,
 { 0: } 1,
 { 1: } 1,
 { 1: } 1,
-{ 2: } 3
+{ 2: } 9,
+{ 3: } 9,
+{ 4: } 9,
+{ 5: } 9,
+{ 6: } 9,
+{ 7: } 15,
+{ 8: } 15,
+{ 9: } 15,
+{ 10: } 15,
+{ 11: } 15,
+{ 12: } 15,
+{ 13: } 15,
+{ 14: } 15,
+{ 15: } 19,
+{ 16: } 19,
+{ 17: } 21,
+{ 18: } 21,
+{ 19: } 22,
+{ 20: } 23,
+{ 21: } 24,
+{ 22: } 28,
+{ 23: } 28,
+{ 24: } 28,
+{ 25: } 28,
+{ 26: } 28,
+{ 27: } 33,
+{ 28: } 35,
+{ 29: } 35,
+{ 30: } 35,
+{ 31: } 35,
+{ 32: } 35,
+{ 33: } 35,
+{ 34: } 35,
+{ 35: } 40
 );
 );
 
 
 yyah : array [0..yynstates-1] of Integer = (
 yyah : array [0..yynstates-1] of Integer = (
 { 0: } 0,
 { 0: } 0,
-{ 1: } 2,
-{ 2: } 2
+{ 1: } 8,
+{ 2: } 8,
+{ 3: } 8,
+{ 4: } 8,
+{ 5: } 8,
+{ 6: } 14,
+{ 7: } 14,
+{ 8: } 14,
+{ 9: } 14,
+{ 10: } 14,
+{ 11: } 14,
+{ 12: } 14,
+{ 13: } 14,
+{ 14: } 18,
+{ 15: } 18,
+{ 16: } 20,
+{ 17: } 20,
+{ 18: } 21,
+{ 19: } 22,
+{ 20: } 23,
+{ 21: } 27,
+{ 22: } 27,
+{ 23: } 27,
+{ 24: } 27,
+{ 25: } 27,
+{ 26: } 32,
+{ 27: } 34,
+{ 28: } 34,
+{ 29: } 34,
+{ 30: } 34,
+{ 31: } 34,
+{ 32: } 34,
+{ 33: } 34,
+{ 34: } 39,
+{ 35: } 39
 );
 );
 
 
 yygl : array [0..yynstates-1] of Integer = (
 yygl : array [0..yynstates-1] of Integer = (
 { 0: } 1,
 { 0: } 1,
 { 1: } 2,
 { 1: } 2,
-{ 2: } 2
+{ 2: } 9,
+{ 3: } 9,
+{ 4: } 9,
+{ 5: } 9,
+{ 6: } 9,
+{ 7: } 12,
+{ 8: } 12,
+{ 9: } 12,
+{ 10: } 12,
+{ 11: } 12,
+{ 12: } 12,
+{ 13: } 12,
+{ 14: } 12,
+{ 15: } 14,
+{ 16: } 14,
+{ 17: } 16,
+{ 18: } 16,
+{ 19: } 16,
+{ 20: } 16,
+{ 21: } 17,
+{ 22: } 19,
+{ 23: } 21,
+{ 24: } 21,
+{ 25: } 21,
+{ 26: } 21,
+{ 27: } 24,
+{ 28: } 24,
+{ 29: } 24,
+{ 30: } 24,
+{ 31: } 24,
+{ 32: } 24,
+{ 33: } 25,
+{ 34: } 25,
+{ 35: } 28
 );
 );
 
 
 yygh : array [0..yynstates-1] of Integer = (
 yygh : array [0..yynstates-1] of Integer = (
 { 0: } 1,
 { 0: } 1,
-{ 1: } 1,
-{ 2: } 1
+{ 1: } 8,
+{ 2: } 8,
+{ 3: } 8,
+{ 4: } 8,
+{ 5: } 8,
+{ 6: } 11,
+{ 7: } 11,
+{ 8: } 11,
+{ 9: } 11,
+{ 10: } 11,
+{ 11: } 11,
+{ 12: } 11,
+{ 13: } 11,
+{ 14: } 13,
+{ 15: } 13,
+{ 16: } 15,
+{ 17: } 15,
+{ 18: } 15,
+{ 19: } 15,
+{ 20: } 16,
+{ 21: } 18,
+{ 22: } 20,
+{ 23: } 20,
+{ 24: } 20,
+{ 25: } 20,
+{ 26: } 23,
+{ 27: } 23,
+{ 28: } 23,
+{ 29: } 23,
+{ 30: } 23,
+{ 31: } 23,
+{ 32: } 24,
+{ 33: } 24,
+{ 34: } 27,
+{ 35: } 27
 );
 );
 
 
 yyr : array [1..yynrules] of YYRRec = (
 yyr : array [1..yynrules] of YYRRec = (
-{ 1: } ( len: 2; sym: -2 ),
-{ 2: } ( len: 0; sym: -2 )
+{ 1: } ( len: 0; sym: -10 ),
+{ 2: } ( len: 2; sym: -10 ),
+{ 3: } ( len: 1; sym: -11 ),
+{ 4: } ( len: 1; sym: -11 ),
+{ 5: } ( len: 1; sym: -12 ),
+{ 6: } ( len: 0; sym: -15 ),
+{ 7: } ( len: 4; sym: -14 ),
+{ 8: } ( len: 0; sym: -16 ),
+{ 9: } ( len: 6; sym: -14 ),
+{ 10: } ( len: 1; sym: -7 ),
+{ 11: } ( len: 1; sym: -7 ),
+{ 12: } ( len: 4; sym: -13 ),
+{ 13: } ( len: 1; sym: -2 ),
+{ 14: } ( len: 1; sym: -3 ),
+{ 15: } ( len: 1; sym: -3 ),
+{ 16: } ( len: 1; sym: -3 ),
+{ 17: } ( len: 1; sym: -3 ),
+{ 18: } ( len: 1; sym: -4 ),
+{ 19: } ( len: 1; sym: -4 ),
+{ 20: } ( len: 1; sym: -5 ),
+{ 21: } ( len: 1; sym: -6 ),
+{ 22: } ( len: 0; sym: -17 ),
+{ 23: } ( len: 2; sym: -8 ),
+{ 24: } ( len: 0; sym: -18 ),
+{ 25: } ( len: 4; sym: -8 ),
+{ 26: } ( len: 1; sym: -9 ),
+{ 27: } ( len: 1; sym: -9 )
 );
 );
 
 
 
 

+ 114 - 9
packages/fcl-res/src/rcparser.y

@@ -105,25 +105,130 @@ begin
   end;
   end;
 end;
 end;
 
 
+type
+  rcnumtype = record
+    v: LongWord;
+    long: boolean;
+  end;
+
+var
+  aktresource: TAbstractResource;
+  language: TLangID;
+  filestream: TFileStream;
+
+procedure create_resource(aId, aType: TResourceDesc; aClass: TResourceClass);
+var
+  r: TAbstractResource;
+begin
+  r:= aClass.Create(aId, aType);
+  r.LangID:= language;
+  aktresources.Add(r);
+  aktresource:= r;
+end;
+
+procedure create_resource(aId, aType: TResourceDesc); overload;
+begin
+  create_resource(aId, aType, TGenericResource);
+end;
+
+procedure assign_custom_stream(fn: string);
+var
+  fs: TFileStream;
+begin
+  fs:= TFileStream.Create(fn, fmOpenRead or fmShareDenyWrite);
+  aktresource.SetCustomRawDataStream(fs);
+end;
+
 
 
 var
 var
   yycapture: AnsiString;
   yycapture: AnsiString;
 %}
 %}
 
 
-%token ILLEGAL
-%token CSTRING NUMBER
-%token ID
+%token _ILLEGAL
+%token _NUMDECIMAL _NUMHEX _NUMDECIMALL _NUMHEXL _QUOTEDSTR
+%token _BEGIN _END
+%token _LANGUAGE _VERSION
+%token _ID
 
 
-%right EQUAL
-%right R_AND
+%type <rcnumtype> numpos numeral
+%type <String> ident_string filename_string long_string
+%type <TResourceDesc> resid
+%type <TMemoryStream> raw_data raw_item
 
 
-%left UNEQUAL GT LT GTE LTE
-%left QUESTIONMARK COLON
 %%
 %%
 
 
 rcfile
 rcfile
-    : rcfile ID               { Echo; }
-    |
+    : /* empty */
+    | rcfile defnstatement
+    ;
+
+defnstatement
+    : resourcedef
+    | languagedef
+    ;
+
+resourcedef
+    : res_user
+    ;
+
+res_user
+    : resid resid { create_resource($1, $2); } filename_string                  { assign_custom_stream($4); }
+    | resid resid { create_resource($1, $2); } _BEGIN raw_data _END             { aktresource.SetCustomRawDataStream($5); }
+    ;
+
+
+resid
+    : numeral                                      { $$:= TResourceDesc.Create($1.v); }
+    | ident_string                                 { $$:= TResourceDesc.Create($1); }
+    ;
+
+languagedef
+    : _LANGUAGE numpos ',' numpos                  { language:= MakeLangID($2.v, $4.v); }
+
+numpos
+    : numeral
+    ;
+
+numeral
+    : _NUMDECIMAL                                  { $$.v:= StrToInt(yytext); $$.long:= False; }
+    | _NUMDECIMALL                                 { $$.v:= StrToInt(Copy(yytext,1,length(yytext)-1)); $$.long:= True; }
+    | _NUMHEX                                      { $$.v:= StrToInt('$'+Copy(yytext,3,Maxint)); $$.long:= False; }
+    | _NUMHEXL                                     { $$.v:= StrToInt('$'+Copy(yytext,3,length(yytext)-3)); $$.long:= True; }
+    ;
+
+ident_string
+    : _ID                                          { $$:= yytext; }
+    | _QUOTEDSTR                                   { $$:= yytext; }
+    ;
+
+filename_string
+    : _QUOTEDSTR                                   { $$:= yytext; }
+    ;
+
+long_string
+    : _QUOTEDSTR                                   { $$:= yytext; }
+    ;
+
+raw_data
+    :                                              { $$:= TMemoryStream.Create; }
+      raw_item
+    | raw_data ',' { $$:= $1; } raw_item
+    ;
+
+raw_item
+    : long_string
+      {
+        $$:= $<TMemoryStream>0;
+        $$.WriteBuffer($1[1], Length($1));
+      }
+    | numeral
+      {
+        $$:= $<TMemoryStream>0;
+        if $1.long then
+          $$.WriteDWord(NtoLE($1.v))
+        else
+          $$.WriteWord(NtoLE(Word($1.v)));
+      }
     ;
     ;
 
 
 %%
 %%