EnglishРусский  

   ..

   lex.g

   lexnew.g

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.

source\lib\lex\lex.g
  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: lex 18.10.06 0.0.A.
 11 *
 12 * Author: Alexey Krivonogov ( gentee )
 13 *
 14 * Summary: Interface to the lexcal analizer.
 15 *
 16 ******************************************************************************/
 17 
 18 type lexitem
 19 {
 20    uint    ltype
 21    uint    pos  
 22    uint    len
 23    uint    value  
 24 } 
 25 
 26 type arrout
 27 {
 28    buf   data
 29    uint  isize
 30    byte  isobj  // Each item is a memory block
 31 }
 32 
 33 /*type hashout
 34 {
 35    arrout   values
 36    arrout   names
 37    uint     isize
 38    byte     ignore
 39 }*/
 40 
 41 type lexmulti
 42 {
 43    uint    chars   // Последовательность символов.
 44    uint    value   // результирующая команда
 45    byte    len     // количество символов
 46 }
 47 
 48 /*type lex
 49 {
 50    buf      tbl
 51    arrout   state   // Стэк состояний в котором хранится история состояний.
 52    arrout   litems  // Хранятся номера lexitem при занесение в стэк state. 
 53    arrout   mitems  // Массив multi определений
 54                     // Резервируется 64 блока на всю таблицу по 8 элементов в 
 55                     // каждом блоке. Каждый элемент lexmulti.
 56    uint     imulti  // Текущий свободный номер в массиве multi
 57    hashout  keywords
 58 }
 59 */
 60 import $"..\..\projects\msvisual6.0\gentee2\release\gentee2.dll"<link>
 61 {
 62    uint  gentee_lex( buf, uint, arrout )
 63    uint  lex_tbl( uint, uint )
 64    uint  gentee_deinit()
 65    uint  gentee_init( uint )
 66    uint  lex_init( uint, uint )
 67          lex_delete( uint )
 68 }
 69 
 70 /*method lex.init
 71 {
 72    uint size = 512 * sizeof( lexmulti )
 73    this.mitems.isize = sizeof( lexmulti )
 74    this.mitems.data.expand( size )
 75    this.mitems.data.use = size
 76    mzero( this.mitems.data.ptr(), size )
 77    lex_init( this, 0 )
 78 }
 79 
 80 method lex.delete
 81 {
 82    uint size = 512 * sizeof( lexmulti )
 83    this.mitems.isize = sizeof( lexmulti )
 84    this.mitems.data.expand( size )
 85    this.mitems.data.use = size
 86    mzero( this.mitems.data.ptr(), size )
 87    lex_delete( this )
 88 }
 89 */
 90 method arrout arrout.init
 91 {
 92    this.isize = sizeof( uint )
 93    return this
 94 }
 95 
 96 operator uint *( arrout left )
 97 {
 98    return left.data.use / left.isize
 99 }
100 
101 func lex_init<entry>
102 {
103    gentee_init( 0 )   
104 }
105 
106