EnglishРусский  

   ..

   alias.c

   alias.h

   bcodes.c

   bcodes.h

   body.c

   compile.c

   compile.h

   define.c

   define.h

   desc.c

   expr.c

   extern.c

   for.c

   foreach.c

   func.c

   func.h

   global.c

   global.h

   goto.c

   if.c

   ifdef.c

   ifdef.h

   import.c

   import.h

   include.c

   include.h

   jump.c

   lexem.c

   lexem.h

   macro.c

   macro.h

   operlist.txt

   out.c

   out.h

   subfunc.c

   switch.c

   type.c

   type.h

   vars.c

   while.c

   with.c

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

  1 /******************************************************************************
  2 *
  3 * Copyright (C) 2006, The Gentee Group. All rights reserved. 
  4 * This file is part of the Gentee open source project - http://www.gentee.com. 
  5 * 
  6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT"). 
  7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS 
  8 * ACCEPTANCE OF THE AGREEMENT.
  9 *
 10 * ID: lexem 18.10.06 0.0.A.
 11 *
 12 * Author: Alexey Krivonogov ( gentee )
 13 *
 14 * Summary: Working with lexems
 15 *
 16 ******************************************************************************/
 17 
 18 #ifndef _LEXEM_
 19 #define _LEXEM_
 20 
 21    #ifdef __cplusplus               
 22       extern "C" {                 
 23    #endif // __cplusplus      
 24 
 25 #include "../common/str.h"
 26 #include "../common/arr.h"
 27 #include "../common/number.h"
 28 
 29 /*-----------------------------------------------------------------------------
 30 *
 31 * ID: lexemtype 23.10.06 0.0.A.
 32 * 
 33 * Summary: The type of lexems
 34 *  
 35 -----------------------------------------------------------------------------*/
 36 
 37 #define LEXEM_SKIP     0x0000    //  Skip this lexem
 38 #define LEXEM_BINARY   0x0001    //  Binary data 
 39 #define LEXEM_STRING   0x0002    //  Text string 
 40 #define LEXEM_NUMBER   0x0003    //  Number decimal, hexadecimal, float or double 
 41 #define LEXEM_MACRO    0x0004    //  Macro identifier $name 
 42 #define LEXEM_OPER     0x0005    //  Operations 
 43 #define LEXEM_NAME     0x0006    //  Name identifier 
 44 #define LEXEM_KEYWORD  0x0007    //  Keyword
 45 #define LEXEM_FILENAME 0x0008    //  Data from filename
 46 #define LEXEM_COLLECT  0x0009    //  Collection for macro expressions
 47 //#define LEXEM_LINE    0x0003    //  New line 0x0D0A or 0x0A 
 48 
 49 /*-----------------------------------------------------------------------------
 50 *
 51 * ID: lexemsys 23.10.06 0.0.A.
 52 * 
 53 * Summary: Some characters
 54 *  
 55 -----------------------------------------------------------------------------*/
 56 
 57 #define LSYS_LBRACK     0x00000028    // (
 58 #define LSYS_RBRACK     0x00000029    // )
 59 #define LSYS_COMMA      0x0000002C    // ,
 60 #define LSYS_DOT        0x0000002E    // .
 61 #define LSYS_LESS       0x0000003C    // <
 62 #define LSYS_EQ         0x0000003D    // =
 63 #define LSYS_GREATER    0x0000003E    // >
 64 #define LSYS_LCURLY     0x0000007B    // {
 65 #define LSYS_VLINE      0x0000007C    // |
 66 #define LSYS_RCURLY     0x0000007D    // }
 67 #define LSYS_COLLECT    0x00007B25    // %{
 68 #define LSYS_PLUSEQ     0x00003D2B    // +=
 69 #define LSYS_PTR        0x00003E2D    // ->
 70 
 71 /*-----------------------------------------------------------------------------
 72 *
 73 * ID: lexoper 23.10.06 0.0.A.
 74 * 
 75 * Summary: The type of operation lexem
 76 *  
 77 -----------------------------------------------------------------------------*/
 78 
 79 typedef struct
 80 {
 81    uint    name;     // LEXSYS_****
 82    uint    operid;   // the identifier of the operation
 83 } lexoper, * plexoper;
 84 
 85 // Флаги для lexitem
 86 #define  LEXF_CALL      0x01    // Возможный вызов функции или метода так как следом идет 
 87                                 // круглая скобка
 88 #define  LEXF_METHOD    0x02    // Вызов или описание метода
 89 #define  LEXF_OPERATOR  0x04    // Вызов или описание оператора
 90 #define  LEXF_ARR       0x08    // Возможное обращение к массивы так как следом идет 
 91                                 // квадратная скобка
 92 #define  LEXF_PROPERTY  0x10    // Метод должен быть свойством
 93 #define  LEXF_NAME      0x20    // Передача указателя на имя
 94 
 95 /*-----------------------------------------------------------------------------
 96 *
 97 * ID: lexem 23.10.06 0.0.A.
 98 * 
 99 * Summary: The lexem type
100 *  
101 -----------------------------------------------------------------------------*/
102 
103 typedef struct
104 {
105    uint    flag;    // Lexem flags
106    ubyte   type;    // Lexem type
107    uint    pos;     // The offset of the lexem
108    union {
109       uint    binid;  // BINARY
110       uint    strid;  // STRING
111       uint    macroid; // MACRO
112       uint    nameid;  // NAME
113       uint    key;     // KEYWORD
114       number  num;     // NUMBER
115       lexoper oper;    // OPERATION
116    };
117 } lexem, * plexem;
118 
119 typedef struct
120 {	
121 	uint flgdesc;
122 	uint idtype;//Идентификатор типа
123 	
124    uint oftype;//Тип элемента
125    uint msr;   //Размерность
126 	uint msrs[MAX_MSR];  //Меры
127 	pubyte name; //Имя параметра-переменной
128 	plexem lex;  //Текущая лексема для вывода ошибки
129    plexem lexres;   // Лексема для реультата макровыражения
130 } s_descid, *ps_descid;
131 
132 /*-----------------------------------------------------------------------------
133 *
134 * ID: lexnextflag 23.10.06 0.0.A.
135 * 
136 * Summary: Flag for lexem_next
137 *  
138 -----------------------------------------------------------------------------*/
139 
140 #define LEXNEXT_IGNLINE  0x0001  // Skip LEXEM_OPER ->OpLine
141 #define LEXNEXT_NULL     0x0002  // Return NULL if there is not the next lexem
142                                  // otherwise error
143 #define LEXNEXT_LCURLY   0x0004  // Wait for left curly {
144 #define LEXNEXT_IGNCOMMA 0x0008  // Ignore ,
145 #define LEXNEXT_SKIPLINE 0x0010  // Skip new line move only if lex is New line
146 #define LEXNEXT_NAME     0x0020  // Must be a name of the indentifier
147 #define LEXNEXT_NAMEDEF  0x0040  // Check mygroup.myname for 'namedef' macros
148 #define LEXNEXT_NOMACRO  0x0080  // Ignore $Macros
149 
150 //--------------------------------------------------------------------------
151 
152 uint    STDCALL  lexem_load( parr lexems, parr input );
153 plexem  STDCALL  lexem_copy( plexem dest, plexem src );
154 void    STDCALL  lexem_delete( parr lexems );
155 pstr    STDCALL  lexem_getstr( plexem plex );
156 uint    STDCALL  lexem_isys( plexem plex, uint ch );
157 plexem  STDCALL  lexem_next( plexem plex, uint flag );
158 pubyte  STDCALL  lexem_getname( plexem plex );
159 
160 //--------------------------------------------------------------------------
161 
162    #ifdef __cplusplus              
163       }                            
164    #endif // __cplusplus
165 
166 #endif // _LEXEM_
167 
168